mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 00:34:01 +02:00
Merge bitcoin/bitcoin#27920: wallet: bugfix, always use apostrophe for spkm descriptor ID
5df988b534test: add coverage for descriptor ID (furszy)6a9510d2dawallet: bugfix, always use apostrophe for spkm descriptor ID (furszy)97a965d98frefactor: extract descriptor ID calculation from spkm GetID() (furszy)1d207e3931wallet: do not allow loading descriptor with an invalid ID (furszy) Pull request description: Aiming to fix #27915. As we re-write the descriptor's db record every time that the wallet is loaded (at `TopUp` time), if the spkm ID differs from the one in db, the wallet will enter in an unrecoverable corruption state (due to the storage of a descriptor with an ID that is not linked to any other descriptor record in DB), and no soft version will be able to open it anymore. Because we cannot change the past, to stay compatible between releases, we need to always use the apostrophe version for the spkm IDs. ACKs for top commit: achow101: ACK5df988b534Sjors: tACK5df988b534Tree-SHA512: f63fc4aac7d21a4e515657471758d28857575e751865bfa359298f8b89b2568970029ca487a873c1786a5716325f453f06cd417ed193f3366417f6e8c2987332
This commit is contained in:
@@ -803,6 +803,12 @@ static DBErrors LoadDescriptorWalletRecords(CWallet* pwallet, DatabaseBatch& bat
|
||||
}
|
||||
pwallet->LoadDescriptorScriptPubKeyMan(id, desc);
|
||||
|
||||
// Prior to doing anything with this spkm, verify ID compatibility
|
||||
if (id != pwallet->GetDescriptorScriptPubKeyMan(desc)->GetID()) {
|
||||
strErr = "The descriptor ID calculated by the wallet differs from the one in DB";
|
||||
return DBErrors::CORRUPT;
|
||||
}
|
||||
|
||||
DescriptorCache cache;
|
||||
|
||||
// Get key cache for this descriptor
|
||||
|
||||
Reference in New Issue
Block a user