diff --git a/pkg/consensus/consensus.go b/pkg/consensus/consensus.go index b6cb8cc07..9bb26483a 100644 --- a/pkg/consensus/consensus.go +++ b/pkg/consensus/consensus.go @@ -373,7 +373,12 @@ func (s *service) payloadFromExtensible(ep *npayload.Extensible) *Payload { func (s *service) OnPayload(cp *npayload.Extensible) { log := s.log.With(zap.Stringer("hash", cp.Hash())) p := s.payloadFromExtensible(cp) - p.decodeData() + // decode payload data into message + if err := p.decodeData(); err != nil { + log.Info("can't decode payload data", zap.Error(err)) + return + } + if !s.validatePayload(p) { log.Info("can't validate payload") return @@ -384,14 +389,6 @@ func (s *service) OnPayload(cp *npayload.Extensible) { return } - // decode payload data into message - if p.message.payload == nil { - if err := p.decodeData(); err != nil { - log.Info("can't decode payload data") - return - } - } - s.messages <- *p } diff --git a/pkg/consensus/payload.go b/pkg/consensus/payload.go index f06d0a54c..2d17938ea 100644 --- a/pkg/consensus/payload.go +++ b/pkg/consensus/payload.go @@ -151,7 +151,9 @@ func (p *Payload) Hash() util.Uint256 { // DecodeBinary implements io.Serializable interface. func (p *Payload) DecodeBinary(r *io.BinReader) { p.Extensible.DecodeBinary(r) - p.decodeData() + if r.Err == nil { + r.Err = p.decodeData() + } } // EncodeBinary implements io.Serializable interface.