diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 3b1a1845d..c99807b8d 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -377,193 +377,6 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 return(typestr); } -#ifdef pollmethod -void komodo_gateway_voutupdate(char *symbol,int32_t isspecial,int32_t height,int32_t txi,bits256 txid,int32_t vout,int32_t numvouts,uint64_t value,uint8_t *script,int32_t len) -{ - int32_t i,opretlen,offset = 0; uint256 zero,utxid; const char *typestr; - typestr = "unknown"; - memcpy(&utxid,&txid,sizeof(utxid)); - if ( script[offset++] == 0x6a ) - { - offset += komodo_scriptitemlen(&opretlen,&script[offset]); - if ( isspecial != 0 && len >= offset+32*2+4 && strcmp((char *)&script[offset+32*2+4],ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL) == 0 ) - typestr = "notarized"; - else if ( txi == 0 && vout == 1 && opretlen == 149 ) - { - typestr = "pricefeed"; - komodo_paxpricefeed(height,&script[offset],opretlen); - //printf("height.%d pricefeed len.%d\n",height,opretlen); - } - else komodo_stateupdate(height,0,0,0,utxid,0,0,0,0,0,0,value,&script[offset],opretlen,vout); - } - else if ( numvouts >= KOMODO_MINRATIFY ) - typestr = "ratify"; -} - -int32_t komodo_gateway_tx(char *symbol,int32_t height,int32_t txi,char *txidstr,uint32_t port) -{ - char *retstr,params[256],*hexstr; uint8_t script[10000]; cJSON *oldpub,*newpub,*json,*result,*vouts,*item,*sobj; int32_t vout,n,len,isspecial,retval = -1; uint64_t value; bits256 txid; - sprintf(params,"[\"%s\", 1]",txidstr); - if ( (retstr= komodo_issuemethod((char *)"getrawtransaction",params,port)) != 0 ) - { - if ( (json= cJSON_Parse(retstr)) != 0 ) - { - if ( (result= jobj(json,(char *)"result")) != 0 ) - { - oldpub = jobj(result,(char *)"vpub_old"); - newpub = jobj(result,(char *)"vpub_new"); - retval = 0; - if ( oldpub == 0 && newpub == 0 && (vouts= jarray(&n,result,(char *)"vout")) != 0 ) - { - isspecial = 0; - txid = jbits256(result,(char *)"txid"); - for (vout=0; vout> 1; - if ( vout == 0 && ((memcmp(&hexstr[2],CRYPTO777_PUBSECPSTR,66) == 0 && len == 35) || (memcmp(&hexstr[6],CRYPTO777_RMD160STR,40) == 0 && len == 25)) ) - isspecial = 1; - else if ( len <= sizeof(script) ) - { - decode_hex(script,len,hexstr); - komodo_gateway_voutupdate(symbol,isspecial,height,txi,txid,vout,n,value,script,len); - } - } - } - } - } - } else printf("error getting txids.(%s) %p\n",retstr,result); - free_json(json); - } - free(retstr); - } - return(retval); -} - -int32_t komodo_gateway_block(char *symbol,int32_t height,uint16_t port) -{ - char *retstr,*retstr2,params[128],*txidstr; int32_t i,n,retval = -1; cJSON *json,*tx=0,*result=0,*result2; - sprintf(params,"[%d]",height); - if ( (retstr= komodo_issuemethod((char *)"getblockhash",params,port)) != 0 ) - { - if ( (result= cJSON_Parse(retstr)) != 0 ) - { - if ( (txidstr= jstr(result,(char *)"result")) != 0 && strlen(txidstr) == 64 ) - { - sprintf(params,"[\"%s\"]",txidstr); - if ( (retstr2= komodo_issuemethod((char *)"getblock",params,port)) != 0 ) - { - //printf("getblock.(%s)\n",retstr2); - if ( (json= cJSON_Parse(retstr2)) != 0 ) - { - if ( (result2= jobj(json,(char *)"result")) != 0 && (tx= jarray(&n,result2,(char *)"tx")) != 0 ) - { - for (i=0; i= kmdheight ) - sp->KOMODO_REALTIME = (uint32_t)time(NULL); - } - free_json(infoobj); - } - free(retstr); - } - else - { - printf("error from %s\n",symbol); - sleep(30); - } -} - -void komodo_iteration(char *symbol) -{ - char *retstr,*base,*coinaddr,*txidstr,cmd[512]; uint64_t value,fiatoshis; cJSON *array,*item; int32_t i,n,vout,shortflag,height,fiatheight; uint256 txid; uint8_t rmd160[20],addrtype; - if ( ASSETCHAINS_SYMBOL[0] == 0 ) - { - sprintf(cmd,"{\"agent\":\"dpow\",\"method\":\"pending\",\"fiat\":\"%s\"}",symbol); - if ( (retstr= issue_curl(cmd)) != 0 ) - { - if ( (array= cJSON_Parse(retstr)) != 0 ) - { - if ( (n= cJSON_GetArraySize(array)) > 0 ) - { - for (i=0; i 0 && height > 0 ) - { - fiatoshis = jdouble(item,base) * COIN; - decode_hex((uint8_t *)&txid,sizeof(txid),txidstr); - bitcoin_addr2rmd160(&addrtype,rmd160,coinaddr); - komodo_gateway_deposit(coinaddr,value,shortflag,base,fiatoshis,rmd160,txid,vout,height,fiatheight); - } - } - } - } - //printf("retstr.(%s)\n",retstr); - free(retstr); - } - } -} -#else int32_t komodo_longestchain(); void komodo_passport_iteration() @@ -639,5 +452,4 @@ void komodo_passport_iteration() } refsp->RTmask = RTmask; } -#endif diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index c0ae4f319..fe3b2a854 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -492,7 +492,7 @@ Value paxdeposit(const Array& params, bool fHelp) if (!EnsureWalletIsAvailable(fHelp)) return Value::null; if (fHelp || params.size() != 3) - throw runtime_error("paxdeposit \"address\" [-]fiatoshis \"base\"\nnegative fiatoshis means a short position, long position capped at 100% gain"); + throw runtime_error("paxdeposit \"address\" fiatoshis base"); LOCK2(cs_main, pwalletMain->cs_wallet); CBitcoinAddress address(params[0].get_str()); if (!address.IsValid())