From 95630b72e8dcf7be5f7574b72e9ac944de93de50 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Thu, 15 Oct 2020 16:52:45 +0300 Subject: [PATCH] core: verify transaction attributes before adding it into mempool Attributes check should be done before adding transaction to the pool, otherwise there might be a case when transaction with invalid attributes is in the pool. --- pkg/core/blockchain.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 83f36bd13..4994642eb 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -1234,6 +1234,9 @@ func (bc *Blockchain) verifyAndPoolTx(t *transaction.Transaction, pool *mempool. if err != nil { return err } + if err := bc.verifyTxAttributes(t); err != nil { + return err + } err = pool.Add(t, bc) if err != nil { switch { @@ -1249,9 +1252,6 @@ func (bc *Blockchain) verifyAndPoolTx(t *transaction.Transaction, pool *mempool. return err } } - if err := bc.verifyTxAttributes(t); err != nil { - return err - } return nil }