| 2228 | GenericClusterImpl::GenericClusterImpl(uint64_t sequence) noexcept : Cluster{sequence} {} |
| 2229 | |
| 2230 | void TxGraphImpl::AddTransaction(Ref& arg, const FeePerWeight& feerate) noexcept |
| 2231 | { |
| 2232 | Assume(m_main_chunkindex_observers == 0 || GetTopLevel() != 0); |
| 2233 | Assume(feerate.size > 0); |
| 2234 | Assume(GetRefGraph(arg) == nullptr); |
| 2235 | // Construct a new Entry, and link it with the Ref. |
| 2236 | auto idx = m_entries.size(); |
| 2237 | m_entries.emplace_back(); |
| 2238 | auto& entry = m_entries.back(); |
| 2239 | entry.m_main_chunkindex_iterator = m_main_chunkindex.end(); |
| 2240 | entry.m_ref = &arg; |
| 2241 | GetRefGraph(arg) = this; |
| 2242 | GetRefIndex(arg) = idx; |
| 2243 | // Construct a new singleton Cluster (which is necessarily optimally linearized). |
| 2244 | bool oversized = uint64_t(feerate.size) > m_max_cluster_size; |
| 2245 | auto cluster = CreateEmptyCluster(1); |
| 2246 | cluster->AppendTransaction(idx, feerate); |
| 2247 | auto cluster_ptr = cluster.get(); |
| 2248 | int level = GetTopLevel(); |
| 2249 | auto& clusterset = GetClusterSet(level); |
| 2250 | InsertCluster(level, std::move(cluster), oversized ? QualityLevel::OVERSIZED_SINGLETON : QualityLevel::OPTIMAL); |
| 2251 | cluster_ptr->Updated(*this, /*level=*/level, /*rename=*/false); |
| 2252 | clusterset.m_cluster_usage += cluster_ptr->TotalMemoryUsage(); |
| 2253 | ++clusterset.m_txcount; |
| 2254 | // Deal with individually oversized transactions. |
| 2255 | if (oversized) { |
| 2256 | ++clusterset.m_txcount_oversized; |
| 2257 | clusterset.m_oversized = true; |
| 2258 | clusterset.m_group_data = std::nullopt; |
| 2259 | } |
| 2260 | } |
| 2261 | |
| 2262 | void TxGraphImpl::RemoveTransaction(const Ref& arg) noexcept |
| 2263 | { |
no test coverage detected