Expand description
The ZIP-317 block production algorithm.
This is recommended algorithm, so these calculations are not consensus-critical, or standardised across node implementations:
it is sufficient to use floating point arithmetic to calculate the argument to
floor
when computingsize_target
, since there is no consensus requirement for this to be exactly the same between implementations.
Traits§
Functions§
- checked_
add_ 🔒transaction_ weighted_ random - Chooses a random transaction from
txs
using the weighted indextx_weights
, and tries to add it toselected_txs
. - choose_
transaction_ 🔒weighted_ random - Choose a transaction from
transactions
, using the previously set upweighted_index
. - fake_
coinbase_ transaction - Returns a fake coinbase transaction that can be used during transaction selection.
- has_
direct_ 🔒dependencies - Checks if every item in
candidate_tx_deps
is present inselected_txs
. - select_
mempool_ transactions - Selects mempool transactions for block production according to ZIP-317, using a fake coinbase transaction and the mempool.
- setup_
fee_ 🔒weighted_ index - Returns a fee-weighted index and the total weight of
transactions
.
Type Aliases§
- Selected
Mempool 🔒Tx - Used in the return type of
select_mempool_transactions()
for non-test compilations.