Skip to content

Commit

Permalink
spv: Remove peer disconnection logic
Browse files Browse the repository at this point in the history
The p2p package already ensures peers are dropped if they are behind the
wallet's main chain tip height, therefore this check is redundant in the
spv syncer.
  • Loading branch information
matheusd committed Nov 16, 2023
1 parent 5216b45 commit 10c7b17
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions spv/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,9 @@ func (s *Syncer) getHeaders(ctx context.Context, rp *p2p.RemotePeer) error {

s.sidechainMu.Unlock()

// Any new peers should not be significantly behind the new tip.
s.setRequiredHeight(int32(tip.Header.Height))

// Generate new locators
s.locatorMu.Lock()
locators, err = s.wallet.BlockLocators(ctx, nil)
Expand All @@ -1509,13 +1512,6 @@ func (s *Syncer) getHeaders(ctx context.Context, rp *p2p.RemotePeer) error {
}

func (s *Syncer) startupSync(ctx context.Context, rp *p2p.RemotePeer) error {
// Disconnect from the peer if their advertised block height is
// significantly behind the wallet's.
_, tipHeight := s.wallet.MainChainTip(ctx)
if rp.InitialHeight() < tipHeight-6 {
return errors.E("peer is not synced")
}

// Continue with fetching headers only after missing cfilters have
// been fetched.
select {
Expand Down

0 comments on commit 10c7b17

Please sign in to comment.