forked from TrueCloudLab/neoneo-go
network: do not process state roots below verified height
Implement fast path to skip state root retrieval and decoding.
This commit is contained in:
parent
e2e1bd09ae
commit
caf53740d3
1 changed files with 4 additions and 0 deletions
|
@ -621,7 +621,11 @@ func (s *Server) handleGetRootsCmd(p Peer, gr *payload.GetStateRoots) error {
|
|||
|
||||
// handleStateRootsCmd processees `roots` request.
|
||||
func (s *Server) handleRootsCmd(p Peer, rs *payload.StateRoots) error {
|
||||
h := s.chain.StateHeight()
|
||||
for i := range rs.Roots {
|
||||
if rs.Roots[i].Index <= h {
|
||||
continue
|
||||
}
|
||||
_ = s.chain.AddStateRoot(&rs.Roots[i])
|
||||
}
|
||||
// request more state roots from peer if needed
|
||||
|
|
Loading…
Reference in a new issue