MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / AddTransaction

Method AddTransaction

src/cluster_linearize.h:136–149  ·  view source on GitHub ↗

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). */

Source from the content-addressed store, hash-verified

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 *

Callers

nothing calls this directly

Calls 6

EntryClass · 0.70
AnyMethod · 0.45
FirstMethod · 0.45
sizeMethod · 0.45
emplace_backMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected