This PR adds missing features to our test framework’s BDB parser with the goal of hopefully being able to read all legacy wallets that are created with current and past versions of Bitcoin Core. This could be useful both for making review of #26606 easier and to also possibly improve our functional tests for the wallet BDB-ro parser by additionally validating it with an alternative implementation. The second commits introduces a test that create a legacy wallet with huge label strings (in order to create overflow pages, i.e. pages needed for key/value data than is larger than the page size) and compares the dump outputs of wallet tool and the extended test framework BDB parser.
It can be exercised via $ ./test/functional/tool_wallet.py --legacy
. BDB support has to be compiled in (obviously).
For some manual tests regarding different page sizes, the following patch can be used:
0diff --git a/src/wallet/bdb.cpp b/src/wallet/bdb.cpp
1index 38cca32f80..1bf39323d3 100644
2--- a/src/wallet/bdb.cpp
3+++ b/src/wallet/bdb.cpp
4@@ -395,6 +395,7 @@ void BerkeleyDatabase::Open()
5 DB_BTREE, // Database type
6 nFlags, // Flags
7 0);
8+ pdb_temp->set_pagesize(1<<9); /* valid BDB pagesizes are from 1<<9 (=512) to <<16 (=65536) */
9
10 if (ret != 0) {
11 throw std::runtime_error(strprintf("BerkeleyDatabase: Error %d, can't open database %s", ret, strFile));
I verified that the newly introduced test passes with all valid page sizes between 512 and 65536.