From 036304ac53f4feb9876e4332fa41f6ad3119245e Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Tue, 13 Sep 2022 10:38:25 -0700 Subject: [PATCH 1/2] Revert "wallet: rescan 2 days past the birthday block" This reverts commit af824600756ba5605d86be3a5b263a3e602a3c1d. The 48-hour margin has been set in the waddrmgr.Create() right before written to the databasw. --- wallet/chainntfns.go | 4 +--- wallet/wallet.go | 9 ++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/wallet/chainntfns.go b/wallet/chainntfns.go index 96d479c..edad9e9 100644 --- a/wallet/chainntfns.go +++ b/wallet/chainntfns.go @@ -480,9 +480,7 @@ func birthdaySanityCheck(chainConn chainConn, // Otherwise, we'll attempt to locate a better one now that we have // access to the chain. - // 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) + newBirthdayBlock, err := locateBirthdayBlock(chainConn, birthdayTimestamp) if err != nil { return nil, err } diff --git a/wallet/wallet.go b/wallet/wallet.go index 12e0531..3b3e5c7 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -371,11 +371,10 @@ 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 { - - // 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) + var err error + birthdayStamp, err = locateBirthdayBlock( + chainClient, w.Manager.Birthday(), + ) if err != nil { return fmt.Errorf("unable to locate birthday block: %v", err) -- 2.45.2 From 6fb2ed154a7c34d8fd510f4aade4ae5ba82691ee Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Tue, 13 Sep 2022 10:43:16 -0700 Subject: [PATCH 2/2] test: update birthday related tests --- wallet/chainntfns_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/chainntfns_test.go b/wallet/chainntfns_test.go index 98f5015..7b2d77d 100644 --- a/wallet/chainntfns_test.go +++ b/wallet/chainntfns_test.go @@ -16,7 +16,7 @@ import ( const ( // defaultBlockInterval is the default time interval between any two // blocks in a mocked chain. - defaultBlockInterval = 10 * time.Minute + defaultBlockInterval = 150 * time.Second ) var ( -- 2.45.2