From 3b4dde05c373ccc06d68bd04263ba7c46e846de2 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Sat, 27 Mar 2021 00:32:15 +0300 Subject: [PATCH] stateroot: handle ErrStateMismatch internally It's a local problem and returning error from here leads to peer disconnect that isn't solving anything. --- pkg/services/stateroot/service.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/services/stateroot/service.go b/pkg/services/stateroot/service.go index d8ebc4249..ba3a35998 100644 --- a/pkg/services/stateroot/service.go +++ b/pkg/services/stateroot/service.go @@ -9,6 +9,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/core/block" "github.com/nspcc-dev/neo-go/pkg/core/blockchainer" "github.com/nspcc-dev/neo-go/pkg/core/state" + "github.com/nspcc-dev/neo-go/pkg/core/stateroot" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/network/payload" @@ -107,7 +108,12 @@ func (s *service) OnPayload(ep *payload.Extensible) error { if sr.Index == 0 { return nil } - return s.AddStateRoot(sr) + err := s.AddStateRoot(sr) + if errors.Is(err, stateroot.ErrStateMismatch) { + s.log.Error("can't add SV-signed state root", zap.Error(err)) + return nil + } + return err case VoteT: v := m.Payload.(*Vote) return s.AddSignature(v.Height, v.ValidatorIndex, v.Signature)