mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
[NOD-1020] Do send addr response to getaddr messages even if there aren't any addresses to send. (#740)
This commit is contained in:
parent
3a22249be9
commit
2d798a5611
@ -755,18 +755,12 @@ func (p *Peer) localVersionMsg() (*wire.MsgVersion, error) {
|
||||
// addresses. This function is useful over manually sending the message via
|
||||
// QueueMessage since it automatically limits the addresses to the maximum
|
||||
// number allowed by the message and randomizes the chosen addresses when there
|
||||
// are too many. It returns the addresses that were actually sent and no
|
||||
// message will be sent if there are no entries in the provided addresses slice.
|
||||
// are too many. It returns the addresses that were actually sent.
|
||||
//
|
||||
// This function is safe for concurrent access.
|
||||
func (p *Peer) PushAddrMsg(addresses []*wire.NetAddress, subnetworkID *subnetworkid.SubnetworkID) ([]*wire.NetAddress, error) {
|
||||
addressCount := len(addresses)
|
||||
|
||||
// Nothing to send.
|
||||
if addressCount == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
msg := wire.NewMsgAddr(false, subnetworkID)
|
||||
msg.AddrList = make([]*wire.NetAddress, addressCount)
|
||||
copy(msg.AddrList, addresses)
|
||||
|
Loading…
x
Reference in New Issue
Block a user