mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-13 15:45:01 +00:00
network: prevent useless getroots requests
At the height of A we only reliably have a state root for A-1, so there is no point in requesting state root for A from our peers. Prevents tons of useless traffic: 2020-08-10T00:02:35.537+0300 DEBUG got msg {"addr": "127.0.0.1:20333", "type": "getroots"} 2020-08-10T00:02:35.537+0300 DEBUG got msg {"addr": "127.0.0.1:20333", "type": "roots"} 2020-08-10T00:02:35.537+0300 DEBUG got msg {"addr": "127.0.0.1:20333", "type": "getroots"} 2020-08-10T00:02:35.537+0300 DEBUG got msg {"addr": "127.0.0.1:20333", "type": "roots"} 2020-08-10T00:02:35.539+0300 DEBUG got msg {"addr": "127.0.0.1:20335", "type": "getroots"} 2020-08-10T00:02:35.539+0300 DEBUG got msg {"addr": "127.0.0.1:20335", "type": "roots"} 2020-08-10T00:02:35.539+0300 DEBUG got msg {"addr": "127.0.0.1:20334", "type": "getroots"} 2020-08-10T00:02:35.539+0300 DEBUG got msg {"addr": "127.0.0.1:20334", "type": "roots"} 2020-08-10T00:02:35.540+0300 DEBUG got msg {"addr": "127.0.0.1:20334", "type": "getroots"} 2020-08-10T00:02:35.540+0300 DEBUG got msg {"addr": "127.0.0.1:20334", "type": "roots"} 2020-08-10T00:02:35.542+0300 DEBUG got msg {"addr": "127.0.0.1:20336", "type": "getroots"} 2020-08-10T00:02:35.542+0300 DEBUG got msg {"addr": "127.0.0.1:20336", "type": "roots"}
This commit is contained in:
parent
253c39d4ee
commit
ab7a69bfec
1 changed files with 1 additions and 1 deletions
|
@ -657,7 +657,7 @@ func (s *Server) requestStateRoot(p Peer) error {
|
||||||
if diff := hdrHeight - stateHeight; diff < count {
|
if diff := hdrHeight - stateHeight; diff < count {
|
||||||
count = diff
|
count = diff
|
||||||
}
|
}
|
||||||
if count == 0 {
|
if count <= 1 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
gr := &payload.GetStateRoots{
|
gr := &payload.GetStateRoots{
|
||||||
|
|
Loading…
Reference in a new issue