Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
1e01b81f13
  1. 12
      iguana/iguana_wallet.c
  2. 2
      iguana/tests/importprivkeyB
  3. 1
      iguana/tests/listreceivedbyaddress

12
iguana/iguana_wallet.c

@ -1458,21 +1458,23 @@ THREE_INTS(bitcoinrpc,listreceivedbyaccount,minconf,includeempty,watchonly)
THREE_INTS(bitcoinrpc,listreceivedbyaddress,minconf,includeempty,flag) THREE_INTS(bitcoinrpc,listreceivedbyaddress,minconf,includeempty,flag)
{ {
cJSON *retjson,*item,*array,*txids,*vouts; struct iguana_waccount *wacct,*tmp; struct iguana_waddress *waddr,*tmp2; cJSON *retjson,*item,*array,*txids,*vouts; struct iguana_waccount *wacct,*tmp; struct iguana_waddress *waddr,*tmp2; uint8_t addrtype; char coinaddr[64];
if ( remoteaddr != 0 ) if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}")); return(clonestr("{\"error\":\"no remote\"}"));
//if ( myinfo->expiration == 0 ) if ( myinfo->expiration == 0 )
// return(clonestr("{\"error\":\"need to unlock wallet\"}")); return(clonestr("{\"error\":\"need to unlock wallet\"}"));
array = cJSON_CreateArray(); array = cJSON_CreateArray();
HASH_ITER(hh,myinfo->wallet,wacct,tmp) HASH_ITER(hh,myinfo->wallet,wacct,tmp)
{ {
HASH_ITER(hh,wacct->waddr,waddr,tmp2) HASH_ITER(hh,wacct->waddr,waddr,tmp2)
{ {
item = cJSON_CreateObject(); item = cJSON_CreateObject();
jaddstr(item,"address",waddr->coinaddr); addrtype = (waddr->scriptlen > 0) ? coin->chain->p2shtype : coin->chain->pubtype;
bitcoin_address(coinaddr,addrtype,waddr->rmd160,20);
jaddstr(item,"address",coinaddr);
txids = cJSON_CreateArray(); txids = cJSON_CreateArray();
vouts = cJSON_CreateArray(); vouts = cJSON_CreateArray();
jaddnum(item,"amount",dstr(iguana_addressreceived(myinfo,coin,0,remoteaddr,txids,vouts,waddr->coinaddr,minconf))); jaddnum(item,"amount",dstr(iguana_addressreceived(myinfo,coin,0,remoteaddr,txids,vouts,coinaddr,minconf)));
jadd(item,"txids",txids); jadd(item,"txids",txids);
jadd(item,"vouts",vouts); jadd(item,"vouts",vouts);
jaddi(array,item); jaddi(array,item);

2
iguana/tests/importprivkeyB

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"importprivkey\",\"params\":[\"b81e824a58cefff953eb53e9743059d001be0f5cfeb7599fbdd6bd18dba6616c\"]}" curl --url "http://127.0.0.1:7778" --data "{\"method\":\"importprivkey\",\"params\":[\"Kzw1ordPLaxDqgn2Uz8UyjszcjyPsSM8a16CpHQ4DJF2DiVtFSX1\"]}"

1
iguana/tests/listreceivedbyaddress

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTC\",\"method\":\"listreceivedbyaddress\",\"params\":[]}"
Loading…
Cancel
Save