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.
This commit is contained in:
Anna Shaleva 2020-10-15 16:52:45 +03:00
parent a6579a05ac
commit 95630b72e8

View file

@ -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
}