-
Notifications
You must be signed in to change notification settings - Fork 278
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
wallet: deep clean #511
wallet: deep clean #511
Conversation
Pull Request Test Coverage Report for Build 461467296
💛 - Coveralls |
I wrote a bash script here: https://gist.github.com/pinheadmz/a25a58a4bea13a88035cf1899f7c3e15
Here's the exciting conclusion:
|
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.
This makes sense to me and looks generally reasonable. Not sure what the approve process is, so just leaving the review as 'Comment', but there's nothing blocking as far as I can tell.
@turbomaze asked me to take a look, btw, if you're wondering about the random reviewer.
Just to add my 2c, have tested deep rescans somewhat extensively on local regtest wallets, on small mainnet wallets, and also some larger mainnet wallets. Have not encountered any issues! |
walletDB deepClean(): - deletes all mapping of blocks, outpoints and tx hashes to wallet ids - deletes ENTIRE txdb (all history, all balance data, for all wallets) - keeps all account metadata (account name, type, address depth, etc) - keeps all name->wallet ID mapping (although this may be unnecessary) - keeps all address-hash path mapping (addresses from all accounts) wallet HTTP /deepclean: - requires admin token, like /rescan - requires setting parameter `I_HAVE_BACKED_UP_MY_WALLET` to `true`
@RevCBH @turbomaze This PR has been updated! (finally!) It's not |
This is a sample of the debug log output when Deep Clean is run:
|
Just tried it on my mainnet wallet, with a lot of transfer and finalize in it and negative balance. Seems to work well.
after
|
const key = 'v'.charCodeAt(); | ||
const prefix = layout.t.encode(wid); | ||
await removeRange({ | ||
gte: Buffer.concat([prefix, Buffer.alloc(1)]), |
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.
Is this supposed to be a 1
or a 0
?
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.
It "should" be a single 0x00
byte buffer. This code will remove everything in the txdb up to the blinds. The next snippet removes everything in the txdb after the blinds:
Removed: 0x00 -> v
and v -> 0xff
Closes #467
Requires #512 (CI tests will fail until rebase)✅This will likely be required for users with walletDB corruption due to the
CLAIM->REGISTER
bug (#454) and/or theFINALIZE
bug (#464)walletDB deepClean():
wallet HTTP /deepclean:
I_HAVE_BACKED_UP_MY_WALLET
totrue
A deep clean does not automatically initiate a rescan -- but one must be initiated by the user after deep clean is complete.
TODO: