Closed JoeGruffins closed 1 month ago
I'm not sure if I need to do anything for the rescans. They will start from zero by default but you can set a block header or height. Should the birthday info be included in walletinfo or a new rpc call to help there?
I'm not sure if I need to do anything for the rescans. They will start from zero by default but you can set a block header or height. Should the birthday info be included in walletinfo or a new rpc call to help there?
Yeah, I'm pretty sure you want both account/address discovery and rescans to start from the birthday (when it is set) for performance reasons, unless a specific block height/hash has been specified on a particular rescan call.
Yeah, I'm pretty sure you want both account/address discovery and rescans to start from the birthday (when it is set) for performance reasons, unless a specific block height/hash has been specified on a particular rescan call.
Hard to do this without changing a lot I think. Default height is zero so there's not a way to differentiate between default height and if a user really wants to rescan from zero. They may want to rescan before the birthday for example if some data was imported into the wallet.
I guess we can have -1 be a special case? Would that be ok?
@matheusd Just one birthstate now. Added the 24 hour buffer. It is missing a lot of comments.
Still unsure:
I guess I will try adding the birthblock to walletinfo? imo that is enough, but we can do more... now or later.
~I haven't had a chance to test with the last changes so converted to draft temporarily.~
Added allowing restoring from block to the prompt. Moved the birthday verification there. Added methods for rpc and grpc to see the birthday https://github.com/decred/dcrwallet/compare/1486597870ae26b392ded4fd46648f96e8c3db10..9449b2c2fe8fb3ce846b87f891209f1b0a8dc7c5
Is this ready for testing or are you planning on adding any other features to this? Asking so I can start functional testing on it...
Is this ready for testing or are you planning on adding any other features to this? Asking so I can start functional testing on it...
Yes it is ready. I don't plan to add anything unless requested.
I could add a unit test for the db functions SetBirthState and BirthState. I have one half made.
Just to double check, but additional rescanwallet with no arguments will NOT rely on the birthday to perform the rescan, right? It will be up to the users to call walletinfo and then use the birthblock as argument to ensure the rescan only goes through blocks after the birthblock.
Yes that keeps this pr simple. I think this work can still be done though if necessary. As I said I think this will require changes to both the grpc and rpc api to distinguish between a rescan from the height 0 and from birthday.
Just rebased.
Added a db upgrade https://github.com/decred/dcrwallet/compare/475cabd342ed69e40b9b31831a187837c24358f3..70da522eb5cb5163e44d3091a217c0bde51f9804
I changed that one spot for spv wallets that you showed and looking if there are others... Are there other spots that need changing in chainntfs.go
?
This is looking pretty good:
Time to discover accounts and addresses (mainnet, empty wallet)
Without birthday: 1m38s
With birthday: 315ms
One more thing I remembered is adding the birthday ({time,height}) to the CreateWallet
gRPC endpoint. This will then allow me to pass this info from dcrlnd when creating new wallets from there.
Add time and height params to the createwallet grpc request https://github.com/decred/dcrwallet/compare/70da522eb5cb5163e44d3091a217c0bde51f9804..47e49d626db7d68ed51d51fc409e04fa5bd66116
Also change the main if block to exclude block zero although it seems to always start from block one anyhow
closes #2346 closes #320