From 91cc508d2b93ab18a02269a110a4c2bddd7aa52a Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 17 Sep 2016 03:44:15 -0300 Subject: [PATCH] test --- iguana/iguana_ramchain.c | 12 +++++++++++- iguana/iguana_recv.c | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index 494658992..891112753 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -1984,19 +1984,23 @@ void iguana_blockdelete(struct iguana_info *coin,bits256 hash2,int32_t i) void iguana_blockunmark(struct iguana_info *coin,struct iguana_block *block,struct iguana_bundle *bp,int32_t i,int32_t deletefile) { - void *ptr; int32_t recvlen; + void *ptr; int32_t recvlen,height = -1; if ( 0 && bp != 0 ) printf("UNMARK.[%d:%d]\n",bp->hdrsi,i); if ( block != 0 ) { + height = block->height; block->queued = 0; block->fpipbits = 0; block->fpos = -1; block->txvalid = 0; block->issued = 0; + block->mainchain = 0; } if ( bp != 0 && i >= 0 && i < bp->n ) { + if ( height < 0 || bp->bundleheight+i < height ) + height = bp->bundleheight+i; bp->issued[i] = 0; bp->blocks[i] = 0; memset(&bp->hashes[i],0,sizeof(bp->hashes[i])); @@ -2009,6 +2013,12 @@ void iguana_blockunmark(struct iguana_info *coin,struct iguana_block *block,stru } if ( deletefile != 0 && block != 0 ) iguana_blockdelete(coin,block->RO.hash2,i); + if ( height > 0 && height < coin->blocks.hwmchain.height ) + { + printf("reduce HWM height from %d to %d\n",coin->blocks.hwmchain.height,height); + if ( (block= iguana_blockfind("unmark",coin,iguana_blockhash(coin,height))) != 0 ) + iguana_blockcopy(coin->chain->zcash,coin->chain->auxpow,coin,(struct iguana_block *)&coin->blocks.hwmchain,block); + } } int32_t iguana_oldbundlefiles(struct iguana_info *coin,uint32_t *ipbits,void **ptrs,long *filesizes,struct iguana_bundle *bp) diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 47b959300..7527f7c34 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -1149,7 +1149,9 @@ void iguana_mainchain_clear(struct supernet_info *myinfo,struct iguana_info *coi iguana_RTnewblock(myinfo,coin,tmp); bits256_str(str,tmp->RO.hash2); if ( tmp->mainchain == 0 ) - printf("%s iguana_mainchain_clear: ORPHANED 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