X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=blobdiff_plain;f=protocol%2Ftx.go;h=966b292fb41fc3c18ebca60a9da9ed334d96622e;hp=6eadc3acf27c360cc2b9a9642228e7213205dcdb;hb=23a183040a74bb684d3a036ef26b1d90c4af76b6;hpb=74cf033ce4ad67ac46b3cc6375582a13a5f38a0d diff --git a/protocol/tx.go b/protocol/tx.go index 6eadc3ac..966b292f 100644 --- a/protocol/tx.go +++ b/protocol/tx.go @@ -27,6 +27,17 @@ func (c *Chain) GetTransactionsUtxo(view *state.UtxoViewpoint, txs []*bc.Tx) err // 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) }