From af3057ed6536556ceba001ed9a0cc6966c59e7ff Mon Sep 17 00:00:00 2001 From: lateminer <9951982+lateminer@users.noreply.github.com> Date: Wed, 30 Aug 2023 23:21:37 +0200 Subject: [PATCH] cleanup: Add comments for Blackcoin-related changes in --- src/txmempool.cpp | 19 +++++++++++++++++++ src/txmempool.h | 10 +++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 7a5218486e..a2e22924a6 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -385,13 +385,19 @@ void CTxMemPoolEntry::UpdateAncestorState(int64_t modifySize, CAmount modifyFee, CTxMemPool::CTxMemPool(const Options& opts) : m_check_ratio{opts.check_ratio}, + // Blackcoin + // minerPolicyEstimator{opts.estimator}, m_max_size_bytes{opts.max_size_bytes}, m_expiry{opts.expiry}, + // Blackcoin + // m_incremental_relay_feerate{opts.incremental_relay_feerate}, m_min_relay_feerate{opts.min_relay_feerate}, m_dust_relay_feerate{opts.dust_relay_feerate}, m_permit_bare_multisig{opts.permit_bare_multisig}, m_max_datacarrier_bytes{opts.max_datacarrier_bytes}, m_require_standard{opts.require_standard}, + // Blackcoin + // m_full_rbf{opts.full_rbf}, m_limits{opts.limits} { } @@ -456,6 +462,12 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces nTransactionsUpdated++; totalTxSize += entry.GetTxSize(); m_total_fee += entry.GetFee(); + // Blackcoin + /* + if (minerPolicyEstimator) { + minerPolicyEstimator->processTransaction(entry, validFeeEstimate); + } + */ vTxHashes.emplace_back(tx.GetWitnessHash(), newit); newit->vTxHashesIdx = vTxHashes.size() - 1; @@ -509,6 +521,8 @@ void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason) cachedInnerUsage -= memusage::DynamicUsage(it->GetMemPoolParentsConst()) + memusage::DynamicUsage(it->GetMemPoolChildrenConst()); mapTx.erase(it); nTransactionsUpdated++; + // Blackcoin + // if (minerPolicyEstimator) {minerPolicyEstimator->removeTx(hash, false);} } // Calculates descendants of entry that are not already in setDescendants, and adds to @@ -623,7 +637,9 @@ void CTxMemPool::removeForBlock(const std::vector& vtx, unsigne if (i != mapTx.end()) entries.push_back(&*i); } + // Blackcoin // Before the txs in the new block have been removed from the mempool, update policy estimates + // if (minerPolicyEstimator) {minerPolicyEstimator->processBlock(nBlockHeight, entries);} for (const auto& tx : vtx) { txiter it = mapTx.find(tx->GetHash()); @@ -636,6 +652,8 @@ void CTxMemPool::removeForBlock(const std::vector& vtx, unsigne ClearPrioritisation(tx->GetHash()); } lastRollingFeeUpdate = GetTime(); + // Blackcoin + // blockSinceLastRollingFeeBump = true; } void CTxMemPool::check(const CCoinsViewCache& active_coins_tip, int64_t spendheight) const @@ -1046,6 +1064,7 @@ void CTxMemPool::trackPackageRemoved(const CFeeRate& rate) { AssertLockHeld(cs); if (rate.GetFeePerK() > rollingMinimumFeeRate) { rollingMinimumFeeRate = rate.GetFeePerK(); + blockSinceLastRollingFeeBump = false; } } */ diff --git a/src/txmempool.h b/src/txmempool.h index 35ae96baf6..0d6b5e9bd0 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -202,6 +202,9 @@ struct entry_time {}; struct ancestor_score {}; struct index_by_wtxid {}; +// Blackcoin +// class CBlockPolicyEstimator; + /** * Information about a mempool transaction. */ @@ -312,6 +315,8 @@ class CTxMemPool protected: const int m_check_ratio; //!< Value n means that 1 times in n we check. std::atomic nTransactionsUpdated{0}; //!< Used by getblocktemplate to trigger CreateNewBlock() invocation + // Blackcoin + // CBlockPolicyEstimator* const minerPolicyEstimator; uint64_t totalTxSize GUARDED_BY(cs){0}; //!< sum of all mempool tx's virtual sizes. Differs from serialized tx size since witness data is discounted. Defined in BIP 141. CAmount m_total_fee GUARDED_BY(cs){0}; //!< sum of all mempool tx's fees (NOT modified fee) @@ -451,11 +456,15 @@ class CTxMemPool const int64_t m_max_size_bytes; const std::chrono::seconds m_expiry; + // Blackcoin + // const CFeeRate m_incremental_relay_feerate; const CFeeRate m_min_relay_feerate; const CFeeRate m_dust_relay_feerate; const bool m_permit_bare_multisig; const std::optional m_max_datacarrier_bytes; const bool m_require_standard; + // Blackcoin + // const bool m_full_rbf; const Limits m_limits; @@ -602,7 +611,6 @@ class CTxMemPool * already in it. */ void CalculateDescendants(txiter it, setEntries& setDescendants) const EXCLUSIVE_LOCKS_REQUIRED(cs); - /** The minimum fee to get into the mempool, which may itself not be enough * for larger-sized transactions. * The m_incremental_relay_feerate policy variable is used to bound the time it