mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-05 03:06:16 +00:00
payload: limit the number of possible addresses
This commit is contained in:
parent
0120a8f239
commit
5abec520c7
2 changed files with 7 additions and 4 deletions
|
@ -29,7 +29,6 @@ const (
|
|||
defaultAttemptConnPeers = 20
|
||||
defaultMaxPeers = 100
|
||||
maxBlockBatch = 200
|
||||
maxAddrsToSend = 200
|
||||
minPoolCount = 30
|
||||
)
|
||||
|
||||
|
@ -690,8 +689,8 @@ func (s *Server) handleAddrCmd(p Peer, addrs *payload.AddressList) error {
|
|||
// handleGetAddrCmd sends to the peer some good addresses that we know of.
|
||||
func (s *Server) handleGetAddrCmd(p Peer) error {
|
||||
addrs := s.discovery.GoodPeers()
|
||||
if len(addrs) > maxAddrsToSend {
|
||||
addrs = addrs[:maxAddrsToSend]
|
||||
if len(addrs) > payload.MaxAddrsCount {
|
||||
addrs = addrs[:payload.MaxAddrsCount]
|
||||
}
|
||||
alist := payload.NewAddressList(len(addrs))
|
||||
ts := time.Now()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue