Skip to content

Commit

Permalink
[lbry] wire: limit the blocks of getdata message
Browse files Browse the repository at this point in the history
In the cuurent codebase, OnGetData() handler penalizes / ban peers
requesting large blocks.

  server.go:
  @@ -649,7 +649,7 @@ func (sp *serverPeer) OnGetData(_ *peer.Peer, msg *wire.MsgGetData) {
          // bursts of small requests are not penalized as that would potentially ban
          // peers performing IBD.
          // This incremental score decays each minute to half of its value.
          if sp.addBanScore(0, uint32(length)*99/wire.MaxInvPerMsg, "getdata") {
                  return
          }

This accidentally penalize nodes trying to catch up checkpoints whose
'getdata' requests would be as large as the wire.MaxInvPerMsg, and get
banned very soon.

This patch limit getdata request to wire.MaxInvPerMsg/99 blocks.
  • Loading branch information
roylee17 committed May 26, 2022
1 parent 4a8d390 commit e48200f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion netsync/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ func (sm *SyncManager) fetchHeaderBlocks() {
numRequested++
}
sm.startHeader = e.Next()
if numRequested >= wire.MaxInvPerMsg {
if numRequested >= wire.MaxInvPerMsg/99 {
break
}
}
Expand Down

0 comments on commit e48200f

Please sign in to comment.