OSDN Git Service

fix bug for err tx should not goes into txpool (#605)
authorPaladz <yzhu101@uottawa.ca>
Thu, 12 Apr 2018 06:46:55 +0000 (14:46 +0800)
committerGitHub <noreply@github.com>
Thu, 12 Apr 2018 06:46:55 +0000 (14:46 +0800)
protocol/tx.go

index 7322de1..f17c955 100644 (file)
@@ -43,6 +43,7 @@ func (c *Chain) ValidateTx(tx *types.Tx) (bool, error) {
        gasStatus, err := validation.ValidateTx(tx.Tx, block)
        if gasStatus.GasVaild == false {
                c.txPool.AddErrCache(&tx.ID, err)
+               return false, err
        }
 
        _, err = c.txPool.AddTransaction(tx, err != nil, block.BlockHeader.Height, gasStatus.BTMValue)