Skip to content

Conversation

@S3RK
Copy link
Contributor

@S3RK S3RK commented Aug 21, 2020

Rationale: allow to deactivate wallet descriptor

Currently, it's not possible to deactivate wallet descriptor, active argument is just silently ignored if set to false. When descriptor is deactivated it's still present in the wallet, but can't be used to derive new addresses.

Follow up for #19651

@achow101
Copy link
Member

ACK 4deb2ef

@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

{
WalletLogPrintf("Deactivate spkMan: id = %s, type = %d, internal = %d\n", id.ToString(), static_cast<int>(type), static_cast<int>(internal));
WalletBatch batch(*database);
if (!batch.EraseActiveScriptPubKeyMan(static_cast<uint8_t>(type), internal)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦 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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ill subscribe to that PR, sure!

@S3RK
Copy link
Contributor Author

S3RK commented Aug 27, 2020

Closed in favor of #19651

@S3RK S3RK closed this Aug 27, 2020
@S3RK S3RK deleted the wallet_deactivate_descriptor branch September 25, 2020 02:08
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants