From 2e727de8eee3b65f87f6c5075de54980a7240b5d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 15 Apr 2019 19:58:13 +0800 Subject: [PATCH 1/2] fix wallet crash --- src/wallet/walletdb.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 3428b8b75..eab041d94 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -954,6 +954,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet) if (!deadTxns.empty()) { int32_t reAdded = 0; + CWalletDB walletdb(pwallet->strWalletFile, "r+", false); BOOST_FOREACH (uint256& hash, deadTxns) { if (!EraseTx(hash)) fprintf(stderr, "could not delete tx.%s\n",hash.ToString().c_str()); @@ -961,7 +962,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet) if (GetTransaction(hash,tx,blockhash,true)) { CWalletTx wtx(pwallet,tx); - pwallet->AddToWallet(wtx, false, NULL); + pwallet->AddToWallet(wtx, false, &walletdb); reAdded++; } } From f087f49c4dc2e27d729386e39d239e4dcda2e519 Mon Sep 17 00:00:00 2001 From: Mihailo Milenkovic Date: Mon, 15 Apr 2019 16:00:03 +0200 Subject: [PATCH 2/2] Fix looking for wrong type marker in Oracles CC --- src/cc/oracles.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cc/oracles.cpp b/src/cc/oracles.cpp index 1b13a00b7..54e9202e1 100644 --- a/src/cc/oracles.cpp +++ b/src/cc/oracles.cpp @@ -197,7 +197,7 @@ int64_t OracleCurrentDatafee(uint256 reforacletxid,char *markeraddr,CPubKey publ { uint256 txid,oracletxid,hashBlock; int64_t datafee=0,dfee; int32_t dheight=0,vout,height,numvouts; CTransaction tx; CPubKey pk; std::vector > unspentOutputs; - SetCCunspents(unspentOutputs,markeraddr,true); + SetCCunspents(unspentOutputs,markeraddr,false); for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) { txid = it->first.txhash; @@ -306,7 +306,7 @@ uint256 OraclesBatontxid(uint256 reforacletxid,CPubKey refpk) batontxid = zeroid; cp = CCinit(&C,EVAL_ORACLES); CCtxidaddr(markeraddr,reforacletxid); - SetCCunspents(unspentOutputs,markeraddr,true); + SetCCunspents(unspentOutputs,markeraddr,false); //char str[67]; fprintf(stderr,"markeraddr.(%s) %s\n",markeraddr,pubkey33_str(str,(uint8_t *)&refpk)); for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) { @@ -532,7 +532,7 @@ int32_t oracleprice_add(std::vector &publishers,CPubKey if ( format[0] != 'L' ) return(0); cp = CCinit(&C,EVAL_ORACLES); - SetCCunspents(unspentOutputs,markeraddr,true); + SetCCunspents(unspentOutputs,markeraddr,false); for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) { txid = it->first.txhash; @@ -992,7 +992,7 @@ UniValue OracleInfo(uint256 origtxid) result.push_back(Pair("description",description)); result.push_back(Pair("format",format)); result.push_back(Pair("marker",markeraddr)); - SetCCunspents(unspentOutputs,markeraddr,true); + SetCCunspents(unspentOutputs,markeraddr,false); for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) { txid = it->first.txhash;