diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 8eb8682b5..6058690ae 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -23,7 +23,7 @@ int32_t iguana_unspentind2txid(struct supernet_info *myinfo,struct iguana_info *coin,int32_t *spentheightp,bits256 *txidp,int32_t *voutp,int16_t hdrsi,uint32_t unspentind) { - struct iguana_ramchaindata *rdata=0; struct iguana_bundle *bp=0; struct iguana_unspent *U,*u; struct iguana_txid *T,*t; + /*struct iguana_ramchaindata *rdata=0; struct iguana_bundle *bp=0; struct iguana_unspent *U,*u; struct iguana_txid *T,*t; *voutp = *spentheightp = -1; memset(txidp,0,sizeof(*txidp)); if ( hdrsi < coin->bundlescount-1 ) @@ -50,7 +50,49 @@ int32_t iguana_unspentind2txid(struct supernet_info *myinfo,struct iguana_info * rdata = bp->ramchain.H.data; else break; } - return(-1); + return(-1);*/ + //{"txid":"e34686afc17ec37a8438f0c9a7e48f98d0c625c7917a59c2d7fa22b53d570115","vout":1,"address":"16jsjc1YvzDXqKf7PorMhTyK8ym3ra3uxm","scriptPubKey":"76a9143ef4734c1141725c095342095f6e0e7748b6c16588ac","amount":0.01000000,"timestamp":0,"height":419261,"confirmations":1729,"checkind":4497018,"account":"default","spendable":true,"spent":{"hdrsi":209,"pkind":2459804,"unspentind":4497018,"prevunspentind":0,"satoshis":"1000000","txidind":1726947,"vout":1,"type":2,"fileid":0,"scriptpos":0,"scriptlen":25},"spentheight":419713,"dest":{"spentfrom":"22651e62f248fe2e72053d650f177e4b246ee016605102a40419e603b2bbeac8","vin":0,"timestamp":0,"vouts":[{"1KRhTPvoxyJmVALwHFXZdeeWFbcJSbkFPu":0.00010000}, {"1GQHQ7vwVpGeir2kKrYATsLtrkUQSc7FGY":0.00980000}],"total":0.00990000,"ratio":1}} + cJSON *retarray,*item,*uitem,*sitem; char *retstr; int32_t i,n,retval = -1; + *voutp = *spentheightp = -1; + memset(txidp,0,sizeof(*txidp)); + if ( (retstr= bitcoinrpc_listunspent(myinfo,coin,0,0,0,0,0)) != 0 ) + { + if ( (retarray= cJSON_Parse(retstr)) != 0 ) + { + if ( (n= cJSON_GetArraySize(retarray)) > 0 ) + { + for (i=0; i