Skip to content

Commit

Permalink
Do not send reject messages for bad services
Browse files Browse the repository at this point in the history
The reject message is deprecated, and has also been removed from the most
recent protocol version entirely.

Although the reject could be sent after a check of the negotiated pver,
there's no value to sending a reject to a peer for bad advertised services.
No message was ever rejected from being received by the remote peer.
  • Loading branch information
jrick committed Jan 23, 2024
1 parent ab6da24 commit 5a412fb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions p2p/peering.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,8 @@ func (lp *LocalPeer) ConnectOutbound(ctx context.Context, addr string, reqSvcs w
// Disconnect from the peer if it does not specify all required services.
if rp.services&reqSvcs != reqSvcs {
op := errors.Opf(opf, rp.raddr)
reason := errors.Errorf("missing required service flags %v", reqSvcs&^rp.services)
reject := wire.NewMsgReject(wire.CmdVersion, wire.RejectNonstandard, reason.Error())
rp.sendMessageAck(ctx, reject)

err := errors.E(op, reason)
err := errors.E(op, errors.Errorf("missing required service flags %v",
reqSvcs&^rp.services))
rp.Disconnect(err)
return nil, err
}
Expand Down

0 comments on commit 5a412fb

Please sign in to comment.