Browse Source

test fix for reorg loop off-by-one

release/v0.1
jl777 8 years ago
parent
commit
2151f932a2
  1. 10
      iguana/iguana_realtime.c
  2. 2
      iguana/iguana_recv.c
  3. 2
      iguana/tests/decoderawtransaction

10
iguana/iguana_realtime.c

@ -1001,7 +1001,7 @@ int32_t iguana_RTiterate(struct supernet_info *myinfo,struct iguana_info *coin,i
return(-1);
}
}
printf("%s RTiterate.%lld offset.%d numtx.%d len.%d\n",coin->symbol,(long long)polarity,offset,coin->RTnumtx[offset],coin->RTrecvlens[offset]);
char str[65]; printf("%s RTiterate.%lld offset.%d numtx.%d len.%d %s\n",coin->symbol,(long long)polarity,offset,coin->RTnumtx[offset],coin->RTrecvlens[offset],bits256_str(str,block->RO.hash2));
if ( coin->RTrawmem.ptr == 0 )
iguana_meminit(&coin->RTrawmem,"RTrawmem",0,IGUANA_MAXPACKETSIZE * 2,0);
if ( coin->RTmem.ptr == 0 )
@ -1139,16 +1139,16 @@ void iguana_RTnewblock(struct supernet_info *myinfo,struct iguana_info *coin,str
}
else
{
while ( coin->lastRTheight >= block->height )
char str[65]; printf("reorg RTheight.%d vs block.%d %s\n",coin->RTheight,block->height,bits256_str(str,block->RO.hash2));
while ( coin->RTheight >= block->height )
{
if ( iguana_RTblocksub(myinfo,coin,iguana_RTblock(coin,coin->lastRTheight--)) < 0 )
if ( iguana_RTblocksub(myinfo,coin,iguana_RTblock(coin,coin->RTheight--)) < 0 )
{
coin->RTheight = coin->lastRTheight+1;
coin->lastRTheight = coin->RTheight-1;
portable_mutex_unlock(&coin->RTmutex);
return;
}
}
coin->RTheight = coin->lastRTheight+1;
if ( iguana_RTblockadd(myinfo,coin,block) < 0 )
{
portable_mutex_unlock(&coin->RTmutex);

2
iguana/iguana_recv.c

@ -789,7 +789,7 @@ void iguana_mainchain_clear(struct iguana_info *coin,struct iguana_block *mainch
{
bits256_str(str,tmp->RO.hash2);
if ( tmp->mainchain == 0 )
printf("%s iguana_mainchain_clear: unexpected non-main ht.%d %s\n",coin->symbol,tmp->height,str);
printf("%s iguana_mainchain_clear: ORPHANED ht.%d %s\n",coin->symbol,tmp->height,str);
else if ( tmp->height != height )
printf("iguana_mainchain_clear: unexpected ht.%d vs %d %s\n",tmp->height,height,str);
else

2
iguana/tests/decoderawtransaction

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"decoderawtransaction\",\"params\":[\"010000000f0ea95701466304197095eeceb34a9b8cc57b34a9d069f37cb3c0aedcb71c5f3c0858afd50000000090004730440220626010de8205712edb16560410fb2e99c1c602aa25d77575471321c62c1b33e30220684ab1e4037e1b38c25fb1f175e07a54621ffca4e37659019dcfa1d7ac463b0e0147304402205f907d97d9b229ce660f4bf13382e04132e042d49d1ea043a3043ea76e4c6f710220177f69d1be52744c0f55b2be106575159efffd5c8d84ca85b2cb0741d022fbaa01ffffffff01706f9800000000001976a91454a752f0d71b89d7c014ed0be29ca231c9546f9f88ac00000000\", 1]}"
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"decoderawtransaction\",\"params\":[\"010000004522cd570100d17d847b7096cdd9b79e4df4b74aabb9ac34b7abd4f9fce19d761e97cca0e800000000fd0000ffffffff0240420f00000000001976a91410acba3a841fae68aba4b5ff162714c493bcc04e88acd0300e00000000001976a914d8b8c039206af6cec82bca950f592801e62808cb88ac00000000\", 1]}"

Loading…
Cancel
Save