wallet: remove DBErrors::NEED_REWRITE enum value

As highlighted in the PR review comment, this enum seems no longer
required as the specific issue it solves for involves BDB based wallets
that can't be loaded anymore outside the context of wallet migration,
which rewrites the database anyway.
This commit is contained in:
rkrux 2026-01-16 16:25:51 +05:30
parent 61039d72a5
commit c6a6435ced
No known key found for this signature in database
GPG Key ID: 8614B8BD2E144C6D
3 changed files with 0 additions and 13 deletions

View File

@ -2357,9 +2357,6 @@ DBErrors CWallet::PopulateWalletFromDB(bilingual_str& error, std::vector<bilingu
Assert(m_spk_managers.empty());
Assert(m_wallet_flags == 0);
DBErrors nLoadWalletRet = WalletBatch(GetDatabase()).LoadWallet(this);
if (nLoadWalletRet == DBErrors::NEED_REWRITE) {
GetDatabase().Rewrite();
}
if (m_spk_managers.empty()) {
assert(m_external_spk_managers.empty());
@ -2388,9 +2385,6 @@ DBErrors CWallet::PopulateWalletFromDB(bilingual_str& error, std::vector<bilingu
case DBErrors::EXTERNAL_SIGNER_SUPPORT_REQUIRED:
error = strprintf(_("Error loading %s: External signer wallet being loaded without external signer support compiled"), wallet_file);
break;
case DBErrors::NEED_REWRITE:
error = strprintf(_("Wallet needed to be rewritten: restart %s to complete"), CLIENT_NAME);
break;
case DBErrors::UNKNOWN_DESCRIPTOR:
error = strprintf(_("Unrecognized descriptor found. Loading wallet %s\n\n"
"The wallet might have been created on a newer version.\n"

View File

@ -593,12 +593,6 @@ static DBErrors LoadLegacyWalletRecords(CWallet* pwallet, DatabaseBatch& batch,
});
result = std::max(result, script_res.m_result);
// Check whether rewrite is needed
if (ckey_res.m_records > 0) {
// Rewrite encrypted wallets of versions 0.4.0 and 0.5.0rc:
if (last_client == 40000 || last_client == 50000) result = std::max(result, DBErrors::NEED_REWRITE);
}
// Load keymeta
std::map<uint160, CHDChain> hd_chains;
LoadResult keymeta_res = LoadRecords(pwallet, batch, DBKeys::KEYMETA,

View File

@ -44,7 +44,6 @@ enum class DBErrors : int
{
LOAD_OK = 0,
NEED_RESCAN = 1,
NEED_REWRITE = 2,
EXTERNAL_SIGNER_SUPPORT_REQUIRED = 3,
NONCRITICAL_ERROR = 4,
TOO_NEW = 5,