Pick a random transaction within a set (which must be non-empty). */
| 788 | |
| 789 | /** Pick a random transaction within a set (which must be non-empty). */ |
| 790 | TxIdx PickRandomTx(const SetType& tx_idxs) noexcept |
| 791 | { |
| 792 | Assume(tx_idxs.Any()); |
| 793 | unsigned pos = m_rng.randrange<unsigned>(tx_idxs.Count()); |
| 794 | for (auto tx_idx : tx_idxs) { |
| 795 | if (pos == 0) return tx_idx; |
| 796 | --pos; |
| 797 | } |
| 798 | Assume(false); |
| 799 | return TxIdx(-1); |
| 800 | } |
| 801 | |
| 802 | /** Find the set of out-of-chunk transactions reachable from tx_idxs, both in upwards and |
| 803 | * downwards direction. Only used by SanityCheck to verify the precomputed reachable sets in |