Skip to content

Commit

Permalink
cleanup: Add comments for Blackcoin-related changes in <txmempool.cpp/h>
Browse files Browse the repository at this point in the history
  • Loading branch information
lateminer committed Aug 30, 2023
1 parent 05013fa commit af3057e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}
{
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -623,7 +637,9 @@ void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& 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());
Expand All @@ -636,6 +652,8 @@ void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigne
ClearPrioritisation(tx->GetHash());
}
lastRollingFeeUpdate = GetTime();
// Blackcoin
// blockSinceLastRollingFeeBump = true;
}

void CTxMemPool::check(const CCoinsViewCache& active_coins_tip, int64_t spendheight) const
Expand Down Expand Up @@ -1046,6 +1064,7 @@ void CTxMemPool::trackPackageRemoved(const CFeeRate& rate) {
AssertLockHeld(cs);
if (rate.GetFeePerK() > rollingMinimumFeeRate) {
rollingMinimumFeeRate = rate.GetFeePerK();
blockSinceLastRollingFeeBump = false;
}
}
*/
Expand Down
10 changes: 9 additions & 1 deletion src/txmempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ struct entry_time {};
struct ancestor_score {};
struct index_by_wtxid {};

// Blackcoin
// class CBlockPolicyEstimator;

/**
* Information about a mempool transaction.
*/
Expand Down Expand Up @@ -312,6 +315,8 @@ class CTxMemPool
protected:
const int m_check_ratio; //!< Value n means that 1 times in n we check.
std::atomic<unsigned int> 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)
Expand Down Expand Up @@ -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<unsigned> m_max_datacarrier_bytes;
const bool m_require_standard;
// Blackcoin
// const bool m_full_rbf;

const Limits m_limits;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit af3057e

Please sign in to comment.