OSDN Git Service

Fix bug (#472)
authoripqhjjybj <250657661@qq.com>
Thu, 26 Dec 2019 06:02:49 +0000 (14:02 +0800)
committerPaladz <yzhu101@uottawa.ca>
Thu, 26 Dec 2019 06:02:49 +0000 (14:02 +0800)
* fix bug for vote & normal output

* 修复提交同样的错误交易时,放回成功的bug

Co-authored-by: Colt-Z <453256728@qq.com>
protocol/tx.go

index f863678..b5b4ec5 100644 (file)
@@ -27,9 +27,12 @@ func (c *Chain) ValidateTx(tx *types.Tx) (bool, error) {
                return false, nil
        }
 
-       c.markTransactions(tx)
        bh := c.BestBlockHeader()
-       return c.validateTx(tx, bh)
+       isOrphan, err := c.validateTx(tx, bh)
+       if err == nil {
+               c.markTransactions(tx)
+       }
+       return isOrphan, err
 }
 
 // validateTx validates the given transaction without checking duplication.