No longer shutdown after encrypting the wallet
Since the database environment is flushed, closed, and reopened during
EncryptWallet, there is no need to shut down the software anymore.
Github-Pull: #12493
Rebased-From: c1dde3a
This commit is contained in:
parent
435df68c62
commit
1c98a758d0
8 changed files with 9 additions and 30 deletions
|
@ -123,16 +123,15 @@ void AskPassphraseDialog::accept()
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Wallet encrypted"),
|
QMessageBox::warning(this, tr("Wallet encrypted"),
|
||||||
"<qt>" +
|
"<qt>" +
|
||||||
tr("%1 will close now to finish the encryption process. "
|
tr("Your wallet is now encrypted. "
|
||||||
"Remember that encrypting your wallet cannot fully protect "
|
"Remember that encrypting your wallet cannot fully protect "
|
||||||
"your bitcoins from being stolen by malware infecting your computer.").arg(tr(PACKAGE_NAME)) +
|
"your bitcoins from being stolen by malware infecting your computer.") +
|
||||||
"<br><br><b>" +
|
"<br><br><b>" +
|
||||||
tr("IMPORTANT: Any previous backups you have made of your wallet file "
|
tr("IMPORTANT: Any previous backups you have made of your wallet file "
|
||||||
"should be replaced with the newly generated, encrypted wallet file. "
|
"should be replaced with the newly generated, encrypted wallet file. "
|
||||||
"For security reasons, previous backups of the unencrypted wallet file "
|
"For security reasons, previous backups of the unencrypted wallet file "
|
||||||
"will become useless as soon as you start using the new, encrypted wallet.") +
|
"will become useless as soon as you start using the new, encrypted wallet.") +
|
||||||
"</b></qt>");
|
"</b></qt>");
|
||||||
QApplication::quit();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -2740,7 +2740,6 @@ static UniValue encryptwallet(const JSONRPCRequest& request)
|
||||||
"will require the passphrase to be set prior the making these calls.\n"
|
"will require the passphrase to be set prior the making these calls.\n"
|
||||||
"Use the walletpassphrase call for this, and then walletlock call.\n"
|
"Use the walletpassphrase call for this, and then walletlock call.\n"
|
||||||
"If the wallet is already encrypted, use the walletpassphrasechange call.\n"
|
"If the wallet is already encrypted, use the walletpassphrasechange call.\n"
|
||||||
"Note that this will shutdown the server.\n"
|
|
||||||
"\nArguments:\n"
|
"\nArguments:\n"
|
||||||
"1. \"passphrase\" (string) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.\n"
|
"1. \"passphrase\" (string) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.\n"
|
||||||
"\nExamples:\n"
|
"\nExamples:\n"
|
||||||
|
@ -2778,11 +2777,7 @@ static UniValue encryptwallet(const JSONRPCRequest& request)
|
||||||
throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, "Error: Failed to encrypt the wallet.");
|
throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, "Error: Failed to encrypt the wallet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// BDB seems to have a bad habit of writing old data into
|
return "wallet encrypted; The keypool has been flushed and a new HD seed was generated (if you are using HD). You need to make a new backup.";
|
||||||
// slack space in .dat files; that is bad if the old data is
|
|
||||||
// unencrypted private keys. So:
|
|
||||||
StartShutdown();
|
|
||||||
return "wallet encrypted; Bitcoin server stopping, restart to run with encrypted wallet. The keypool has been flushed and a new HD seed was generated (if you are using HD). You need to make a new backup.";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static UniValue lockunspent(const JSONRPCRequest& request)
|
static UniValue lockunspent(const JSONRPCRequest& request)
|
||||||
|
|
|
@ -478,10 +478,8 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# locked wallet test
|
# locked wallet test
|
||||||
self.stop_node(0)
|
self.nodes[1].encryptwallet("test")
|
||||||
self.nodes[1].node_encrypt_wallet("test")
|
self.stop_nodes()
|
||||||
self.stop_node(2)
|
|
||||||
self.stop_node(3)
|
|
||||||
|
|
||||||
self.start_nodes()
|
self.start_nodes()
|
||||||
# This test is not meant to test fee estimation and we'd like
|
# This test is not meant to test fee estimation and we'd like
|
||||||
|
|
|
@ -305,14 +305,6 @@ class TestNode():
|
||||||
assert_msg = "bitcoind should have exited with expected error " + expected_msg
|
assert_msg = "bitcoind should have exited with expected error " + expected_msg
|
||||||
self._raise_assertion_error(assert_msg)
|
self._raise_assertion_error(assert_msg)
|
||||||
|
|
||||||
def node_encrypt_wallet(self, passphrase):
|
|
||||||
""""Encrypts the wallet.
|
|
||||||
|
|
||||||
This causes bitcoind to shutdown, so this method takes
|
|
||||||
care of cleaning up resources."""
|
|
||||||
self.encryptwallet(passphrase)
|
|
||||||
self.wait_until_stopped()
|
|
||||||
|
|
||||||
def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, **kwargs):
|
def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, **kwargs):
|
||||||
"""Add a p2p connection to the node.
|
"""Add a p2p connection to the node.
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,7 @@ class BumpFeeTest(BitcoinTestFramework):
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
# Encrypt wallet for test_locked_wallet_fails test
|
# Encrypt wallet for test_locked_wallet_fails test
|
||||||
self.nodes[1].node_encrypt_wallet(WALLET_PASSPHRASE)
|
self.nodes[1].encryptwallet(WALLET_PASSPHRASE)
|
||||||
self.start_node(1)
|
|
||||||
self.nodes[1].walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
|
self.nodes[1].walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
|
||||||
|
|
||||||
connect_nodes_bi(self.nodes, 0, 1)
|
connect_nodes_bi(self.nodes, 0, 1)
|
||||||
|
|
|
@ -128,8 +128,7 @@ class WalletDumpTest(BitcoinTestFramework):
|
||||||
assert_equal(witness_addr_ret, witness_addr) # p2sh-p2wsh address added to the first key
|
assert_equal(witness_addr_ret, witness_addr) # p2sh-p2wsh address added to the first key
|
||||||
|
|
||||||
#encrypt wallet, restart, unlock and dump
|
#encrypt wallet, restart, unlock and dump
|
||||||
self.nodes[0].node_encrypt_wallet('test')
|
self.nodes[0].encryptwallet('test')
|
||||||
self.start_node(0)
|
|
||||||
self.nodes[0].walletpassphrase('test', 10)
|
self.nodes[0].walletpassphrase('test', 10)
|
||||||
# Should be a no-op:
|
# Should be a no-op:
|
||||||
self.nodes[0].keypoolrefill()
|
self.nodes[0].keypoolrefill()
|
||||||
|
|
|
@ -33,8 +33,7 @@ class WalletEncryptionTest(BitcoinTestFramework):
|
||||||
assert_equal(len(privkey), 52)
|
assert_equal(len(privkey), 52)
|
||||||
|
|
||||||
# Encrypt the wallet
|
# Encrypt the wallet
|
||||||
self.nodes[0].node_encrypt_wallet(passphrase)
|
self.nodes[0].encryptwallet(passphrase)
|
||||||
self.start_node(0)
|
|
||||||
|
|
||||||
# Test that the wallet is encrypted
|
# Test that the wallet is encrypted
|
||||||
assert_raises_rpc_error(-13, "Please enter the wallet passphrase with walletpassphrase first", self.nodes[0].dumpprivkey, address)
|
assert_raises_rpc_error(-13, "Please enter the wallet passphrase with walletpassphrase first", self.nodes[0].dumpprivkey, address)
|
||||||
|
|
|
@ -25,9 +25,7 @@ class KeyPoolTest(BitcoinTestFramework):
|
||||||
assert(addr_before_encrypting_data['hdseedid'] == wallet_info_old['hdseedid'])
|
assert(addr_before_encrypting_data['hdseedid'] == wallet_info_old['hdseedid'])
|
||||||
|
|
||||||
# Encrypt wallet and wait to terminate
|
# Encrypt wallet and wait to terminate
|
||||||
nodes[0].node_encrypt_wallet('test')
|
nodes[0].encryptwallet('test')
|
||||||
# Restart node 0
|
|
||||||
self.start_node(0)
|
|
||||||
# Keep creating keys
|
# Keep creating keys
|
||||||
addr = nodes[0].getnewaddress()
|
addr = nodes[0].getnewaddress()
|
||||||
addr_data = nodes[0].getaddressinfo(addr)
|
addr_data = nodes[0].getaddressinfo(addr)
|
||||||
|
|
Loading…
Reference in a new issue