Browse Source

interests field for gettxout and listunspent

etomic
jl777 8 years ago
parent
commit
180c57df42
  1. 4
      iguana/iguana_payments.c
  2. 2
      iguana/iguana_unspents.c
  3. 2
      iguana/tests/listunspent
  4. 1
      includes/iguana_funcs.h

4
iguana/iguana_payments.c

@ -777,9 +777,13 @@ HASH_AND_TWOINTS(bitcoinrpc,gettxout,txid,vout,mempool)
jaddbits256(retjson,"bestblock",coin->blocks.hwmchain.RO.hash2); jaddbits256(retjson,"bestblock",coin->blocks.hwmchain.RO.hash2);
jaddnum(retjson,"bestheight",coin->blocks.hwmchain.height); jaddnum(retjson,"bestheight",coin->blocks.hwmchain.height);
jaddnum(retjson,"height",height); jaddnum(retjson,"height",height);
jaddbits256(retjson,"txid",txid);
jaddnum(retjson,"vout",vout);
jaddnum(retjson,"confirmations",coin->blocks.hwmchain.height - height + 1); jaddnum(retjson,"confirmations",coin->blocks.hwmchain.height - height + 1);
jaddnum(retjson,"value",dstr(value)); jaddnum(retjson,"value",dstr(value));
jaddnum(retjson,"amount",dstr(value)); jaddnum(retjson,"amount",dstr(value));
if ( strcmp(coin->symbol,"KMD") == 0 )
jaddnum(retjson,"interest",dstr(iguana_interest(myinfo,coin,txid,vout,value)));
if ( (height % coin->chain->bundlesize) == 0 && vout == 0 ) if ( (height % coin->chain->bundlesize) == 0 && vout == 0 )
jadd(retjson,"coinbase",jtrue()); jadd(retjson,"coinbase",jtrue());
else jadd(retjson,"coinbase",jfalse()); else jadd(retjson,"coinbase",jfalse());

2
iguana/iguana_unspents.c

@ -305,6 +305,8 @@ cJSON *iguana_RTunspentjson(struct supernet_info *myinfo,struct iguana_info *coi
jaddstr(item,"scriptPubKey",scriptstr); jaddstr(item,"scriptPubKey",scriptstr);
} }
jaddnum(item,"amount",dstr(value)); jaddnum(item,"amount",dstr(value));
if ( strcmp(coin->symbol,"KMD") == 0 )
jaddnum(item,"interest",dstr(iguana_interest(myinfo,coin,txid,vout,value)));
//jaddnum(item,"timestamp",T[up->txidind].timestamp); //jaddnum(item,"timestamp",T[up->txidind].timestamp);
if ( iguana_RTunspentindfind(myinfo,coin,&outpt,0,0,0,0,&height,txid,vout,coin->bundlescount-1,0) == 0 ) if ( iguana_RTunspentindfind(myinfo,coin,&outpt,0,0,0,0,&height,txid,vout,coin->bundlescount-1,0) == 0 )
{ {

2
iguana/tests/listunspent

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"listunspent\",\"params\":[1, 9999999, []]}" curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"KMD\",\"method\":\"listunspent\",\"params\":[1, 9999999, []]}"

1
includes/iguana_funcs.h

@ -434,6 +434,7 @@ cJSON *iguana_RTunspentjson(struct supernet_info *myinfo,struct iguana_info *coi
int32_t bitcoin_standardspend(uint8_t *script,int32_t n,uint8_t rmd160[20]); 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); struct iguana_waddress *iguana_waddresssearch(struct supernet_info *myinfo,struct iguana_waccount **wacctp,char *coinaddr);
cJSON *iguana_RTlistunspent(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *argarray,int32_t minconf,int32_t maxconf,char *remoteaddr,int32_t includespends); cJSON *iguana_RTlistunspent(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *argarray,int32_t minconf,int32_t maxconf,char *remoteaddr,int32_t includespends);
uint64_t iguana_interest(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout,uint64_t value);
void calc_shares(struct supernet_info *myinfo,uint8_t *shares,uint8_t *secret,int32_t size,int32_t width,int32_t M,int32_t N,uint8_t *sharenrs,uint8_t *space,int32_t spacesize); void calc_shares(struct supernet_info *myinfo,uint8_t *shares,uint8_t *secret,int32_t size,int32_t width,int32_t M,int32_t N,uint8_t *sharenrs,uint8_t *space,int32_t spacesize);
//struct basilisk_spend *basilisk_addspend(struct supernet_info *myinfo,char *symbol,bits256 txid,uint16_t vout,int32_t addflag); //struct basilisk_spend *basilisk_addspend(struct supernet_info *myinfo,char *symbol,bits256 txid,uint16_t vout,int32_t addflag);
//void iguana_wallet_Cclear(struct supernet_info *myinfo,char *symbol); //void iguana_wallet_Cclear(struct supernet_info *myinfo,char *symbol);

Loading…
Cancel
Save