Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
9ecd45a471
  1. 2
      basilisk/basilisk_bitcoin.c
  2. 26
      iguana/iguana_wallet.c
  3. 2
      includes/iguana_funcs.h

2
basilisk/basilisk_bitcoin.c

@ -312,7 +312,7 @@ void *basilisk_bitcoinbalances(struct basilisk_item *Lptr,struct supernet_info *
{
for (i=0; i<n; i++)
{
balance = iguana_addressreceived(myinfo,coin,vals,remoteaddr,0,0,unspents,spends,jstri(addresses,i),juint(vals,"minconf"));
balance = iguana_addressreceived(myinfo,coin,vals,remoteaddr,0,0,unspents,spends,jstri(addresses,i),juint(vals,"minconf"),juint(vals,"firstheight"));
item = cJSON_CreateObject();
jaddnum(item,jstri(addresses,i),dstr(balance));
jaddi(array,item);

26
iguana/iguana_wallet.c

@ -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);

2
includes/iguana_funcs.h

@ -413,7 +413,7 @@ int32_t iguana_voutscript(struct iguana_info *coin,struct iguana_bundle *bp,uint
cJSON *iguana_unspentjson(struct supernet_info *myinfo,struct iguana_info *coin,int32_t hdrsi,uint32_t unspentind,struct iguana_txid *T,struct iguana_unspent *up,uint8_t rmd160[20],char *coinaddr,uint8_t *pubkey33,int32_t spentheight,char *remoteaddr);
int32_t bitcoin_standardspend(uint8_t *script,int32_t n,uint8_t rmd160[20]);
struct iguana_waddress *iguana_waddresssearch(struct supernet_info *myinfo,struct iguana_waccount **wacctp,char *coinaddr);
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);
cJSON *iguana_walletjson(struct supernet_info *myinfo);
int32_t iguana_payloadupdate(struct supernet_info *myinfo,struct iguana_info *coin,char *retstr,struct iguana_waddress *waddr,char *account);
int32_t bitcoin_MofNspendscript(uint8_t p2sh_rmd160[20],uint8_t *script,int32_t n,const struct vin_info *vp);

Loading…
Cancel
Save