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). */
| 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. */ |
no test coverage detected