From f235b6a6acd58cff1e79664ad583650f0e19704c Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Wed, 20 Dec 2017 06:57:47 +0100 Subject: [PATCH] Apply review suggestions/fixes --- qa/rpc-tests/disablewallet.py | 4 ++-- qa/rpc-tests/importprunedfunds.py | 14 +++++++------- src/init.cpp | 3 ++- src/test/rpc_tests.cpp | 16 ++++++++-------- src/version.h | 4 ++-- src/wallet/wallet.cpp | 2 +- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/qa/rpc-tests/disablewallet.py b/qa/rpc-tests/disablewallet.py index dfd65e25ab..ab5bb4739e 100755 --- a/qa/rpc-tests/disablewallet.py +++ b/qa/rpc-tests/disablewallet.py @@ -31,14 +31,14 @@ class DisableWalletTest (BitcoinTestFramework): # Checking mining to an address without a wallet try: - self.nodes[0].generatetoaddress(1, 'mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ') + self.nodes[0].generatetoaddress(1, 'ycwedq2f3sz2Yf9JqZsBCQPxp18WU3Hp4J') except JSONRPCException,e: assert("Invalid address" not in e.error['message']) assert("ProcessNewBlock, block not accepted" not in e.error['message']) assert("Couldn't create new block" not in e.error['message']) try: - self.nodes[0].generatetoaddress(1, '3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy') + self.nodes[0].generatetoaddress(1, '7TSBtVu959hGEGPKyHjJz9k55RpWrPffXz') raise AssertionError("Must not mine to invalid address!") except JSONRPCException,e: assert("Invalid address" in e.error['message']) diff --git a/qa/rpc-tests/importprunedfunds.py b/qa/rpc-tests/importprunedfunds.py index 5cbdcde9aa..362ee72d15 100755 --- a/qa/rpc-tests/importprunedfunds.py +++ b/qa/rpc-tests/importprunedfunds.py @@ -87,21 +87,21 @@ class ImportPrunedFundsTest(BitcoinTestFramework): assert('No addresses' in errorString) - balance1 = self.nodes[1].getbalance("", 0, True) + balance1 = self.nodes[1].getbalance("", 0, False, True) assert_equal(balance1, Decimal(0)) #Import with affiliated address with no rescan self.nodes[1].importaddress(address2, "", False) result2 = self.nodes[1].importprunedfunds(rawtxn2, proof2, "") - balance2 = Decimal(self.nodes[1].getbalance("", 0, True)) + balance2 = Decimal(self.nodes[1].getbalance("", 0, False, True)) assert_equal(balance2, Decimal('0.05')) #Import with private key with no rescan self.nodes[1].importprivkey(address3_privkey, "", False) result3 = self.nodes[1].importprunedfunds(rawtxn3, proof3, "") - balance3 = Decimal(self.nodes[1].getbalance("", 0, False)) + balance3 = Decimal(self.nodes[1].getbalance("", 0, False, False)) assert_equal(balance3, Decimal('0.025')) - balance3 = Decimal(self.nodes[1].getbalance("", 0, True)) + balance3 = Decimal(self.nodes[1].getbalance("", 0, False, True)) assert_equal(balance3, Decimal('0.075')) #Addresses Test - after import @@ -124,16 +124,16 @@ class ImportPrunedFundsTest(BitcoinTestFramework): assert('does not exist' in errorString) - balance1 = Decimal(self.nodes[1].getbalance("", 0, True)) + balance1 = Decimal(self.nodes[1].getbalance("", 0, False, True)) assert_equal(balance1, Decimal('0.075')) self.nodes[1].removeprunedfunds(txnid2) - balance2 = Decimal(self.nodes[1].getbalance("", 0, True)) + balance2 = Decimal(self.nodes[1].getbalance("", 0, False, True)) assert_equal(balance2, Decimal('0.025')) self.nodes[1].removeprunedfunds(txnid3) - balance3 = Decimal(self.nodes[1].getbalance("", 0, True)) + balance3 = Decimal(self.nodes[1].getbalance("", 0, False, True)) assert_equal(balance3, Decimal('0.0')) if __name__ == '__main__': diff --git a/src/init.cpp b/src/init.cpp index 7a137647fe..90876ae74a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1115,7 +1115,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) #ifdef ENABLE_WALLET if (!CWallet::ParameterInteraction()) return false; - std::string strWalletFile = GetArg("-wallet", DEFAULT_WALLET_DAT); #endif // ENABLE_WALLET fIsBareMultisigStd = GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG); @@ -1235,6 +1234,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) nWalletBackups = GetArg("-createwalletbackups", 10); nWalletBackups = std::max(0, std::min(10, nWalletBackups)); + std::string strWalletFile = GetArg("-wallet", DEFAULT_WALLET_DAT); + if(!AutoBackupWallet(NULL, strWalletFile, strWarning, strError)) { if (!strWarning.empty()) InitWarning(strWarning); diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp index 2c349b00e0..11f503d67c 100644 --- a/src/test/rpc_tests.cpp +++ b/src/test/rpc_tests.cpp @@ -334,22 +334,22 @@ BOOST_AUTO_TEST_CASE(rpc_convert_values_generatetoaddress) { UniValue result; - BOOST_CHECK_NO_THROW(result = RPCConvertValues("generatetoaddress", boost::assign::list_of("101")("mkESjLZW66TmHhiFX8MCaBjrhZ543PPh9a"))); + BOOST_CHECK_NO_THROW(result = RPCConvertValues("generatetoaddress", boost::assign::list_of("101")("yhq7ifNCtTKEpY4Yu5XPCcztQco6Fh6JsZ"))); BOOST_CHECK_EQUAL(result[0].get_int(), 101); - BOOST_CHECK_EQUAL(result[1].get_str(), "mkESjLZW66TmHhiFX8MCaBjrhZ543PPh9a"); + BOOST_CHECK_EQUAL(result[1].get_str(), "yhq7ifNCtTKEpY4Yu5XPCcztQco6Fh6JsZ"); - BOOST_CHECK_NO_THROW(result = RPCConvertValues("generatetoaddress", boost::assign::list_of("101")("mhMbmE2tE9xzJYCV9aNC8jKWN31vtGrguU"))); + BOOST_CHECK_NO_THROW(result = RPCConvertValues("generatetoaddress", boost::assign::list_of("101")("yTretFTpoi3oQ3maZk5QadGaDWPiKnmDBc"))); BOOST_CHECK_EQUAL(result[0].get_int(), 101); - BOOST_CHECK_EQUAL(result[1].get_str(), "mhMbmE2tE9xzJYCV9aNC8jKWN31vtGrguU"); + BOOST_CHECK_EQUAL(result[1].get_str(), "yTretFTpoi3oQ3maZk5QadGaDWPiKnmDBc"); - BOOST_CHECK_NO_THROW(result = RPCConvertValues("generatetoaddress", boost::assign::list_of("1")("mkESjLZW66TmHhiFX8MCaBjrhZ543PPh9a")("9"))); + BOOST_CHECK_NO_THROW(result = RPCConvertValues("generatetoaddress", boost::assign::list_of("1")("yNbNZyCiTYSFtDwEXt7jChV7tZVYX862ua")("9"))); BOOST_CHECK_EQUAL(result[0].get_int(), 1); - BOOST_CHECK_EQUAL(result[1].get_str(), "mkESjLZW66TmHhiFX8MCaBjrhZ543PPh9a"); + BOOST_CHECK_EQUAL(result[1].get_str(), "yNbNZyCiTYSFtDwEXt7jChV7tZVYX862ua"); BOOST_CHECK_EQUAL(result[2].get_int(), 9); - BOOST_CHECK_NO_THROW(result = RPCConvertValues("generatetoaddress", boost::assign::list_of("1")("mhMbmE2tE9xzJYCV9aNC8jKWN31vtGrguU")("9"))); + BOOST_CHECK_NO_THROW(result = RPCConvertValues("generatetoaddress", boost::assign::list_of("1")("yTG8jLL3MvteKXgbEcHyaN7JvTPCejQpSh")("9"))); BOOST_CHECK_EQUAL(result[0].get_int(), 1); - BOOST_CHECK_EQUAL(result[1].get_str(), "mhMbmE2tE9xzJYCV9aNC8jKWN31vtGrguU"); + BOOST_CHECK_EQUAL(result[1].get_str(), "yTG8jLL3MvteKXgbEcHyaN7JvTPCejQpSh"); BOOST_CHECK_EQUAL(result[2].get_int(), 9); } diff --git a/src/version.h b/src/version.h index 4005dc4e68..c801eb3326 100644 --- a/src/version.h +++ b/src/version.h @@ -38,9 +38,9 @@ static const int NO_BLOOM_VERSION = 70201; static const int SENDHEADERS_VERSION = 70201; //! "feefilter" tells peers to filter invs to you by fee starts with this version -static const int FEEFILTER_VERSION = 70209; +static const int FEEFILTER_VERSION = 99999; // disable for now (clarify deployment later) //! DIP0001 was activated in this version -static const int DIP0001_PROTOCOL_VERSION = 99999; // disable for now (clarify deployment later) +static const int DIP0001_PROTOCOL_VERSION = 70208; #endif // BITCOIN_VERSION_H diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index aaa7f966a0..ca46664d02 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4530,7 +4530,7 @@ bool CWallet::InitLoadWallet() walletInstance->GenerateNewHDChain(); // ensure this wallet.dat can only be opened by clients supporting HD - pwalletMain->SetMinVersion(FEATURE_HD); + walletInstance->SetMinVersion(FEATURE_HD); } CPubKey newDefaultKey;