Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
99d1724670
  1. 2
      iguana/iguana_ramchain.c
  2. 30
      iguana/ramchain_api.c
  3. 3
      includes/iguana_apideclares.h

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

30
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; i<IGUANA_NUMLHASHES; i++)
jaddinum(array,rdata->lhashes[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"

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

Loading…
Cancel
Save