Browse Source

make changes to normal branch to fix crash

blackjok3r
blackjok3r 6 years ago
parent
commit
5cec066a26
  1. 16
      iguana/dpow/dpow_fsm.c
  2. 4
      iguana/dpow/dpow_rpc.c

16
iguana/dpow/dpow_fsm.c

@ -505,22 +505,22 @@ void dpow_statemachinestart(void *ptr)
//printf("Use srcutxo.(%s) vout.(%d) destutxo.(%s) vout.(%d)\n",bits256_str(str,ep->src.prev_hash),ep->src.prev_vout,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout);
if (strcmp("KMD",dest->symbol) == 0 )
if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) )
{
// lock the dest utxo if destination coin is KMD.s
destlockunspent = dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout);
if (strncmp(destlockunspent,"true", 4) == 0 )
if (strcmp(destlockunspent,"true") == 0 )
printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout);
else
printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout);
free(destlockunspent);
}
if ( strcmp("BTC",dest->symbol) == 0 )
if ( ( strcmp("KMD",src->symbol) == 0 ) && (ep->src.prev_vout != -1) )
{
// lock the src coin selected utxo if the source coin is KMD.
srclockunspent = dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
if (strncmp(srclockunspent,"true", 4) == 0 )
if (strcmp(srclockunspent,"true") == 0 )
printf(">>>> LOCKED %s UTXO.(%s) vout.(%d\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
else
printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
@ -621,19 +621,19 @@ void dpow_statemachinestart(void *ptr)
dp->ratifying -= bp->isratify;
// unlock the dest utxo on KMD.
if (strcmp("KMD",dest->symbol) == 0 )
if ( (strcmp("KMD",dest->symbol) == 0 ) && (ep->dest.prev_vout != -1) )
{
destunlockunspent = dpow_unlockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout);
if (strncmp(destunlockunspent,"true", 4) == 0 )
if (strcmp(destunlockunspent,"true") == 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 on KMD, as those are the only ones we LOCK, and CHIPS does not like the lockunspent call.
if ( strcmp("BTC",dest->symbol) == 0 )
if ( ( strcmp("KMD",src->symbol) == 0 ) && (ep->src.prev_vout != -1) )
{
srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
if (strncmp(srcunlockunspent,"true", 4) == 0 )
if (strcmp(srcunlockunspent,"true") == 0 )
printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
free(srcunlockunspent);
}

4
iguana/dpow/dpow_rpc.c

@ -478,7 +478,7 @@ char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,cha
return(retstr);
} else printf("%s null retstr from (%s)n",coin->symbol,buf);
}
return(0);
return("false");
}
char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout)
@ -493,7 +493,7 @@ char *dpow_unlockunspent(struct supernet_info *myinfo,struct iguana_info *coin,c
return(retstr);
} else printf("%s null retstr from (%s)n",coin->symbol,buf);
}
return(0);
return("false");
}
char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx)

Loading…
Cancel
Save