Browse Source

Merge pull request #1289 from Mixa84/FSM

Fix gatewaysbind
pull/4/head
jl777 5 years ago
committed by GitHub
parent
commit
1da0a1710d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/cc/gateways.cpp
  2. 10
      src/wallet/rpcwallet.cpp

2
src/cc/gateways.cpp

@ -956,7 +956,7 @@ std::string GatewaysBind(uint64_t txfee,std::string coin,uint256 tokenid,int64_t
prefix2 = p2;
wiftype = p3;
taddr = p4;
LogPrint("gatewayscc-1","set prefix %d, prefix2 %d, wiftype %d for %s\n",prefix,prefix2,wiftype,coin.c_str());
LogPrint("gatewayscc-1","set prefix %d, prefix2 %d, wiftype %d, taddr %d for %s\n",prefix,prefix2,wiftype,taddr,coin.c_str());
}
if ( N == 0 || N > 15 || M > N )
{

10
src/wallet/rpcwallet.cpp

@ -6349,7 +6349,7 @@ UniValue gatewaysbind(const UniValue& params, bool fHelp)
UniValue result(UniValue::VOBJ); uint256 tokenid,oracletxid; int32_t i; int64_t totalsupply; std::vector<CPubKey> pubkeys;
uint8_t M,N,p1,p2,p3,p4=0; std::string hex,coin; std::vector<unsigned char> pubkey;
if ( fHelp || params.size() < 9 )
if ( fHelp || params.size() < 10 )
throw runtime_error("gatewaysbind tokenid oracletxid coin tokensupply M N pubkey(s) pubtype p2shtype wiftype [taddr]\n");
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
@ -6363,10 +6363,10 @@ UniValue gatewaysbind(const UniValue& params, bool fHelp)
N = atoi((char *)params[5].get_str().c_str());
if ( M > N || N == 0 || N > 15 || totalsupply < COIN/100 || tokenid == zeroid )
throw runtime_error("illegal M or N > 15 or tokensupply or invalid tokenid\n");
if ( params.size() < 6+N+3 )
throw runtime_error("not enough parameters for N pubkeys\n");
for (i=0; i<N; i++)
{
if ( params.size() < 6+i+1 )
throw runtime_error("not enough parameters for N pubkeys\n");
{
pubkey = ParseHex(params[6+i].get_str().c_str());
if (pubkey.size()!= 33)
throw runtime_error("invalid destination pubkey");
@ -6375,7 +6375,7 @@ UniValue gatewaysbind(const UniValue& params, bool fHelp)
p1 = atoi((char *)params[6+N].get_str().c_str());
p2 = atoi((char *)params[6+N+1].get_str().c_str());
p3 = atoi((char *)params[6+N+2].get_str().c_str());
if (params.size() == 9+N) p4 = atoi((char *)params[6+N+3].get_str().c_str());
if (params.size() == 9+N+1) p4 = atoi((char *)params[9+N].get_str().c_str());
hex = GatewaysBind(0,coin,tokenid,totalsupply,oracletxid,M,N,pubkeys,p1,p2,p3,p4);
RETURN_IF_ERROR(CCerror);
if ( hex.size() > 0 )

Loading…
Cancel
Save