mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-06 18:53:21 +01:00
Corrupt wallet tx shouldn't trigger rescan of all wallets
This commit is contained in:
@@ -755,6 +755,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
|
||||
{
|
||||
CWalletScanState wss;
|
||||
bool fNoncriticalErrors = false;
|
||||
bool rescan_required = false;
|
||||
DBErrors result = DBErrors::LOAD_OK;
|
||||
|
||||
LOCK(pwallet->cs_wallet);
|
||||
@@ -823,7 +824,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
|
||||
fNoncriticalErrors = true; // ... but do warn the user there is something wrong.
|
||||
if (strType == DBKeys::TX)
|
||||
// Rescan if there is a bad transaction record:
|
||||
gArgs.SoftSetBoolArg("-rescan", true);
|
||||
rescan_required = true;
|
||||
}
|
||||
}
|
||||
if (!strErr.empty())
|
||||
@@ -859,8 +860,11 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
|
||||
((DescriptorScriptPubKeyMan*)spk_man)->AddCryptedKey(desc_key_pair.first.second, desc_key_pair.second.first, desc_key_pair.second.second);
|
||||
}
|
||||
|
||||
if (fNoncriticalErrors && result == DBErrors::LOAD_OK)
|
||||
if (rescan_required && result == DBErrors::LOAD_OK) {
|
||||
result = DBErrors::RESCAN_REQUIRED;
|
||||
} else if (fNoncriticalErrors && result == DBErrors::LOAD_OK) {
|
||||
result = DBErrors::NONCRITICAL_ERROR;
|
||||
}
|
||||
|
||||
// Any wallet corruption at all: skip any rewriting or
|
||||
// upgrading, we don't want to make it worse.
|
||||
|
||||
Reference in New Issue
Block a user