OSDN Git Service

filter out known txs (#280)
[bytom/vapor.git] / protocol / block.go
index 4870de3..9552a01 100644 (file)
@@ -238,7 +238,7 @@ func (c *Chain) reorganizeChain(blockHeader *types.BlockHeader) error {
                // the number of restored Tx should be very small or most of time ZERO
                // Error returned from validation is ignored, tx could still be lost if validation fails.
                // TODO: adjust tx timestamp so that it won't starve in pool.
-               if _, err := c.ValidateTx(tx); err != nil {
+               if _, err := c.validateTx(tx); err != nil {
                        log.WithFields(log.Fields{"module": logModule, "tx_id": tx.Tx.ID.String(), "error": err}).Info("restore tx fail")
                }
        }
@@ -357,6 +357,8 @@ func (c *Chain) processBlock(block *types.Block) (bool, error) {
                return c.orphanManage.BlockExist(&blockHash), nil
        }
 
+       c.markTransactions(block.Transactions...)
+
        if _, err := c.store.GetBlockHeader(&block.PreviousBlockHash); err != nil {
                c.orphanManage.Add(block)
                return true, nil