OSDN Git Service

Merge pull request #473 from Bytom/master
authorPaladz <yzhu101@uottawa.ca>
Thu, 26 Dec 2019 06:46:26 +0000 (14:46 +0800)
committerGitHub <noreply@github.com>
Thu, 26 Dec 2019 06:46:26 +0000 (14:46 +0800)
Fix bug (#472)

protocol/tx.go

index 8822b1d..3c33737 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.