Skip to content

Commit 4f25d93

Browse files
committed
fix: loosen condition about P2PK / P2PKH scripts for non-hd imported keys
1 parent dd20121 commit 4f25d93

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/wallet/scriptpubkeyman.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,11 +1940,13 @@ std::optional<MigrationData> LegacyScriptPubKeyMan::MigrateToDescriptor()
19401940
desc_spk_man->TopUp();
19411941
auto desc_spks = desc_spk_man->GetScriptPubKeys();
19421942

1943-
// Remove the scriptPubKeys from our current set
1943+
// Erase every script form combo just produced from the tracking set.
1944+
// Legacy GetScriptPubKeys only enumerates P2PK and P2PKH for loose
1945+
// keys (Dash has no segwit, so LearnRelatedScripts never inserts the
1946+
// P2SH-P2PKH form into mapScripts), so the third script combo emits
1947+
// is not in `spks` — only erase what's there.
19441948
for (const CScript& spk : desc_spks) {
1945-
size_t erased = spks.erase(spk);
1946-
assert(erased == 1);
1947-
assert(IsMine(spk) == ISMINE_SPENDABLE);
1949+
spks.erase(spk);
19481950
}
19491951

19501952
out.desc_spkms.push_back(std::move(desc_spk_man));

0 commit comments

Comments
 (0)