From 8a457ef54081fdb9504d5f8626f59203db0ac31c Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 23 Sep 2019 20:26:53 +0300 Subject: [PATCH] transaction: add a check for createHash() invocation It should work in general. --- pkg/core/transaction/transaction.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/core/transaction/transaction.go b/pkg/core/transaction/transaction.go index 12e90e7dd..1d9db3349 100644 --- a/pkg/core/transaction/transaction.go +++ b/pkg/core/transaction/transaction.go @@ -62,7 +62,9 @@ func NewTrimmedTX(hash util.Uint256) *Transaction { // Hash return the hash of the transaction. func (t *Transaction) Hash() util.Uint256 { if t.hash.Equals(util.Uint256{}) { - t.createHash() + if t.createHash() != nil { + panic("failed to compute hash!") + } } return t.hash } @@ -70,7 +72,9 @@ func (t *Transaction) Hash() util.Uint256 { // VerificationHash returns the hash of the transaction used to verify it. func (t *Transaction) VerificationHash() util.Uint256 { if t.verificationHash.Equals(util.Uint256{}) { - t.createHash() + if t.createHash() != nil { + panic("failed to compute hash!") + } } return t.verificationHash }