Module zip317

Source
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 computing size_target, since there is no consensus requirement for this to be exactly the same between implementations.

Traits§

TryUpdateBlockLimits 🔒

Functions§

checked_add_transaction_weighted_random 🔒
Chooses a random transaction from txs using the weighted index tx_weights, and tries to add it to selected_txs.
choose_transaction_weighted_random 🔒
Choose a transaction from transactions, using the previously set up weighted_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 in selected_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§

SelectedMempoolTx 🔒
Used in the return type of select_mempool_transactions() for non-test compilations.