Repository navigation
wallet, rpc: Implements set key label functionality - #36126
polespinasa wants to merge 11 commits into
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36126. ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, 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. |
d7765c4 to
fb1f950
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
5b3c147 to
0009793
Compare
jeanpablojp
left a comment
There was a problem hiding this comment.
Concept ACK
The RPCs call CWallet directly, so the four new interfaces::Wallet methods end up with no caller and no test. The mining RPCs go through interfaces::Mining. Worth the same here?
Built the ten commits and ran the new test.
No, for the wallet we decided in the past to not mix the RPC and the interfaces. |
415119f to
2f54fda
Compare
ca3422f to
2c6734f
Compare
84bb3d9 to
64e1fc6
Compare
3cca6a1 to
8b47c46
Compare
| } | ||
| ret.pushKV("labels", std::move(labels)); | ||
|
|
||
| // Per-key labels keyed by master fingerprint for every key corresponding to this address. |
5a65c79 to
2f1a3d6
Compare
|
Force pushed to address some nits and also re:
Done :) |
|
NACK Unless there was some discussion that I missed, this is not at all what we discussed for key labeling. The key labeling that was discussed is for the GUI only to show friendly names for keys during the multisig setup. Once the setup is complete, the labels would not be shown again, and hence do not need to be stored in the wallet. Also, DO NOT USE FINGERPRINTS, THEY ARE COLLIDABLE. |
|
Shouldn't the key labels be persisted so that at signing time the user can see what keys have and haven't signed? I don't see a good reason to not persist key labels when it seems useful for UX. |
|
Concept ~0 (tending towards NACK) Maybe there's some benefit in showing labels in the GUI but I don't see much benefit in providing RPCs for setting or viewing key labels (both separately and within the context of address(es) RPCs). An organic use case would be the user creating a multi-sig wallet (2-2 or 2-3 or 3-5) and not be importing descriptors separately in that wallet later, so all the addresses of the wallet would involve the keys used to create the wallet. I think we should keep it very simple while implementing a guided multi-sig flow and not make the user go through many steps. |
If we are finally adding some type of key labels, then there should be a way of adding, removing and viewing them using the RPC interface. Because if not, then we are adding something invisible for anyone not using the GUI.
I agree in that, but I don't think this makes the user go through many steps. The RPC is not an interface thought or designed for a user itself but for other applications to consume, normally users should stick to the GUI (if a good one is provided). That is why this PR also adds an interface for the GUI to consume, the GUI should take care of make all this process-easy. I think the debate is more about the concept and if we actually want to store key labels, or not. Are they useful to identify multisig participants, see who is missing to sign, who already signed, etc (#36126 (comment)). Or if that is unnecessary information that the users can handle outside the wallet itself (#36126 (comment)). |
|
A more immediate need is for the end-users to have a guided multi-sig flow in the GUI that's easy to follow. Otherwise there already are (though a bit convoluted) ways for the end-users to setup multi-sig in the wallet. Adding key labels may be beneficial for the end-users using the GUI, I don't see why we need to prioritise for applications (RPCs) right now. Adding the key label is an additional step in a workflow that the GUI doesn't even have right now. That's why my preference to keep things straightforward and get a working multi-sig GUI flow first. It is not mandatory to have multiple people participating in the multi-sig. It is not mandatory to have different signing devices as well in the multi-sig. An end user can just want to have multiple keys created by the core wallet to be participating in the multi-sig wallet and they might not want to have to label each key. And in this scenario, they might not care which keys have signed as long as there are enough signatures. There's a cost to maintaining features over time, and I would rather us not to have to bear the cost of something that might not be used as much. And hence, my reluctance to add this functionality at this stage. |
This PR is not prioritizing RPCs, it is adding an interface for the GUI. At the same time it adds the RPC interface to also consume that functionality as I don't see the reason to have multiple PRs for it.
Didn't understand that from your first message, I agree, this is not a must to allow multisig with the GUI. As said, we should first discuss about if this should be added in the first place as seems that there isn't a consensus regarding the #35645 proposal. I though there was and that's why I opened this PR. IMHO it is a useful feature (it's something I've had before in other wallets and appreciated having, see p.e. Sparrow Wallet) and worth the, in my opinion, not to much burden to maintain. But at the same time, the PR is not in a rush to get merged, so, for me, it is ok to stay open for a while while prioritizing other multisig PRs. Will mark as draft for now until we decide if we want to include labels or not. |
Introduce a new `keylabel` wallet database record that maps a master key fingerprint to an arbitrary label string. This is the persistence layer for per-key labels, stored separately from the per-address name records. Add WalletBatch::WriteKeyLabel/EraseKeyLabel, mirroring other Write/Erase functions. The record is keyed by the fingerprint so that a single label covers every address derived from the same root across all descriptor types.
Add CWallet::m_key_labels, a map from master key fingerprint to label that mirrors the new `keylabel` DB records. Per-key labels augment, do not replace, the per-address labels in m_address_book and never affect the change/receive heuristic in CAddressBookData::IsChange(). Adds accesors for adding and removing key labels.
Also adds DecodeKeyFingerprnt helper function that will be used for multiple RPC introduced in future commits.
2f1a3d6 to
f9af8d7
Compare
|
🐙 This pull request conflicts with the target branch and needs rebase. |


Part of #35645
Adds a key label record to the wallet database so master keys can be identified by a label.
Also adds three new RPC calls,
setkeylabel,getkeylabelandlistkeylabelswhich allow to set, read and list all key labels for master keys.Also adds four new interfaces so the GUI can consume those functionality too and list in, for example, a multisig setup labels associated to the keys. See https://gist.github.com/pseudoramdom/4e14d21a93323217cfe016885285b9aa for a visual example.