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

Method DestroyTransaction

src/test/fuzz/txgraph.cpp:210–230  ·  view source on GitHub ↗

Destroy the transaction from the graph, including from the removed set. This will * trigger TxGraph::Ref::~Ref. reset_oversize controls whether the cached oversized * value is cleared (destroying does not clear oversizedness in TxGraph of the main * graph while staging exists). */

Source from the content-addressed store, hash-verified

208 * value is cleared (destroying does not clear oversizedness in TxGraph of the main
209 * graph while staging exists). */
210 void DestroyTransaction(TxGraph::Ref* ref, bool reset_oversize)
211 {
212 auto pos = Find(ref);
213 if (pos == MISSING) {
214 // Wipe the ref, if it exists, from the removed vector. Use std::partition rather
215 // than std::erase because we don't care about the order of the entries that
216 // remain.
217 auto remove = std::partition(removed.begin(), removed.end(), [&](auto& arg) { return arg.get() != ref; });
218 removed.erase(remove, removed.end());
219 } else {
220 MakeModified(pos);
221 graph.RemoveTransactions(SetType::Singleton(pos));
222 real_is_optimal = false;
223 simrevmap.erase(simmap[pos].get());
224 simmap[pos].reset();
225 // This may invalidate our cached oversized value.
226 if (reset_oversize && oversized.has_value() && *oversized) {
227 oversized = std::nullopt;
228 }
229 }
230 }
231
232 /** Construct the set with all positions in this graph corresponding to the specified
233 * TxGraph::Refs. All of them must occur in this graph and not be removed. */

Callers 1

FUZZ_TARGETFunction · 0.80

Calls 8

FindFunction · 0.85
RemoveTransactionsMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45
eraseMethod · 0.45
resetMethod · 0.45
has_valueMethod · 0.45

Tested by

no test coverage detected