Browse Source

make changes to normal branch to fix crash

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

18
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); //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 // 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); 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); printf(">>>> LOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout);
else else
printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout); 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); 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. // 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); 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); printf(">>>> LOCKED %s UTXO.(%s) vout.(%d\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
else else
printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout); printf("<<<< FAILED TO LOCK %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
@ -619,21 +619,21 @@ void dpow_statemachinestart(void *ptr)
printf("[%d] END isratify.%d:%d bestk.%d %llx sigs.%llx state.%x machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx paxwdcrc.%x %p %p\n",Numallocated,bp->isratify,dp->ratifying,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->state,bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask,bp->paxwdcrc,src,dest); printf("[%d] END isratify.%d:%d bestk.%d %llx sigs.%llx state.%x machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx paxwdcrc.%x %p %p\n",Numallocated,bp->isratify,dp->ratifying,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->state,bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask,bp->paxwdcrc,src,dest);
dp->lastrecvmask = bp->recvmask; dp->lastrecvmask = bp->recvmask;
dp->ratifying -= bp->isratify; dp->ratifying -= bp->isratify;
// unlock the dest utxo on KMD. // 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); 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); printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",dest->symbol,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout);
free(destunlockunspent); 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. // 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); 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); printf(">>>>UNLOCKED %s UTXO.(%s) vout.(%d)\n",src->symbol,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
free(srcunlockunspent); 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); return(retstr);
} else printf("%s null retstr from (%s)n",coin->symbol,buf); } 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) 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); return(retstr);
} else printf("%s null retstr from (%s)n",coin->symbol,buf); } 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) char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx)

Loading…
Cancel
Save