From 65bf0d01d5d358c78c04e741bf143b7108c3cee4 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 27 Nov 2019 13:12:04 +0300 Subject: [PATCH] transaction: don't hide decoding error by logging Unknown transaction types are wrong and should be treated as errors. --- pkg/core/transaction/transaction.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/core/transaction/transaction.go b/pkg/core/transaction/transaction.go index aefeb8c7b..36443ec3b 100644 --- a/pkg/core/transaction/transaction.go +++ b/pkg/core/transaction/transaction.go @@ -1,10 +1,11 @@ package transaction import ( + "fmt" + "github.com/CityOfZion/neo-go/pkg/crypto/hash" "github.com/CityOfZion/neo-go/pkg/io" "github.com/CityOfZion/neo-go/pkg/util" - log "github.com/sirupsen/logrus" ) const ( @@ -137,7 +138,7 @@ func (t *Transaction) decodeData(r *io.BinReader) { t.Data = &StateTX{} t.Data.(*StateTX).DecodeBinary(r) default: - log.Warnf("invalid TX type %s", t.Type) + r.Err = fmt.Errorf("invalid TX type %x", t.Type) } }