fn checked_add_transaction_weighted_random(
    candidate_txs: &mut Vec<VerifiedUnminedTx>,
    dependent_txs: &mut HashMap<Hash, VerifiedUnminedTx>,
    tx_weights: WeightedIndex<f32>,
    selected_txs: &mut Vec<VerifiedUnminedTx>,
    mempool_tx_deps: &TransactionDependencies,
    remaining_block_bytes: &mut usize,
    remaining_block_sigops: &mut u64,
    remaining_block_unpaid_actions: &mut u32,
) -> Option<WeightedIndex<f32>>
Expand description

Chooses a random transaction from txs using the weighted index tx_weights, and tries to add it to selected_txs.

If it fits in the supplied limits, adds it to selected_txs, and updates the limits.

Updates the weights of chosen transactions to zero, even if they weren’t added, so they can’t be chosen again.

Returns the updated transaction weights. If all transactions have been chosen, returns None.