Add a new unconnected transaction to this transaction graph (in the first available * position), and return its DepGraphIndex. * * Complexity: O(1) (amortized, due to resizing of backing vector). */
| 134 | * Complexity: O(1) (amortized, due to resizing of backing vector). |
| 135 | */ |
| 136 | DepGraphIndex AddTransaction(const FeeFrac& feefrac) noexcept |
| 137 | { |
| 138 | static constexpr auto ALL_POSITIONS = SetType::Fill(SetType::Size()); |
| 139 | auto available = ALL_POSITIONS - m_used; |
| 140 | Assume(available.Any()); |
| 141 | DepGraphIndex new_idx = available.First(); |
| 142 | if (new_idx == entries.size()) { |
| 143 | entries.emplace_back(feefrac, SetType::Singleton(new_idx), SetType::Singleton(new_idx)); |
| 144 | } else { |
| 145 | entries[new_idx] = Entry(feefrac, SetType::Singleton(new_idx), SetType::Singleton(new_idx)); |
| 146 | } |
| 147 | m_used.Set(new_idx); |
| 148 | return new_idx; |
| 149 | } |
| 150 | |
| 151 | /** Remove the specified positions from this DepGraph. |
| 152 | * |