diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index a1bc211a0..0564c3734 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -2179,7 +2179,7 @@ int32_t iguana_ramchain_expandedsave(struct iguana_info *coin,RAMCHAIN_FUNC,stru retval = 0; } } - printf("%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %llx ht.%d bundlehashes.%s\n",mapchain->H.data->lhashes[0].uints[0],mapchain->H.data->lhashes[1].uints[0],mapchain->H.data->lhashes[2].uints[0],mapchain->H.data->lhashes[3].uints[0],mapchain->H.data->lhashes[4].uints[0],mapchain->H.data->lhashes[5].uints[0],mapchain->H.data->lhashes[6].uints[0],mapchain->H.data->lhashes[7].uints[0],mapchain->H.data->lhashes[8].uints[0],mapchain->H.data->lhashes[9].uints[0],(long long)mapchain->H.data->sha256.txid,mapchain->height,coin->symbol); + //printf("%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %llx ht.%d bundlehashes.%s\n",mapchain->H.data->lhashes[0].uints[0],mapchain->H.data->lhashes[1].uints[0],mapchain->H.data->lhashes[2].uints[0],mapchain->H.data->lhashes[3].uints[0],mapchain->H.data->lhashes[4].uints[0],mapchain->H.data->lhashes[5].uints[0],mapchain->H.data->lhashes[6].uints[0],mapchain->H.data->lhashes[7].uints[0],mapchain->H.data->lhashes[8].uints[0],mapchain->H.data->lhashes[9].uints[0],(long long)mapchain->H.data->sha256.txid,mapchain->height,coin->symbol); iguana_ramchain_free(coin,mapchain,cmpflag); } iguana_mempurge(hashmem); diff --git a/iguana/ramchain_api.c b/iguana/ramchain_api.c index db3256b1a..d19b5c296 100755 --- a/iguana/ramchain_api.c +++ b/iguana/ramchain_api.c @@ -336,13 +336,37 @@ HASH_AND_STRING(bitcoinrpc,verifytx,txid,txbytes) return(jprint(retjson,1)); } -STRING_AND_INT(iguana,bundleaddresses,base,height) +STRING_AND_INT(iguana,bundleaddresses,activecoin,height) { struct iguana_info *ptr; - if ( (ptr= iguana_coinfind(base)) != 0 ) + if ( (ptr= iguana_coinfind(activecoin)) != 0 ) return(iguana_bundleaddrs(ptr,height / coin->chain->bundlesize)); - else return(clonestr("{\"error\":\"base is not active\"}")); + else return(clonestr("{\"error\":\"activecoin is not active\"}")); } + +STRING_AND_INT(iguana,bundlehashes,activecoin,height) +{ + struct iguana_info *ptr; struct iguana_bundle *bp; int32_t i,hdrsi; cJSON *retjson,*array; struct iguana_ramchaindata *rdata; + if ( (ptr= iguana_coinfind(activecoin)) != 0 ) + { + hdrsi = height / coin->chain->bundlesize; + if ( hdrsi < coin->bundlescount && hdrsi >= 0 && (bp= coin->bundles[hdrsi]) != 0 ) + { + if ( (rdata= bp->ramchain.H.data) != 0 ) + { + array = cJSON_CreateArray(); + for (i=0; ilhashes[i].txid); + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jaddbits256(retjson,"sha256",rdata->sha256); + jadd(retjson,"bundlehashes",array); + return(jprint(retjson,1)); + } else return(clonestr("{\"error\":\"ramchain not there\"}")); + } else return(clonestr("{\"error\":\"height is too big\"}")); + } else return(clonestr("{\"error\":\"activecoin is not active\"}")); +} + #undef IGUANA_ARGS #include "../includes/iguana_apiundefs.h" diff --git a/includes/iguana_apideclares.h b/includes/iguana_apideclares.h index d77e7f0fd..1f9899d34 100755 --- a/includes/iguana_apideclares.h +++ b/includes/iguana_apideclares.h @@ -23,7 +23,8 @@ P2SH_SPENDAPI(iguana,spendmsig,activecoin,vintxid,vinvout,destaddress,destamount /*TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,BTCoffer,othercoin,otherassetid,maxprice,othervolume); STRING_AND_TWO_DOUBLES(InstantDEX,ALToffer,basecoin,minprice,basevolume); STRING_AND_TWO_DOUBLES(InstantDEX,NXToffer,assetid,minprice,basevolume);*/ -STRING_AND_INT(iguana,bundleaddresses,base,height); +STRING_AND_INT(iguana,bundleaddresses,activecoin,height); +STRING_AND_INT(iguana,bundlehashes,activecoin,height); HASH_AND_STRING(bitcoinrpc,verifytx,txid,txbytes); INT_ARG(bitcoinrpc,getblockhash,height);