From c1104e4bc9c0734854ad5779ac8cbd1a52557418 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 28 May 2016 22:00:00 -0500 Subject: [PATCH] test --- basilisk/basilisk_bitcoin.c | 20 +++++++++++--------- iguana/tests/rawtx | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index e0b313d50..4c454668b 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -39,7 +39,7 @@ int64_t bitcoin_value(struct iguana_info *coin,bits256 txid,int16_t vout,char *c { if ( strcmp(jstri(addrs,j),coinaddr) == 0 ) { - value = SATOSHIDEN * jdouble(item,"amount"); + value = SATOSHIDEN * jdouble(item,"satoshis"); break; } } @@ -74,7 +74,7 @@ char *bitcoin_balance(struct iguana_info *coin,char *coinaddr,int32_t lastheight if ( (n= cJSON_GetArraySize(array)) > 0 ) { for (i=0; icoinaddr,jstr(resultarg,"address"),sizeof(v->coinaddr)); - v->value = j64bits(resultarg,"value"); + v->value = j64bits(resultarg,"satoshis"); v->txid = jbits256(resultarg,"txid"); v->vout = jint(resultarg,"vout"); v->height = jint(resultarg,"height"); @@ -432,7 +432,7 @@ void *basilisk_bitcoinvalue(struct basilisk_item *Lptr,struct supernet_info *myi } } //printf("bitcoinvalue issue remote\n"); - return(basilisk_issueremote(myinfo,"value",coin->symbol,valsobj,timeoutmillis,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,coin->basilisk_valuemetric)); + return(basilisk_issueremote(myinfo,"satoshis",coin->symbol,valsobj,timeoutmillis,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,coin->basilisk_valuemetric)); } double basilisk_bitcoin_rawtxmetric_dependents(struct supernet_info *myinfo,struct iguana_info *coin,struct basilisk_item *ptr,struct bitcoin_rawtxdependents *dependents) @@ -470,11 +470,13 @@ double basilisk_bitcoin_rawtxmetric_dependents(struct supernet_info *myinfo,stru addresses = jarray(&numaddrs,ptr->vals,"addresses"); for (inputsum=i=0; inumptrs; i++) { - if ( (child= dependents->ptrs[i]) != 0 && (childstr= child->retstr) != 0 && (coinaddr= &dependents->coinaddrs[64*i]) != 0 ) + if ( (child= dependents->ptrs[i]) != 0 && (childstr= child->retstr) != 0 ) { + printf("child.(%s)\n",childstr); + coinaddr = &dependents->coinaddrs[64*i]; if ( (childjson= cJSON_Parse(childstr)) != 0 ) { - if ( (value= j64bits(childjson,"value")) != 0 ) + if ( (value= j64bits(childjson,"satoshis")) != 0 ) { inputsum += value; for (j=0; jvals,"changeaddr"); locktime = juint(ptr->vals,"locktime"); - amount = j64bits(ptr->vals,"amount"); + amount = j64bits(ptr->vals,"satoshis"); addresses = jarray(&numaddrs,ptr->vals,"addresses"); if ( (txobj= bitcoin_hex2json(coin,&txid,&msgtx,rawtx,extraspace,sizeof(extraspace),serialized)) != 0 ) { @@ -637,7 +639,7 @@ void *basilisk_bitcoinrawtx(struct basilisk_item *Lptr,struct supernet_info *myi vins = 0; changeaddr = jstr(valsobj,"changeaddr"); spendscriptstr = jstr(valsobj,"spendscript"); - amount = j64bits(valsobj,"amount"); + amount = j64bits(valsobj,"satoshis"); if ( (txfee= j64bits(valsobj,"txfee")) == 0 ) txfee = coin->chain->txfee; if ( txfee == 0 ) diff --git a/iguana/tests/rawtx b/iguana/tests/rawtx index 2a93782c6..c847a226a 100755 --- a/iguana/tests/rawtx +++ b/iguana/tests/rawtx @@ -1 +1 @@ -curl --url "http://127.0.0.1:7778" --data "{\"activecoin\":\"BTC\",\"agent\":\"basilisk\",\"method\":\"rawtx\",\"vals\":{\"changeaddr\":\"1FNhoaBYzf7safMBjoCsJYgxtah3K95sep\",\"addresses\":[\"1Hgzt5xsnbfc8UTWqWKSTLRm5bEYHYBoCE\"],\"timeout\":15000,\"amount\":\"20000\",\"spendscript\":\"76a914b7128d2ee837cf03e30a2c0e3e0181f7b9669bb688ac\"}}" +curl --url "http://127.0.0.1:7778" --data "{\"activecoin\":\"BTC\",\"agent\":\"basilisk\",\"method\":\"rawtx\",\"vals\":{\"changeaddr\":\"1FNhoaBYzf7safMBjoCsJYgxtah3K95sep\",\"addresses\":[\"1Hgzt5xsnbfc8UTWqWKSTLRm5bEYHYBoCE\"],\"timeout\":15000,\"satoshis\":\"20000\",\"spendscript\":\"76a914b7128d2ee837cf03e30a2c0e3e0181f7b9669bb688ac\"}}"