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..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 ) diff --git a/iguana/dpow/dpow_tx.c b/iguana/dpow/dpow_tx.c index 6a9f99d60..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); } @@ -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)