mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 02:02:42 +02:00
Merge bitcoin/bitcoin#34215: wallettool: fix unnamed createfromdump failure walletsdir deletion
f78f6f1dc8wallettool: do not use fs::remove_all in createfromdump cleanup (Ava Chow) Pull request description: As pointed out in https://github.com/bitcoin/bitcoin/pull/34156#issuecomment-3716728670, it is possible for `createfromdump` to also accidentally delete the entire wallets directory if the wallet name is the empty string and the dumpfile contains a checksum error. This is also fixed by removing the files created by only removing the directory for named wallets, and avoiding the use of `fs::remove_all`. ACKs for top commit: waketraindev: lgtm ACKf78f6f1dc8polespinasa: code review and tACKf78f6f1dc8rkrux: Code review and tACKf78f6f1dc8willcl-ark: ACKf78f6f1dc8pablomartin4btc: ACKf78f6f1dc8Tree-SHA512: ff1e7668131ec3632c67d990c99e8fddff28605e7e553c7e20695e61017c88476c3636e22f2007e763a00d527e80e4d1d3d45409f6678d28729b8397430bfe7a
This commit is contained in:
@@ -319,6 +319,12 @@ class ToolWalletTest(BitcoinTestFramework):
|
||||
self.write_dump(dump_data, bad_sum_wallet_dump)
|
||||
self.assert_raises_tool_error('Error: Checksum is not the correct size', '-wallet=badload', '-dumpfile={}'.format(bad_sum_wallet_dump), 'createfromdump')
|
||||
assert not (self.nodes[0].wallets_path / "badload").is_dir()
|
||||
self.assert_raises_tool_error('Error: Checksum is not the correct size', '-wallet=', '-dumpfile={}'.format(bad_sum_wallet_dump), 'createfromdump')
|
||||
assert self.nodes[0].wallets_path.exists()
|
||||
assert not (self.nodes[0].wallets_path / "wallet.dat").exists()
|
||||
|
||||
self.log.info('Checking createfromdump with an unnamed wallet')
|
||||
self.do_tool_createfromdump("", "wallet.dump")
|
||||
|
||||
def test_chainless_conflicts(self):
|
||||
self.log.info("Test wallet tool when wallet contains conflicting transactions")
|
||||
|
||||
Reference in New Issue
Block a user