Skip to content

Commit

Permalink
server: Make sure the peer address exists in the manager.
Browse files Browse the repository at this point in the history
  • Loading branch information
dajohi authored and davecgh committed Oct 22, 2022
1 parent 01b05fd commit 0a0cc3b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,13 @@ func (sp *serverPeer) OnVersion(_ *peer.Peer, msg *wire.MsgVersion) {
remoteAddr := wireToAddrmgrNetAddress(sp.NA())
addrManager := sp.server.addrManager
if !cfg.SimNet && !cfg.RegNet && !isInbound {
// Be sure the address exists in the address manager.
addrManager.AddAddresses([]*addrmgr.NetAddress{remoteAddr},
remoteAddr)

err := addrManager.SetServices(remoteAddr, msg.Services)
if err != nil {
srvrLog.Debugf("Setting services for address failed: %v", err)
srvrLog.Errorf("Setting services for address failed: %v", err)
}
}

Expand Down Expand Up @@ -777,7 +781,7 @@ func (sp *serverPeer) OnVersion(_ *peer.Peer, msg *wire.MsgVersion) {
// Mark the address as a known good address.
err := addrManager.Good(remoteAddr)
if err != nil {
srvrLog.Debugf("Marking address as good failed: %v", err)
srvrLog.Errorf("Marking address as good failed: %v", err)
}
}

Expand Down

0 comments on commit 0a0cc3b

Please sign in to comment.