pub fn get_transaction_weight(tx_size: usize, cycles: u64) -> u64
Expand description

The miners select transactions to fill the limited block space which gives the highest fee. Because there are two different limits, serialized size and consumed cycles, the selection algorithm is a multi-dimensional knapsack problem. Introducing the transaction weight converts the multi-dimensional knapsack to a typical knapsack problem, which has a simple greedy algorithm.