From fcc956f79b6fa9b8de6dac4d649e36c195d442be Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 4 Mar 2017 02:18:40 +0200 Subject: [PATCH] Test --- basilisk/jumblr.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/basilisk/jumblr.c b/basilisk/jumblr.c index b3f0dc3ca..b40be9279 100755 --- a/basilisk/jumblr.c +++ b/basilisk/jumblr.c @@ -127,11 +127,11 @@ char *jumblr_zgetbalance(struct supernet_info *myinfo,struct iguana_info *coin,c return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"z_getbalance",params)); } -char *jumblr_getbalance(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) +char *jumblr_listunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) { char params[1024]; - sprintf(params,"[\"%s\", 3]",addr); - return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getreceivedbyaddress",params)); + sprintf(params,"[3, 99999999, \"%s\"]",addr); + return(bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"listunspent",params)); } int64_t jumblr_receivedby(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) @@ -160,13 +160,18 @@ int64_t jumblr_receivedby(struct supernet_info *myinfo,struct iguana_info *coin, int64_t jumblr_balance(struct supernet_info *myinfo,struct iguana_info *coin,char *addr) { - char *retstr; double val; int64_t balance = 0; + char *retstr; double val; cJSON *retjson; int32_t i,n; int64_t balance = 0; if ( strlen(addr) < 40 ) { - if ( (retstr= jumblr_getbalance(myinfo,coin,addr)) != 0 ) + if ( (retstr= jumblr_listunspent(myinfo,coin,addr)) != 0 ) { - if ( (val= atof(retstr)) > SMALLVAL ) - balance = val * SATOSHIDEN; + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (n= cJSON_GetArraySize(retjson)) > 0 ) + for (i=0; ijumblrs,ptr,tmp) { if ( strlen(ptr->src) >= 40 )