Skip to content

Commit c1dde3a

Browse files
committed
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.
1 parent d7637c5 commit c1dde3a

File tree

8 files changed

+9
-30
lines changed

8 files changed

+9
-30
lines changed

src/qt/askpassphrasedialog.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,15 @@ void AskPassphraseDialog::accept()
123123
{
124124
QMessageBox::warning(this, tr("Wallet encrypted"),
125125
"<qt>" +
126-
tr("%1 will close now to finish the encryption process. "
126+
tr("Your wallet is now encrypted. "
127127
"Remember that encrypting your wallet cannot fully protect "
128-
"your bitcoins from being stolen by malware infecting your computer.").arg(tr(PACKAGE_NAME)) +
128+
"your bitcoins from being stolen by malware infecting your computer.") +
129129
"<br><br><b>" +
130130
tr("IMPORTANT: Any previous backups you have made of your wallet file "
131131
"should be replaced with the newly generated, encrypted wallet file. "
132132
"For security reasons, previous backups of the unencrypted wallet file "
133133
"will become useless as soon as you start using the new, encrypted wallet.") +
134134
"</b></qt>");
135-
QApplication::quit();
136135
}
137136
else
138137
{

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,7 +2729,6 @@ static UniValue encryptwallet(const JSONRPCRequest& request)
27292729
"will require the passphrase to be set prior the making these calls.\n"
27302730
"Use the walletpassphrase call for this, and then walletlock call.\n"
27312731
"If the wallet is already encrypted, use the walletpassphrasechange call.\n"
2732-
"Note that this will shutdown the server.\n"
27332732
"\nArguments:\n"
27342733
"1. \"passphrase\" (string) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.\n"
27352734
"\nExamples:\n"
@@ -2767,11 +2766,7 @@ static UniValue encryptwallet(const JSONRPCRequest& request)
27672766
throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, "Error: Failed to encrypt the wallet.");
27682767
}
27692768

2770-
// BDB seems to have a bad habit of writing old data into
2771-
// slack space in .dat files; that is bad if the old data is
2772-
// unencrypted private keys. So:
2773-
StartShutdown();
2774-
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.";
2769+
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.";
27752770
}
27762771

27772772
static UniValue lockunspent(const JSONRPCRequest& request)

test/functional/rpc_fundrawtransaction.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,8 @@ def run_test(self):
475475

476476
############################################################
477477
# locked wallet test
478-
self.stop_node(0)
479-
self.nodes[1].node_encrypt_wallet("test")
480-
self.stop_node(2)
481-
self.stop_node(3)
478+
self.nodes[1].encryptwallet("test")
479+
self.stop_nodes()
482480

483481
self.start_nodes()
484482
# This test is not meant to test fee estimation and we'd like

test/functional/test_framework/test_node.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,6 @@ def assert_start_raises_init_error(self, extra_args=None, expected_msg=None, mat
268268
assert_msg = "bitcoind should have exited with expected error " + expected_msg
269269
self._raise_assertion_error(assert_msg)
270270

271-
def node_encrypt_wallet(self, passphrase):
272-
""""Encrypts the wallet.
273-
274-
This causes bitcoind to shutdown, so this method takes
275-
care of cleaning up resources."""
276-
self.encryptwallet(passphrase)
277-
self.wait_until_stopped()
278-
279271
def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, **kwargs):
280272
"""Add a p2p connection to the node.
281273

test/functional/wallet_bumpfee.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ def set_test_params(self):
3636

3737
def run_test(self):
3838
# Encrypt wallet for test_locked_wallet_fails test
39-
self.nodes[1].node_encrypt_wallet(WALLET_PASSPHRASE)
40-
self.start_node(1)
39+
self.nodes[1].encryptwallet(WALLET_PASSPHRASE)
4140
self.nodes[1].walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
4241

4342
connect_nodes_bi(self.nodes, 0, 1)

test/functional/wallet_dump.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ def run_test(self):
121121
assert_equal(witness_addr_ret, witness_addr) # p2sh-p2wsh address added to the first key
122122

123123
#encrypt wallet, restart, unlock and dump
124-
self.nodes[0].node_encrypt_wallet('test')
125-
self.start_node(0)
124+
self.nodes[0].encryptwallet('test')
126125
self.nodes[0].walletpassphrase('test', 10)
127126
# Should be a no-op:
128127
self.nodes[0].keypoolrefill()

test/functional/wallet_encryption.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def run_test(self):
3030
assert_equal(len(privkey), 52)
3131

3232
# Encrypt the wallet
33-
self.nodes[0].node_encrypt_wallet(passphrase)
34-
self.start_node(0)
33+
self.nodes[0].encryptwallet(passphrase)
3534

3635
# Test that the wallet is encrypted
3736
assert_raises_rpc_error(-13, "Please enter the wallet passphrase with walletpassphrase first", self.nodes[0].dumpprivkey, address)

test/functional/wallet_keypool.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ def run_test(self):
2020
assert(addr_before_encrypting_data['hdseedid'] == wallet_info_old['hdseedid'])
2121

2222
# Encrypt wallet and wait to terminate
23-
nodes[0].node_encrypt_wallet('test')
24-
# Restart node 0
25-
self.start_node(0)
23+
nodes[0].encryptwallet('test')
2624
# Keep creating keys
2725
addr = nodes[0].getnewaddress()
2826
addr_data = nodes[0].getaddressinfo(addr)

0 commit comments

Comments
 (0)