// per-transaction validation results and is consulted before
// performing full validation.
func (c *Chain) ValidateTx(tx *types.Tx) (bool, error) {
+ if c.hasSeenTx(tx) {
+ return false, nil
+ }
+
+ c.markTransactions(tx)
+
+ return c.validateTx(tx)
+}
+
+// validateTx validates the given transaction without checking duplication.
+func (c *Chain) validateTx(tx *types.Tx) (bool, error) {
if ok := c.txPool.HaveTransaction(&tx.ID); ok {
return false, c.txPool.GetErrCache(&tx.ID)
}