Apply review suggestions/fixes

This commit is contained in:
Alexander Block 2017-12-20 06:57:47 +01:00
parent 6a515e5e20
commit f235b6a6ac
6 changed files with 22 additions and 21 deletions

View File

@ -31,14 +31,14 @@ class DisableWalletTest (BitcoinTestFramework):
# Checking mining to an address without a wallet # Checking mining to an address without a wallet
try: try:
self.nodes[0].generatetoaddress(1, 'mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ') self.nodes[0].generatetoaddress(1, 'ycwedq2f3sz2Yf9JqZsBCQPxp18WU3Hp4J')
except JSONRPCException,e: except JSONRPCException,e:
assert("Invalid address" not in e.error['message']) assert("Invalid address" not in e.error['message'])
assert("ProcessNewBlock, block not accepted" 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']) assert("Couldn't create new block" not in e.error['message'])
try: try:
self.nodes[0].generatetoaddress(1, '3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy') self.nodes[0].generatetoaddress(1, '7TSBtVu959hGEGPKyHjJz9k55RpWrPffXz')
raise AssertionError("Must not mine to invalid address!") raise AssertionError("Must not mine to invalid address!")
except JSONRPCException,e: except JSONRPCException,e:
assert("Invalid address" in e.error['message']) assert("Invalid address" in e.error['message'])

View File

@ -87,21 +87,21 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
assert('No addresses' in errorString) 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)) assert_equal(balance1, Decimal(0))
#Import with affiliated address with no rescan #Import with affiliated address with no rescan
self.nodes[1].importaddress(address2, "", False) self.nodes[1].importaddress(address2, "", False)
result2 = self.nodes[1].importprunedfunds(rawtxn2, proof2, "") 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')) assert_equal(balance2, Decimal('0.05'))
#Import with private key with no rescan #Import with private key with no rescan
self.nodes[1].importprivkey(address3_privkey, "", False) self.nodes[1].importprivkey(address3_privkey, "", False)
result3 = self.nodes[1].importprunedfunds(rawtxn3, proof3, "") 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')) 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')) assert_equal(balance3, Decimal('0.075'))
#Addresses Test - after import #Addresses Test - after import
@ -124,16 +124,16 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
assert('does not exist' in errorString) 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')) assert_equal(balance1, Decimal('0.075'))
self.nodes[1].removeprunedfunds(txnid2) 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')) assert_equal(balance2, Decimal('0.025'))
self.nodes[1].removeprunedfunds(txnid3) 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')) assert_equal(balance3, Decimal('0.0'))
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -1115,7 +1115,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
if (!CWallet::ParameterInteraction()) if (!CWallet::ParameterInteraction())
return false; return false;
std::string strWalletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
#endif // ENABLE_WALLET #endif // ENABLE_WALLET
fIsBareMultisigStd = GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG); fIsBareMultisigStd = GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG);
@ -1235,6 +1234,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
nWalletBackups = GetArg("-createwalletbackups", 10); nWalletBackups = GetArg("-createwalletbackups", 10);
nWalletBackups = std::max(0, std::min(10, nWalletBackups)); nWalletBackups = std::max(0, std::min(10, nWalletBackups));
std::string strWalletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
if(!AutoBackupWallet(NULL, strWalletFile, strWarning, strError)) { if(!AutoBackupWallet(NULL, strWalletFile, strWarning, strError)) {
if (!strWarning.empty()) if (!strWarning.empty())
InitWarning(strWarning); InitWarning(strWarning);

View File

@ -334,22 +334,22 @@ BOOST_AUTO_TEST_CASE(rpc_convert_values_generatetoaddress)
{ {
UniValue result; 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[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[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[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_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[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); BOOST_CHECK_EQUAL(result[2].get_int(), 9);
} }

View File

@ -38,9 +38,9 @@ static const int NO_BLOOM_VERSION = 70201;
static const int SENDHEADERS_VERSION = 70201; static const int SENDHEADERS_VERSION = 70201;
//! "feefilter" tells peers to filter invs to you by fee starts with this version //! "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 //! 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 #endif // BITCOIN_VERSION_H

View File

@ -4530,7 +4530,7 @@ bool CWallet::InitLoadWallet()
walletInstance->GenerateNewHDChain(); walletInstance->GenerateNewHDChain();
// ensure this wallet.dat can only be opened by clients supporting HD // ensure this wallet.dat can only be opened by clients supporting HD
pwalletMain->SetMinVersion(FEATURE_HD); walletInstance->SetMinVersion(FEATURE_HD);
} }
CPubKey newDefaultKey; CPubKey newDefaultKey;