|
|
@ -864,12 +864,11 @@ cJSON *iguana_privkeysjson(struct supernet_info *myinfo,struct iguana_info *coin |
|
|
|
#include "../includes/iguana_apidefs.h" |
|
|
|
#include "../includes/iguana_apideclares.h" |
|
|
|
|
|
|
|
int64_t iguana_addressreceived(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *json,char *remoteaddr,cJSON *txids,cJSON *vouts,cJSON *unspents,cJSON *spends,char *coinaddr,int32_t minconf) |
|
|
|
int64_t iguana_addressreceived(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *json,char *remoteaddr,cJSON *txids,cJSON *vouts,cJSON *unspents,cJSON *spends,char *coinaddr,int32_t minconf,int32_t firstheight) |
|
|
|
{ |
|
|
|
int64_t balance = 0; cJSON *unspentsjson,*balancejson,*item; int32_t i,n; char *balancestr; |
|
|
|
if ( (balancestr= iguana_balance(IGUANA_CALLARGS,coin->symbol,coinaddr,-1,minconf)) != 0 ) |
|
|
|
{ |
|
|
|
printf("remoteaddr.%p (%s)\n",remoteaddr,remoteaddr!=0?remoteaddr:0); |
|
|
|
//printf("balancestr.(%s) (%s)\n",balancestr,coinaddr);
|
|
|
|
if ( (balancejson= cJSON_Parse(balancestr)) != 0 ) |
|
|
|
{ |
|
|
@ -879,14 +878,17 @@ int64_t iguana_addressreceived(struct supernet_info *myinfo,struct iguana_info * |
|
|
|
for (i=0; i<n; i++) |
|
|
|
{ |
|
|
|
item = jitem(unspentsjson,i); |
|
|
|
if ( txids != 0 ) |
|
|
|
jaddibits256(txids,jbits256(item,"txid")); |
|
|
|
if ( vouts != 0 ) |
|
|
|
jaddinum(vouts,jint(item,"vout")); |
|
|
|
if ( unspents != 0 && jobj(item,"unspent") != 0 ) |
|
|
|
jaddi(unspents,jduplicate(item)); |
|
|
|
if ( spends != 0 && jobj(item,"spent") != 0 ) |
|
|
|
jaddi(spends,jduplicate(item)); |
|
|
|
if ( juint(item,"height") >= firstheight ) |
|
|
|
{ |
|
|
|
if ( txids != 0 ) |
|
|
|
jaddibits256(txids,jbits256(item,"txid")); |
|
|
|
if ( vouts != 0 ) |
|
|
|
jaddinum(vouts,jint(item,"vout")); |
|
|
|
if ( unspents != 0 && jobj(item,"unspent") != 0 ) |
|
|
|
jaddi(unspents,jduplicate(item)); |
|
|
|
if ( spends != 0 && jobj(item,"spent") != 0 ) |
|
|
|
jaddi(spends,jduplicate(item)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
free_json(balancejson); |
|
|
@ -1417,7 +1419,7 @@ STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatch |
|
|
|
{ |
|
|
|
vouts = cJSON_CreateArray(); |
|
|
|
txids = cJSON_CreateArray(); |
|
|
|
iguana_addressreceived(myinfo,coin,0,remoteaddr,txids,vouts,0,0,coinaddr,1); |
|
|
|
iguana_addressreceived(myinfo,coin,0,remoteaddr,txids,vouts,0,0,coinaddr,1,0); |
|
|
|
if ( (m= cJSON_GetArraySize(txids)) > 0 ) |
|
|
|
{ |
|
|
|
for (j=0; j<m; j++,total++) |
|
|
@ -1502,7 +1504,7 @@ THREE_INTS(bitcoinrpc,listreceivedbyaddress,minconf,includeempty,flag) |
|
|
|
jaddstr(item,"address",coinaddr); |
|
|
|
txids = cJSON_CreateArray(); |
|
|
|
vouts = cJSON_CreateArray(); |
|
|
|
jaddnum(item,"amount",dstr(iguana_addressreceived(myinfo,coin,0,remoteaddr,txids,vouts,0,0,coinaddr,minconf))); |
|
|
|
jaddnum(item,"amount",dstr(iguana_addressreceived(myinfo,coin,0,remoteaddr,txids,vouts,0,0,coinaddr,minconf,0))); |
|
|
|
jadd(item,"txids",txids); |
|
|
|
jadd(item,"vouts",vouts); |
|
|
|
jaddi(array,item); |
|
|
|