From af824600756ba5605d86be3a5b263a3e602a3c1d Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Fri, 19 Aug 2022 16:38:39 -0700 Subject: [PATCH] wallet: rescan 2 days past the birthday block --- wallet/chainntfns.go | 4 +++- wallet/wallet.go | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/wallet/chainntfns.go b/wallet/chainntfns.go index edad9e9..96d479c 100644 --- a/wallet/chainntfns.go +++ b/wallet/chainntfns.go @@ -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 } diff --git a/wallet/wallet.go b/wallet/wallet.go index 3b3e5c7..12e0531 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -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)