-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Wallet: Generate UUID for SQLite wallets #20204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
BDB should have a uuid record too. It can just be the same as the BDB generated id for compatibility, but a unique wallet id should not be at the db level. Adding a uuid record to BDB wallets also means migrating from BDB to SQLite won't change the id. |
@achow101 Migration code just needs to be aware of how BDB stores the unique id. In any case, not related to this PR. |
Disagree. The access to this ID should not be db specific. This id should not be dependent on the underlying database. Furthermore, migration via I think the only db specific thing should be BDB adding the uuid record using the BDB generated id. Otherwise the wallet creation code should add an id if it doesn't exist. This also makes it easy to add future db formats. |
Weak concept NACK. When there's a choice between (1) less code for greater usability and more use-cases and (2) more code for less usability and fewer use-cases, I try to choose (1) I don't see why it should be a problem to make two copies of a wallet and use it for different things. I don't think we should warn when someone does that. I don't think prune locks should use UUIDs. I think they should use wallet names so the locks are more understandable and easily managed by users. Wallet names are already part of the RPC interface, and they must be unique, and they are already a familiar concept to callers. No need to introduce a new concept that doesn't have a good use-case and adds extra code, and then expose it externally through confusing warnings and pruning behavior. I added the first use of BDB fileids in #11429 to avoid data corruption when multiple wallets with the same fileid are loaded into the same environment. There is no similar problem with sqlite and so "Fixes a regression" in the PR description is vague and misleading. |
Debatable, but it currently is as a matter of fact. And again, unrelated to the issue addressed in this PR.
Sounds like a bug in createfromdump... |
What did you have in mind? This is always broken behaviour, and has never been supported...
Wallet names are not unique and can be changed.
Prune locks already have a human-readable description for this purpose. Regardless, it is just one example use case. We cannot reliably restore UUIDs later, but we can always ignore them later if they were to turn out not useful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/wallet/sqlite.cpp
64a2679
to
0c3e94c
Compare
Fixed bug due to key being |
Just basic file management. Maybe I want to make a bunch of wallets with the same password and import different keys into them. Maybe I want some wallets with the same keys. Maybe I want to set up a few wallets together on one machine and them copy them to different machines, and sometimes use them on the same machine again. Nothing impossible to work around, but it's nice for wallets to behave like normal data files and be copyable, and I don't think code should go out of its way to make wallet data more complicated or harder to manage.
It works fine, and I'm not saying go out of the way to add support. I'm saying don't go out of the way to remove support.
It's exhausting to discuss things like this with you Luke! We both understand they are unique at any point in time when they are loaded, and not unique at different points in time if they are unloaded and moved.
👍 If other people think this is a good idea, I'm not here to make an issue of it. Re-iterate weak nack. |
This doesn't remove support for anything at all.
But it's the latter case the UUID is needed to address. |
Approach NACK If we are going to have a wallet id, then support it properly. This means have it in CWallet, have a way to fetch it from CWallet, have the record in Furthermore, this PR is a massive layer violation. While I accept that we will have a layer violation here because of BDB (although I would prefer we don't use the BDB id as a wallet id, @luke-jr insists that we must), the layer violation should be limited to just BDB. It should not be put somewhere that we plan on supporting for a long time. Put the layer violation in the module that's slated for removal. The wallet id should be at the wallet level, not the db level. The only thing that belongs in the db level is writing the BDB unique id as a wallet id record. Having SQLite write a newly generated record is not the correct way to implement a wallet id. #20205 does this correctly. |
Closing in favour of #20205 |
Definitely not, at best they can be a partial solution and maybe help with a type of rename detection. There should be a GUI wallet rename feature and |
@Platinumwrist Why are you spamming all these repos with pseudo-reviews? I went through a few of your recent contributions and it is just spamming open source repos. To seem active on the contributions panel? Stop it. |
@fatso83 yea i hear you not my intention I get it kool |
Fixes a regression from BDB wallets, where BDB generated a unique id for us.
This is needed for #19463, automatic backup reminders, and who knows what else in the future.
Ideally, we should probably also check if another copy of a wallet has already been loaded and warn the user, but that can be a follow-up PR.