Skip to content

Commit 1b1b9f3

Browse files
committed
Merge bitcoin#32440: test: remove bdb assert in tool_wallet.py
e08e656 test: remove assert_dump since it is not used anymore (kevkevinpal) 4b6dd97 test: remove bdb assert in tool_wallet.py (kevkevinpal) Pull request description: As suggested in bitcoin#32438 (comment) legacy wallet and the BDB dependency was removed (bitcoin#28710) so this assert is safe to delete ACKs for top commit: davidgumberg: reACK bitcoin@e08e656 achow101: ACK e08e656 brunoerg: reACK e08e656 theStack: re-ACK e08e656 Tree-SHA512: 6417537d7b9b5da6039dfcc94a86107211d57dcca43becea6f95d4a95f342e12918b0ff6a562261ba538b7b206de7d327e52bdb7d49e353f1917df8668558a99
2 parents efac285 + e08e656 commit 1b1b9f3

File tree

1 file changed

+1
-32
lines changed

1 file changed

+1
-32
lines changed

test/functional/tool_wallet.py

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ def assert_is_sqlite(self, filename):
9595
file_magic = f.read(16)
9696
assert file_magic == b'SQLite format 3\x00'
9797

98-
def assert_is_bdb(self, filename):
99-
with open(filename, 'rb') as f:
100-
f.seek(12, 0)
101-
file_magic = f.read(4)
102-
assert file_magic == b'\x00\x05\x31\x62' or file_magic == b'\x62\x31\x05\x00'
103-
10498
def write_dump(self, dump, filename, magic=None, skip_checksum=False):
10599
if magic is None:
106100
magic = "BITCOIN_CORE_WALLET_DUMP"
@@ -116,27 +110,6 @@ def write_dump(self, dump, filename, magic=None, skip_checksum=False):
116110
row = ",".join(["checksum", dump["checksum"]]) + "\n"
117111
f.write(row)
118112

119-
def assert_dump(self, expected, received):
120-
e = expected.copy()
121-
r = received.copy()
122-
123-
# BDB will add a "version" record that is not present in sqlite
124-
# In that case, we should ignore this record in both
125-
# But because this also effects the checksum, we also need to drop that.
126-
v_key = "0776657273696f6e" # Version key
127-
if v_key in e and v_key not in r:
128-
del e[v_key]
129-
del e["checksum"]
130-
del r["checksum"]
131-
if v_key not in e and v_key in r:
132-
del r[v_key]
133-
del e["checksum"]
134-
del r["checksum"]
135-
136-
assert_equal(len(e), len(r))
137-
for k, v in e.items():
138-
assert_equal(v, r[k])
139-
140113
def do_tool_createfromdump(self, wallet_name, dumpfile):
141114
dumppath = self.nodes[0].datadir_path / dumpfile
142115
rt_dumppath = self.nodes[0].datadir_path / "rt-{}.dump".format(wallet_name)
@@ -151,12 +124,8 @@ def do_tool_createfromdump(self, wallet_name, dumpfile):
151124

152125
self.assert_tool_output("The dumpfile may contain private keys. To ensure the safety of your Bitcoin, do not share the dumpfile.\n", '-wallet={}'.format(wallet_name), '-dumpfile={}'.format(rt_dumppath), 'dump')
153126

154-
rt_dump_data = self.read_dump(rt_dumppath)
155127
wallet_dat = self.nodes[0].wallets_path / wallet_name / "wallet.dat"
156-
if rt_dump_data["format"] == "bdb":
157-
self.assert_is_bdb(wallet_dat)
158-
else:
159-
self.assert_is_sqlite(wallet_dat)
128+
self.assert_is_sqlite(wallet_dat)
160129

161130
def test_invalid_tool_commands_and_args(self):
162131
self.log.info('Testing that various invalid commands raise with specific error messages')

0 commit comments

Comments
 (0)