I'm reading mastering ethereum and in section "Race Conditions/Front Running", quote:
As with most blockchains, Ethereum nodes pool transactions and form them into blocks. The transactions are only considered valid once a miner has solved a consensus mechanism (currently Ethash PoW for Ethereum). The miner who solves the block also chooses which transactions from the pool will be included in the block, typically ordered by the gasPrice of each transaction. Here is a potential attack vector. An attacker can watch the transaction pool for transactions that may contain solutions to problems, and modify or revoke the solver’s permissions or change state in a contract detrimentally to the solver. The attacker can then get the data from this transaction and create a transaction of their own with a higher gasPrice so their transaction is included in a block before the original.
I don't quite understand it. When the attacker see the transaction, it might already be broadcasted and included in the transaction pool.
If the attacker submit the same transaction with higher gasPrice again, what would happen to miners that already included the old transaction? Will they remove the old one and include the new one?