diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index b9b4c27fb..8b36e6eee 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -284,7 +284,7 @@ void dpow_statemachinestart(void *ptr) if ( src == 0 || dest == 0 ) { printf("null coin ptr? (%s %p or %s %p)\n",dp->symbol,src,dp->dest,dest); - goto end2; + goto end; } MoMdepth = 0; memset(&MoM,0,sizeof(MoM)); @@ -320,7 +320,7 @@ void dpow_statemachinestart(void *ptr) if ( numratified > 64 ) { fprintf(stderr,"cant ratify more than 64 notaries ratified has %d\n",numratified); - goto end2; + goto end; } for (i=0; i<numratified; i++) { @@ -379,7 +379,7 @@ void dpow_statemachinestart(void *ptr) if ( dp->ratifying != 0 && bp->isratify == 0 ) { printf("skip notarization ht.%d when ratifying\n",bp->height); - goto end2; + goto end; } dp->ratifying += bp->isratify; @@ -428,7 +428,7 @@ void dpow_statemachinestart(void *ptr) printf("%02x",dp->minerkey33[i]); printf(" statemachinestart this node %s %s is not official notary numnotaries.%d kmdht.%d bpht.%d\n",srcaddr,destaddr,bp->numnotaries,kmdheight,bp->height); dp->ratifying -= bp->isratify; - goto end2; + goto end; } //printf("myind.%d\n",myind); } @@ -436,7 +436,7 @@ void dpow_statemachinestart(void *ptr) { printf("statemachinestart no kmdheight.%d\n",kmdheight); dp->ratifying -= bp->isratify; - goto end2; + goto end; } bp->myind = myind; printf("[%d] notarize %s->%s %s ht.%d minsigs.%d duration.%d start.%u MoM[%d] %s CCid.%u\n",bp->myind,dp->symbol,dp->dest,bits256_str(str,checkpoint.blockhash.hash),checkpoint.blockhash.height,minsigs,duration,checkpoint.timestamp,bp->MoMdepth,bits256_str(str2,bp->MoM),bp->CCid); @@ -449,7 +449,7 @@ void dpow_statemachinestart(void *ptr) printf("%02x",bp->ratified_pubkeys[0][i]); printf(" new, cant change notary0\n"); dp->ratifying -= bp->isratify; - goto end2; + goto end; } //printf(" myind.%d myaddr.(%s %s)\n",myind,srcaddr,destaddr); if ( myind == 0 && bits256_nonz(destprevtxid0) != 0 && bits256_nonz(srcprevtxid0) != 0 && destprevvout0 >= 0 && srcprevvout0 >= 0 ) @@ -691,20 +691,17 @@ void dpow_statemachinestart(void *ptr) end: // unlock the dest utxo on KMD. - if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) ) + if ( ep != 0 && strcmp("KMD",dest->symbol) == 0 && ep->dest.prev_vout != -1 ) { if ( dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout) != 0 ) printf(">>>> UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); } - // unlock the src selected utxo on KMD. - if ( ( strcmp("KMD",src->symbol) == 0 ) && (ep->src.prev_vout != -1) ) + if ( ep != 0 && strcmp("KMD",src->symbol) == 0 && ep->src.prev_vout != -1 ) { if ( dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout) != 0) printf(">>>> UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); } - -end2: dp->blocks[blockindex] = 0; bp->state = 0xffffffff; free(bp);