wallet: rescan 2 days past the birthday block

This commit is contained in:
Roy Lee 2022-08-19 16:38:39 -07:00
parent 40f7d7cefe
commit af82460075
2 changed files with 8 additions and 5 deletions

View file

@ -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
}

View file

@ -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)