4484 | @@ -4485,6 +4485,21 @@ void CWallet::LoadActiveScriptPubKeyMan(uint256 id, OutputType type, bool intern
4485 | NotifyCanGetAddressesChanged();
4486 | }
4487 |
4488 | +void CWallet::DeactivateScriptPubKeyMan(uint256 id, OutputType type, bool internal)
4489 | +{
4490 | + WalletLogPrintf("Deactivate spkMan: id = %s, type = %d, internal = %d\n", id.ToString(), static_cast<int>(type), static_cast<int>(internal));
4491 | + WalletBatch batch(*database);
4492 | + if (!batch.EraseActiveScriptPubKeyMan(static_cast<uint8_t>(type), internal)) {
It's erasing a spkm of the same output type because the user is importing an inactive descriptor of the same output type? Am I reading this right?
🤦 Yes, unfortunately, you are correct. Another issue is that I can't fix this PR on it's own. I was under impression it can be separate from #19651 but alas. I can't just move EraseActiveScriptPubKeyMan under if (spk_mans[type] && spk_mans[type]->GetID() == id) because the map of active spk managers has been cleared already by this point. So it's impossible to know whether we need to write anything to the disk.
I'll fix this and combine with #19651 where I'm trying to make importdescriptors command do proper updates. Would you mind reviewing that instead?
ill subscribe to that PR, sure!