Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
347c4a4311
  1. 2
      iguana/iguana_realtime.c
  2. 28
      iguana/iguana_recv.c
  3. 4
      iguana/tests/rawtx3

2
iguana/iguana_realtime.c

@ -168,7 +168,7 @@ void iguana_RTcoinaddr(struct iguana_info *coin,struct iguana_RTtxid *RTptr,stru
//RTaddr->unspents[i] = RTaddr->unspents[--RTaddr->numunspents];
}
}
printf("%s %.8f [%.8f - %.8f] -> %.8f\n",coinaddr,dstr(value),dstr(coin->RTcredits),dstr(coin->RTdebits),dstr(coin->histbalance)+dstr(coin->RTcredits)-dstr(coin->RTdebits));
//printf("%s %.8f [%.8f - %.8f] -> %.8f\n",coinaddr,dstr(value),dstr(coin->RTcredits),dstr(coin->RTdebits),dstr(coin->histbalance)+dstr(coin->RTcredits)-dstr(coin->RTdebits));
if ( 0 && strcmp("BTC",coin->symbol) != 0 && strcmp("LTC",coin->symbol) != 0 && strcmp("DOGE",coin->symbol) != 0 )
printf("%lld %s %.8f h %.8f, cr %.8f deb %.8f [%.8f] numunspents.%d %p\n",(long long)polarity,coinaddr,dstr(value),dstr(RTaddr->histbalance),dstr(RTaddr->credits),dstr(RTaddr->debits),dstr(RTaddr->credits)-dstr(RTaddr->debits)+dstr(RTaddr->histbalance),RTaddr->numunspents,unspent);
}

28
iguana/iguana_recv.c

@ -1121,7 +1121,7 @@ void iguana_hwmchain_set(struct iguana_info *coin,struct iguana_block *block,int
}
}
void iguana_mainchain_clear(struct iguana_info *coin,struct iguana_block *mainchain,struct iguana_block *oldhwm,int32_t n)
void iguana_mainchain_clear(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_block *mainchain,struct iguana_block *oldhwm,int32_t n)
{
int32_t i,height; char str[65]; struct iguana_block *tmp = oldhwm;
if ( mainchain != oldhwm )
@ -1139,13 +1139,12 @@ void iguana_mainchain_clear(struct iguana_info *coin,struct iguana_block *mainch
tmp->mainchain = 0;
printf("CLEAR %s mainchain.%d %s\n",coin->symbol,height,str);
}
//if ( coin->RTheight > height )
// iguana_RTreset(coin);
if ( (tmp= iguana_blockfind("clear",coin,tmp->RO.prev_block)) == 0 )
{
printf("iguana_mainchain_clear: got null tmp i.%d of %d %s\n",i,n,str);
return;
}
iguana_RTnewblock(myinfo,coin,tmp);
}
if ( tmp != mainchain && coin->RTheight > 0 )
printf("iguana_mainchain_clear: unexpected mismatch ht.%d vs %d %s\n",tmp->height,mainchain->height,bits256_str(str,tmp->RO.hash2));
@ -1178,7 +1177,7 @@ int32_t iguana_height_estimate(struct iguana_info *coin,struct iguana_block **ma
// main context, ie single threaded
struct iguana_bundle *iguana_bundleset(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_block **blockp,int32_t *bundleip,struct iguana_block *origblock)
{
struct iguana_block *block,*prevblock,*tmp,*mainchain,*hwmblock; bits256 zero,hash2,prevhash2; struct iguana_bundle *prevbp,*bp = 0; int32_t i,newheight,prevbundlei,bundlei = -2; // struct iguana_ramchain blockR;
struct iguana_block *block,*prevblock,*tmp,*mainchain,*hwmblock; bits256 zero,hash2,prevhash2; struct iguana_bundle *prevbp,*bp = 0; int32_t i,n,hdrsi,newheight,prevbundlei,bundlei = -2; // struct iguana_ramchain blockR;
*bundleip = -2; *blockp = 0;
if ( origblock == 0 )
return(0);
@ -1197,17 +1196,26 @@ struct iguana_bundle *iguana_bundleset(struct supernet_info *myinfo,struct iguan
{
if ( (newheight= iguana_height_estimate(coin,&mainchain,block)) >= coin->blocks.hwmchain.height )
{
iguana_mainchain_clear(coin,mainchain,hwmblock,coin->blocks.hwmchain.height-mainchain->height);
tmp = block;
for (i=0; i<newheight-mainchain->height; i++)
iguana_mainchain_clear(myinfo,coin,mainchain,hwmblock,coin->blocks.hwmchain.height-mainchain->height);
n = (newheight - mainchain->height);
for (i=1; i<n; i++)
{
iguana_bundle_set(coin,tmp,newheight-i);
if ( (tmp= iguana_blockfind("hwmprev",coin,tmp->RO.prev_block)) == 0 )
break;
hdrsi = ((mainchain->height+i) / coin->chain->bundlesize);
bundlei = ((mainchain->height+i) % coin->chain->bundlesize);
if ( hdrsi < coin->bundlescount && (bp= coin->bundles[hdrsi]) != 0 )
{
if ( (tmp= bp->blocks[hdrsi]) != 0 )
{
iguana_bundle_set(coin,tmp,mainchain->height+i);
iguana_RTnewblock(myinfo,coin,tmp);
}
}
}
if ( mainchain != hwmblock )
{
iguana_hwmchain_set(coin,mainchain,mainchain->height); // trigger reprocess
iguana_RTnewblock(myinfo,coin,mainchain);
}
}
else if ( coin->RTheight > 0 && newheight == coin->RTheight )
{

4
iguana/tests/rawtx3

@ -1,3 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTC\",\"agent\":\"basilisk\",\"method\":\"rawtx\",\"vals\":{\"changeaddr\":\"1GQHQ7vwVpGeir2kKrYATsLtrkUQSc7FGY\",\"addresses\":[\"16jsjc1YvzDXqKf7PorMhTyK8ym3ra3uxm\", \"1GQHQ7vwVpGeir2kKrYATsLtrkUQSc7FGY\"],\"timeout\":15000,\"satoshis\":\"20000\",\"spendscript\":\"76a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac\"}}"
#{"coin":"BTC","spendscript":"76a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac","changeaddr":"1GQHQ7vwVpGeir2kKrYATsLtrkUQSc7FGY","satoshis":"331","txfee":"10000","minconf":1,"locktime":0,"timeout":30000,"burn":0.00010000,"addresses":["16jsjc1YvzDXqKf7PorMhTyK8ym3ra3uxm", "1GQHQ7vwVpGeir2kKrYATsLtrkUQSc7FGY"]}
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTC\",\"agent\":\"basilisk\",\"method\":\"rawtx\",\"vals\":{\"changeaddr\":\"1FNhoaBYzf7safMBjoCsJYgxtah3K95sep\",\"addresses\":[\"1Hgzt5xsnbfc8UTWqWKSTLRm5bEYHYBoCE\"],\"timeout\":15000,\"satoshis\":\"20000\",\"spendscript\":\"76a914b7128d2ee837cf03e30a2c0e3e0181f7b9669bb688ac\"}}"

Loading…
Cancel
Save