From 13547497257c54b1ef076261de49d0563258b842 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 13 Nov 2016 13:38:13 -0300 Subject: [PATCH] test --- iguana/dPoW.h | 2 +- iguana/iguana_notary.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/iguana/dPoW.h b/iguana/dPoW.h index 154b6be43..87d202bf8 100755 --- a/iguana/dPoW.h +++ b/iguana/dPoW.h @@ -125,7 +125,7 @@ struct dpow_info struct dpow_hashheight approved[DPOW_FIFOSIZE],notarized[DPOW_FIFOSIZE]; bits256 srctx[DPOW_MAXTX],desttx[DPOW_MAXTX]; uint32_t SRCREALTIME,destupdated,srcconfirms,numdesttx,numsrctx,lastsplit,cancelratify,crcs[16]; - int32_t maxblocks,SRCHEIGHT,SHORTFLAG; + int32_t lastheight,maxblocks,SRCHEIGHT,SHORTFLAG; struct pax_transaction *PAX; portable_mutex_t mutex; uint32_t ipbits[64],numipbits; diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 2ebf77dea..a76db3395 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -165,6 +165,8 @@ void iguana_dPoWupdate(struct supernet_info *myinfo,struct dpow_info *dp) if ( strcmp(dp->dest,"KMD") == 0 ) dp->SRCHEIGHT = dpow_issuer_iteration(dp,src,dp->SRCHEIGHT,&dp->SRCREALTIME); char str[65]; printf("%s %s height.%d vs last.%d\n",dp->symbol,bits256_str(str,blockhash),height,dp->last.blockhash.height); + if ( dp->lastheight == 0 ) + dp->lastheight = height-1; if ( height < dp->last.blockhash.height ) { printf("iguana_dPoWupdate src.%s reorg detected %d vs %d approved.%d notarized.%d\n",dp->symbol,height,dp->last.blockhash.height,dp->approved[0].height,dp->notarized[0].height); @@ -172,8 +174,18 @@ void iguana_dPoWupdate(struct supernet_info *myinfo,struct dpow_info *dp) { if ( bits256_cmp(blockhash,dp->last.blockhash.hash) != 0 ) printf("UNEXPECTED ILLEGAL BLOCK in src chaintip\n"); - } else dpow_srcupdate(myinfo,dp,height,blockhash,(uint32_t)time(NULL),blocktime); - } else dpow_srcupdate(myinfo,dp,height,blockhash,(uint32_t)time(NULL),blocktime); + } + else + { + while ( dp->lastheight <= height ) + dpow_srcupdate(myinfo,dp,dp->lastheight++,blockhash,(uint32_t)time(NULL),blocktime); + } + } + else + { + while ( dp->lastheight <= height ) + dpow_srcupdate(myinfo,dp,dp->lastheight++,blockhash,(uint32_t)time(NULL),blocktime); + } } //else printf("error getchaintip for %s\n",dp->symbol); } else printf("iguana_dPoWupdate missing src.(%s) %p or dest.(%s) %p\n",dp->symbol,src,dp->dest,dest); }