From 3b1ac738bdeb90bd20b18e00ea3dcd91b7e0775c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 9 Oct 2018 14:45:46 +0800 Subject: [PATCH] Fixed finally --- iguana/dpow/dpow_fsm.c | 13 ++++++------- iguana/dpow/dpow_rpc.c | 5 +++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 47fa7d6a2..3153a5213 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -507,25 +507,24 @@ void dpow_statemachinestart(void *ptr) 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 (strcmp(destlockunspent,"true") == 0 ) + // lock the dest utxo if destination coin is KMD. + if (dpow_lockunspent(myinfo,bp->destcoin,destaddr,bits256_str(str2,ep->dest.prev_hash),ep->dest.prev_vout) != 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("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 (strcmp(srclockunspent,"true") == 0 ) + if (dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout) != 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); - free(srclockunspent); + } } + bp->recvmask |= (1LL << myind); bp->notaries[myind].othermask |= (1LL << myind); dp->checkpoint = checkpoint; diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 3dc45c7f1..a76b010ab 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -466,7 +466,7 @@ cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits2 return(json); } -char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) +int dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,char *txid,int32_t vout) { char buf[128],*retstr; if ( coin->FULLNODE < 0 ) @@ -475,7 +475,8 @@ char *dpow_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,cha if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"lockunspent",buf)) != 0 ) { //printf("RESULT.(%s)\n",retstr); - return(retstr); + free(retstr); + return(1); } // else printf("%s null retstr from (%s)n",coin->symbol,buf); } return(0);