Skip to content

Commit fd7b16e

Browse files
committed
test: Test dumps of other endian BDB files
1 parent 6ace3e9 commit fd7b16e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/functional/tool_wallet.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,25 @@ def test_chainless_conflicts(self):
454454
''')
455455
self.assert_tool_output(expected_output, "-wallet=conflicts", "info")
456456

457+
def test_dump_endianness(self):
458+
self.log.info("Testing dumps of the same contents with different BDB endianness")
459+
460+
self.start_node(0)
461+
self.nodes[0].createwallet("endian")
462+
self.stop_node(0)
463+
464+
wallet_dump = self.nodes[0].datadir_path / "endian.dump"
465+
self.assert_tool_output("The dumpfile may contain private keys. To ensure the safety of your Bitcoin, do not share the dumpfile.\n", "-wallet=endian", f"-dumpfile={wallet_dump}", "dump")
466+
expected_dump = self.read_dump(wallet_dump)
467+
468+
self.do_tool_createfromdump("native_endian", "endian.dump", "bdb")
469+
native_dump = self.read_dump(self.nodes[0].datadir_path / "rt-native_endian.dump")
470+
self.assert_dump(expected_dump, native_dump)
471+
472+
self.do_tool_createfromdump("other_endian", "endian.dump", "bdb_swap")
473+
other_dump = self.read_dump(self.nodes[0].datadir_path / "rt-other_endian.dump")
474+
self.assert_dump(expected_dump, other_dump)
475+
457476
def run_test(self):
458477
self.wallet_path = self.nodes[0].wallets_path / self.default_wallet_name / self.wallet_data_filename
459478
self.test_invalid_tool_commands_and_args()
@@ -465,6 +484,7 @@ def run_test(self):
465484
if not self.options.descriptors:
466485
# Salvage is a legacy wallet only thing
467486
self.test_salvage()
487+
self.test_dump_endianness()
468488
self.test_dump_createfromdump()
469489
self.test_chainless_conflicts()
470490

0 commit comments

Comments
 (0)