Skip to content
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

btc spv: fix wallet birthday #1249

Merged
merged 2 commits into from
Oct 26, 2021
Merged

btc spv: fix wallet birthday #1249

merged 2 commits into from
Oct 26, 2021

Conversation

buck54321
Copy link
Member

Begin wallet scan from the day the hd keys PR was merged, before any app seeds existed.

Comment on lines 956 to 963
case noteI := <-notes:
switch note := noteI.(type) {
case chain.FilteredBlockConnected:
reportTip := atomic.LoadInt64(&lastReportedTip)
if int64(note.Block.Height) < reportTip {
w.log.Errorf("neutrino sent block notification after polling had already seen and sent the tipChange")
}
}
Copy link
Member Author

@buck54321 buck54321 Oct 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to tear this lastReportedTip stuff out. I just wanted to have it here for discussion. I do see a ton of these messages printed on initial testnet sync, but I haven't ruled out that it's just this loop getting backed up. The other evidence for this in the wild is that refunds have been observed apparently taking an extra block to be reflected in the wallet balance. Similarly, after a restoration from seed with the fix in this PR, some funds I deposited into my testnet wallet days ago didn't appear until an additional block was mined. Checking the logs, there were a lot of neutrino sent block notification after polling... error messages for the last blocks scanned during the initial sync.

@buck54321 buck54321 marked this pull request as draft October 23, 2021 13:01
@@ -473,6 +474,12 @@ func (d *Driver) Info() *asset.WalletInfo {
}

func init() {
var err error
walletBirthday, err = time.Parse(time.RFC822, "21 Oct 21 18:01 CDT")
Copy link
Member

@chappjc chappjc Oct 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure you won't want to make this a few weeks earlier? PR open and PR merge are both pre-release anyway, so might as well keep our testnet wallets fully rescanable. I know I have one with a non-zero balance on this merge date.

That makes me wonder if we'll need a "rescan wallet" function. I'd be pretty surprised if we don't given how often that is a recommended action for wallets of all kinds. Reseeding the entire dex app would be a very inconvenient way to achieve this. The Rescan method would not even need to be part of the standard Wallet interface since it's not likely something we'd want to do with external wallets, just a bonus method we can detect by type asserting as a Rescanner interface.

Final thought on the subject is, Core should provide an export wallet seed function so users can recover funds outside of dex, assuming the external software follows the same derivation paths (but at least they could use other tools to derive keys for the correct path assuming we document it, and we should). I feel quite strongly about this despite it being a potential footgun for users, but it's no more of a risk than with external wallets and we've had that up until now. I think I'd probably make a cli app to take an app seed and asset ID to do this regardless.

Anyway, these rescan wallet and export wallet seed ideas are not relevant for this PR, just thoughts.

@buck54321 buck54321 marked this pull request as ready for review October 26, 2021 09:44
@chappjc chappjc merged commit d808492 into decred:master Oct 26, 2021
@chappjc chappjc added this to the 0.4 milestone Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants