From df383ab0be05fc9265972c4c51d476dbfa2fb59e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 18:19:53 +0800 Subject: [PATCH 1/3] try --- iguana/dpow/dpow_fsm.c | 4 ++-- iguana/dpow/dpow_network.c | 2 +- iguana/dpow/dpow_tx.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index c419dc16e..5e0fd88a9 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -297,11 +297,11 @@ void dpow_statemachinestart(void *ptr) } if ( (bp= dpow_heightfind(myinfo,dp, checkpoint.blockhash.height)) == 0 ) { + if ( (blockindex= dpow_blockfind(myinfo,dp)) < 0 ) + return; bp = calloc(1,sizeof(*bp)); - blockindex = dpow_blockfind(myinfo,dp); dp->blocks[blockindex] = bp; printf("blockindex.%i allocate bp for %s ht.%d -> %s\n",blockindex,src->symbol,checkpoint.blockhash.height,dest->symbol); - //Numallocated++; bp->MoM = MoM; bp->MoMdepth = MoMdepth; bp->CCid = dp->fullCCid & 0xffff; diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 557700205..19ea04b01 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -2326,7 +2326,7 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo) dpow_datahandler(myinfo,dp,bp,np->senderind,np->channel,np->height,np->packet,np->datalen); } else printf("wrong senderind.%d\n",np->senderind); } - } //else printf("height.%d bp.%p state.%x senderind.%d\n",np->height,bp,bp!=0?bp->state:0,np->senderind); + } else printf("height.%d bp.%p state.%x senderind.%d\n",np->height,bp,bp!=0?bp->state:0,np->senderind); //dp->crcs[firstz] = crc32; } } //else printf("crc error from.%d %x vs %x or no dp.%p [%s]\n",np->senderind,crc32,np->crc32,dp,np->symbol); diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 6a9f99d60..db7a47112 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -190,7 +190,7 @@ int32_t dpow_blockfind(struct supernet_info *myinfo,struct dpow_info *dp) if ( dp->blocks[i] == 0 ) return(i); } - return(0); + return(-1); } /* maybe this is better not sure... @@ -204,7 +204,7 @@ int32_t dpow_blockfind(struct supernet_info *myinfo,struct dpow_info *dp) if ( dp->blocks[i] == 0 ) break; } - return(0); + return(-1); }*/ int32_t dpow_voutstandard(struct supernet_info *myinfo,struct dpow_block *bp,uint8_t *serialized,int32_t m,int32_t src_or_dest,uint8_t pubkeys[][33],int32_t numratified) From 3c50e2650370ff874b5cbf10449ffbbebd7732a9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 18:29:28 +0800 Subject: [PATCH 2/3] oops --- iguana/dpow/dpow_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index db7a47112..7f1a07025 100755 --- a/iguana/dpow/dpow_tx.c +++ b/iguana/dpow/dpow_tx.c @@ -177,7 +177,7 @@ struct dpow_block *dpow_heightfind(struct supernet_info *myinfo,struct dpow_info for (i = 0; i < dp->maxblocks; i++) { if ( dp->blocks[i] != 0 && height == dp->blocks[i]->height ) - return(bp); + return(dp->blocks[i]); } return(bp); } From f2c2b1c3161303e9548251fc7babf25085f89b9f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 15 Mar 2019 18:33:31 +0800 Subject: [PATCH 3/3] fix spam print --- iguana/dpow/dpow_network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 19ea04b01..00e96644c 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -2315,7 +2315,7 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo) dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,sizeof(np->ipbits)/sizeof(*np->ipbits),np->senderind,np->myipbits); if ( (bp= dpow_heightfind(myinfo,dp,np->height)) != 0 && bp->state != 0xffffffff && bp->myind >= 0 ) { - char str[65]; printf("%s RECV ht.%d ch.%08x (%d) crc32.%08x:%08x datalen.%d:%d firstz.%d i.%d senderind.%d myind.%d\n",bits256_str(str,np->srchash),np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np)),firstz,i,np->senderind,bp->myind); + //char str[65]; printf("%s RECV ht.%d ch.%08x (%d) crc32.%08x:%08x datalen.%d:%d firstz.%d i.%d senderind.%d myind.%d\n",bits256_str(str,np->srchash),np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np)),firstz,i,np->senderind,bp->myind); if ( np->senderind >= 0 && np->senderind < bp->numnotaries ) { if ( memcmp(bp->notaries[np->senderind].pubkey+1,np->srchash.bytes,32) == 0 && bits256_nonz(np->srchash) != 0 ) @@ -2326,7 +2326,7 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo) dpow_datahandler(myinfo,dp,bp,np->senderind,np->channel,np->height,np->packet,np->datalen); } else printf("wrong senderind.%d\n",np->senderind); } - } else printf("height.%d bp.%p state.%x senderind.%d\n",np->height,bp,bp!=0?bp->state:0,np->senderind); + } //else printf("height.%d bp.%p state.%x senderind.%d\n",np->height,bp,bp!=0?bp->state:0,np->senderind); //dp->crcs[firstz] = crc32; } } //else printf("crc error from.%d %x vs %x or no dp.%p [%s]\n",np->senderind,crc32,np->crc32,dp,np->symbol);