I am trying to learn more about txpool and at what state transactions in it are in the overall lifecycle of an Ethereum transaction.
If I have a transaction that is going to call a smart contract, the transaction will have data that will be passed to the contract. This may alter the final state of a SC transaction, like slippage on a swap for example.
I'm trying to understand at what point that final swap value is fixed. Is it when the transaction reaches the txpool, or when the smart contract byte code is executed.
Does this relate to pending and queued transactions in the txpool?
Best Answer
Basically the state changes are being calculated when your transaction is selected to be picked in a block. Let's say you calculate the state changes at block X and the best way to meet your calculations is your transaction to be 1st in the X + 1 block. You can achive this manipulation by twitching the gas price.
For the difference between ququed and pending check this answer: What is the difference between a pending transaction and a queued transaction?