diff --git a/p2p/chain_sync.go b/p2p/chain_sync.go index 318ca83b..4323024a 100644 --- a/p2p/chain_sync.go +++ b/p2p/chain_sync.go @@ -388,6 +388,12 @@ func (connection *Connection) process_object_response(response Objects, sent int return nil } + + // too old TXs will be ignored for mining, but we should check incoming TX here to avoid high system load + if uint64(chain.Get_Height()) > tx.Height+blockchain.TX_VALIDITY_HEIGHT { + connection.logger.V(2).Error(err, "Incoming TX is too far in the past", "txid", tx.GetHash().String()) + continue + } if !chain.Mempool.Mempool_TX_Exist(tx.GetHash()) { // we still donot have it, so try to process it if chain.Add_TX_To_Pool(&tx) == nil { // currently we are ignoring error