I read a lot that transactions that pay the higher gas price can get their transactions through quicker. I would like to know how I could amend my miner code to select transactions with small fees.
Have a look in
In there you have various approaches for how to order transactions within a block.
I think you'll basically want to invert the part that sorts by price, giving lower-priced transactions higher priority. (Or however you actually want to prioritise things... )
However, there's some complexity in the algorithm because of how the nonces need to be handled, so you'll have to be careful. (I haven't read the algorithm in full.) From the comment in the code:
// SortByPriceAndNonce sorts the transactions by price in such a way that the // nonce orderings within a single account are maintained. // // Note, this is not as trivial as it seems from the first look as there are three // different criteria that need to be taken into account (price, nonce, account // match), which cannot be done with any plain sorting method, as certain items // cannot be compared without context.