Browse Source

fix unlock on utxo not locked, CHIPS got really angry

patch-5
blackjok3r 6 years ago
parent
commit
daa2549ab5
  1. 26
      iguana/dpow/dpow_fsm.c

26
iguana/dpow/dpow_fsm.c

@ -619,17 +619,23 @@ void dpow_statemachinestart(void *ptr)
dp->lastrecvmask = bp->recvmask;
dp->ratifying -= bp->isratify;
// unlock the dest utxo regardless if it was locked or not it does not matter.
destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout);
if (strncmp(destunlockunspent,"true", 4) == 0 )
printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout);
free(destunlockunspent);
// unlock the dest utxo on KMD.
if (strcmp("KMD",dest->symbol) == 0 )
{
destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout);
if (strncmp(destunlockunspent,"true", 4) == 0 )
printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout);
free(destunlockunspent);
}
// unlock the src selected utxo, if it was locked or not it does not matter.
srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
if (strncmp(srcunlockunspent,"true", 4) == 0 )
printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
free(srcunlockunspent);
// unlock the src selected utxo on KMD, as those are the only ones we LOCK, and CHIPS does not like the lockunspent call.
if ( strcmp("BTC",dest->symbol) == 0 )
{
srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
if (strncmp(srcunlockunspent,"true", 4) == 0 )
printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
free(srcunlockunspent);
}
// dp->blocks[bp->height] = 0;
bp->state = 0xffffffff;

Loading…
Cancel
Save