mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 16:53:52 +02:00
wallet: Retrieve ID from loaded DescSPKM directly
Instead of iterating m_spk_managers a DescriptorSPKM has been loaded in order to get it's ID to compare, have LoadDescriptorSPKM return a reference to the loaded DescriptorSPKM so it can be queried directly.
This commit is contained in:
@@ -804,10 +804,10 @@ static DBErrors LoadDescriptorWalletRecords(CWallet* pwallet, DatabaseBatch& bat
|
||||
strErr = strprintf("%s\nDetails: %s", strErr, e.what());
|
||||
return DBErrors::UNKNOWN_DESCRIPTOR;
|
||||
}
|
||||
pwallet->LoadDescriptorScriptPubKeyMan(id, desc);
|
||||
DescriptorScriptPubKeyMan& spkm = pwallet->LoadDescriptorScriptPubKeyMan(id, desc);
|
||||
|
||||
// Prior to doing anything with this spkm, verify ID compatibility
|
||||
if (id != pwallet->GetDescriptorScriptPubKeyMan(desc)->GetID()) {
|
||||
if (id != spkm.GetID()) {
|
||||
strErr = "The descriptor ID calculated by the wallet differs from the one in DB";
|
||||
return DBErrors::CORRUPT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user