Before you jump all over this a duplicate question. I did read things related to DAG like here: What actually is a DAG? But that doesn't answer my question, what does it mean when my mining pool website says that the next DAG is in X (4 in my case) days? How does that affect me as a miner?
[Ethereum] What does it mean that the next DAG is in X days
Edit: 23 June 2017 - Added Parity details (see below)
For the vanilla Geth implementation, the
commitNewWork() function in worker.go orders in the following way:
//approach 2 transactions := self.eth.TxPool().GetTransactions() <--- fetch from pool types.SortByPriceAndNonce(transactions) <---------- order
i.e. Sorts by gas price and nonce value (and by owner account - see below).
There are two other approaches in the code which are both commented out, but may give a clue as to previous ideas (or give examples to miners who want to use their own implementation). They are:
- approach 1: sort by nonce only
- approach 3: sort by owner (treating single- and multi-owner transactions differently), then by price and nonce
SortByPriceAndNonce() is defined in transaction.go:
// This method first sorts the separates the list of transactions into individual // sender accounts and sorts them by nonce. After the account nonce ordering is // satisfied, the results are merged back together by price, always comparing only // the head transaction from each account. This is done via a heap to keep it fast
Once sorted, the transactions are further screened in
commitTransactions() to remove any with "low gas".
For Parity things are a little easier: there's a CLI option. This will, at least, allow ordering to be changed in some basic ways.
--tx-queue-strategy S Prioritization strategy used to order transactions in the queue. S may be: gas - Prioritize txs with low gas limit; gas_price - Prioritize txs with high gas price; gas_factor - Prioritize txs using gas price and gas limit ratio (default: gas_price).
In general, miners tend to prioritize transactions that pay the highest fees first, with many having a minimum gas price that they will accept. Pools that include fewer transactions in their blocks probably have a higher minimum accepted fee.
Pools that mine empty blocks often do so to avoid the overhead of having to process transactions at all--they can simply stamp out the next block header and begin mining immediately.
Some pools will adopt a hybrid approach: immediately after solving a block, they will begin mining the next block without transactions while validating and deciding which transactions to include. This allows them to avoid underutilizing miners while computing the next block's headers with transactions included, on the off chance they immediately solve the next block within that window (rare, but possible).
I usually avoid copy pasting info from docs, as many here do, but here I think its appropriate: