Skip to content

Commit

Permalink
Merge branch '8lecramm-anti-spam' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainDero committed Jun 11, 2023
2 parents 87609a9 + 5c246f6 commit d94bf77
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions p2p/chain_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d94bf77

Please sign in to comment.