From 4fe7cd2452a434359632851ebd0c34dc75d0f486 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 27 May 2016 22:14:16 -0500 Subject: [PATCH] test --- basilisk/basilisk_bitcoin.c | 9 ++++++--- iguana/iguana_payments.c | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index 4a62ea750..d6cd3f6f0 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -312,6 +312,7 @@ int32_t basilisk_bitcoinavail(struct iguana_info *coin) char *basilisk_bitcoinbalances(struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,uint32_t basilisktag,int32_t timeoutmillis,cJSON **argsp,cJSON *vals) { + *argsp = 0; /* cJSON *array=0,*result,*item,*retjson,*hexjson; int32_t i,n,besti=-1; char *coinaddr,*balancestr=0,*retstr=0; int64_t total=0,amount,most=0; struct basilisk_item *ptr; array = cJSON_CreateArray(); if ( coin != 0 && basilisk_bitcoinavail(coin) != 0 ) @@ -554,10 +555,12 @@ int64_t basilisk_bitcointxcost(struct supernet_info *myinfo,struct iguana_info * char *basilisk_bitcoinrawtx(struct supernet_info *myinfo,struct iguana_info *coin,char *remoteaddr,uint32_t basilisktag,int32_t timeoutmillis,cJSON **vinsp,cJSON *valsobj) { uint8_t buf[IGUANA_MAXSCRIPTSIZE]; int32_t i,minconf,spendlen,besti=-1; cJSON *hexjson,*addresses,*txobj = 0; uint32_t locktime; char *spendscriptstr,*changeaddr,*retstr=0,*rawtx = 0; int64_t amount,txfee,cost,bestcost=-1; struct basilisk_item *ptr; + *vinsp = 0; changeaddr = jstr(valsobj,"changeaddr"); spendscriptstr = jstr(valsobj,"spendscript"); amount = j64bits(valsobj,"amount"); - txfee = j64bits(valsobj,"txfee"); + if ( (txfee= j64bits(valsobj,"txfee")) == 0 ) + txfee = coin->chain->txfee; minconf = juint(valsobj,"minconf"); locktime = juint(valsobj,"locktime"); addresses = jobj(valsobj,"addresses"); @@ -569,14 +572,14 @@ char *basilisk_bitcoinrawtx(struct supernet_info *myinfo,struct iguana_info *coi { if ( coin->VALIDATENODE != 0 || coin->RELAYNODE != 0 ) { - if ( txfee == 0 ) - txfee = coin->chain->txfee; if ( (txobj= bitcoin_txcreate(coin,locktime)) != 0 ) { spendlen = (int32_t)strlen(spendscriptstr) >> 1; decode_hex(buf,spendlen,spendscriptstr); bitcoin_txoutput(coin,txobj,buf,spendlen,amount); + printf("call calcrawtx\n"); rawtx = iguana_calcrawtx(myinfo,coin,vinsp,txobj,amount,changeaddr,txfee,addresses,minconf); + printf("back calcrawtx\n"); } else printf("error creating txobj\n"); } //else rawtx = bitcoin_calcrawtx(myinfo,coin,vinsp,satoshis,spendscriptstr,changeaddr,txfee,addresses,minconf,locktime); if ( rawtx != 0 ) diff --git a/iguana/iguana_payments.c b/iguana/iguana_payments.c index e7bfa6363..cf8f16e0b 100755 --- a/iguana/iguana_payments.c +++ b/iguana/iguana_payments.c @@ -321,11 +321,13 @@ char *iguana_calcrawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJS *vinsp = 0; max = 10000; unspents = calloc(max,sizeof(*unspents)); + printf("unspentslist\n"); if ( (num= iguana_unspentslists(myinfo,coin,&avail,unspents,max,satoshis,minconf,addresses)) <= 0 ) { free(unspents); return(0); } + printf("got num.%d\n",num); if ( txobj != 0 && avail >= satoshis+txfee ) { if ( (vins= iguana_inputsjson(myinfo,coin,&total,satoshis + txfee,unspents,num)) != 0 )