From 95d8bce90eba1d0c5e05faf38f8f71331a9260da Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 4 Nov 2016 09:09:29 -0300 Subject: [PATCH] test --- iguana/dpow/dpow_tx.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 4dd02d2a5..f94ed3ba7 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -66,7 +66,7 @@ uint64_t dpow_maskmin(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp) struct dpow_block *dpow_heightfind(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height) { - int32_t incr = 100000; + int32_t r,h,incr = 100000; struct dpow_block *bp = 0; if ( height > dp->maxblocks ) { dp->blocks = realloc(dp->blocks,sizeof(*dp->blocks) * (dp->maxblocks + incr)); @@ -74,8 +74,18 @@ struct dpow_block *dpow_heightfind(struct supernet_info *myinfo,struct dpow_info dp->maxblocks += incr; } if ( height < dp->maxblocks ) - return(dp->blocks!=0?dp->blocks[height]:0); - else return(0); + bp = dp->blocks!=0 ? dp->blocks[height] : 0; + if ( bp == 0 && height < DPOW_FIRSTRATIFY ) + { + r = (rand() % DPOW_FIRSTRATIFY); + for (h=0; hblocks[height]) != 0 ) + return(bp); + } + } + return(bp); } int32_t dpow_voutratify(struct dpow_block *bp,uint8_t *serialized,int32_t m,uint8_t pubkeys[][33],int32_t numratified)