Skip to content

Commit

Permalink
wallet: rescan 2 days past the birthday block
Browse files Browse the repository at this point in the history
  • Loading branch information
roylee17 committed Aug 20, 2022
1 parent 40f7d7c commit af82460
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion wallet/chainntfns.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,9 @@ func birthdaySanityCheck(chainConn chainConn,

// Otherwise, we'll attempt to locate a better one now that we have
// access to the chain.
newBirthdayBlock, err := locateBirthdayBlock(chainConn, birthdayTimestamp)
// To be on the safe side, scan 2 days past of the actual timestamp.
bday := birthdayTimestamp.Add(48 * time.Hour)
newBirthdayBlock, err := locateBirthdayBlock(chainConn, bday)
if err != nil {
return nil, err
}
Expand Down
9 changes: 5 additions & 4 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,11 @@ func (w *Wallet) syncWithChain(birthdayStamp *waddrmgr.BlockStamp) error {

// If we've yet to find our birthday block, we'll do so now.
if birthdayStamp == nil {
var err error
birthdayStamp, err = locateBirthdayBlock(
chainClient, w.Manager.Birthday(),
)

// To be on the safe side, scan 2 days past of the actual
// timestamp.
bday := w.Manager.Birthday().Add(48 * time.Hour)
birthdayStamp, err = locateBirthdayBlock(chainClient, bday)
if err != nil {
return fmt.Errorf("unable to locate birthday block: %v",
err)
Expand Down

0 comments on commit af82460

Please sign in to comment.