mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-23 03:38:35 +00:00
consensus: fix error checking in decoders
Spotted by errcheck.
This commit is contained in:
parent
99108c620f
commit
4caff35e73
2 changed files with 9 additions and 10 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue