HomePhabricator

[electrum] only increment the aux key index if we know it has been used

Description

[electrum] only increment the aux key index if we know it has been used

Summary:
Instead of incrementing the index everytime a key is displayed, only increment it when a proof is signed or a delegation is generated with the suggested key.
This will avoid burning keys when using the proof editor just to inspect some proof and make the key detection more reliable (less likely to cross the gap limit) when loading a proof generated by this wallet.

Depends on D14803

Test Plan:
Open the "Auxiliary keys" dialog multiple times, check that the key is no longer incremented each time.
Open the Proof editor, check that the key is the same as the one currently shown by default in the keys dialog. Close and reopen the Proof editor, nothing changes.
Generate a proof with the suggested key, check that now the index has been incremented.
Open the delegation editor, generate a delegated key using the suggested one. Check again that this does not affect the index. Generate a delegation with the suggested key, check that the index is now incremented.

Load a proof whose master key is not from this wallet, check that generating the (unsigned) proof does not increment the index.
Generate a proof with a WIF key that does not belong to this wallet, check that the index is not incremented.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14804

Details

Provenance
PiRKAuthored on Nov 16 2023, 14:48
PiRKPushed on Nov 17 2023, 12:44
Reviewer
Restricted Project
Differential Revision
D14804: [electrum] only increment the aux key index if we know it has been used
Parents
rABC201b71123c21: [electrum] fix auxiliary key dialog initialization on first use
Branches
Unknown
Tags
Unknown