Skip to content

Commit

Permalink
Fix nits in txmempool.h/cpp
Browse files Browse the repository at this point in the history
Summary: There is no change in behavior, only comment updates and removal of a casting to same type.

Test Plan:
  ninja all check-all
Read the comments.

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D12871
  • Loading branch information
Fabcien committed Dec 14, 2022
1 parent f1be16a commit 6208887
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ void CTxMemPoolEntry::UpdateDescendantState(int64_t modifySize,
nCountWithDescendants += modifyCount;
assert(int64_t(nCountWithDescendants) > 0);
nSigChecksWithDescendants += modifySigChecks;
assert(int64_t(nSigChecksWithDescendants) >= 0);
assert(nSigChecksWithDescendants >= 0);
}

void CTxMemPoolEntry::UpdateAncestorState(int64_t modifySize, Amount modifyFee,
Expand All @@ -512,7 +512,7 @@ void CTxMemPoolEntry::UpdateAncestorState(int64_t modifySize, Amount modifyFee,
nCountWithAncestors += modifyCount;
assert(int64_t(nCountWithAncestors) > 0);
nSigChecksWithAncestors += modifySigChecks;
assert(int(nSigChecksWithAncestors) >= 0);
assert(nSigChecksWithAncestors >= 0);
}

CTxMemPool::CTxMemPool(int check_ratio) : m_check_ratio(check_ratio) {
Expand Down
14 changes: 7 additions & 7 deletions src/txmempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,7 @@ enum class MemPoolRemovalReason {
* example, the following new transactions will not be added to the mempool:
* - a transaction which doesn't meet the minimum fee requirements.
* - a new transaction that double-spends an input of a transaction already in
* the pool where the new transaction does not meet the Replace-By-Fee
* requirements as defined in BIP 125.
* the pool.
* - a non-standard transaction.
*
* CTxMemPool::mapTx, and CTxMemPoolEntry bookkeeping:
Expand All @@ -390,8 +389,9 @@ enum class MemPoolRemovalReason {
*
* In order for the feerate sort to remain correct, we must update transactions
* in the mempool when new descendants arrive. To facilitate this, we track the
* set of in-mempool direct parents and direct children in mapLinks. Within each
* CTxMemPoolEntry, we track the size and fees of all descendants.
* set of in-mempool direct parents and direct children in m_parents and
* m_children. Within each CTxMemPoolEntry, we track the size and fees of all
* descendants.
*
* Usually when a new transaction is added to the mempool, it has no in-mempool
* children (because any such children would be an orphan). So in
Expand Down Expand Up @@ -423,7 +423,7 @@ enum class MemPoolRemovalReason {
* state, to account for in-mempool, out-of-block descendants for all the
* in-block transactions by calling UpdateTransactionsFromBlock(). Note that
* until this is called, the mempool state is not consistent, and in particular
* mapLinks may not be correct (and therefore functions like
* m_parents and m_children may not be correct (and therefore functions like
* CalculateMemPoolAncestors() and CalculateDescendants() that rely on them to
* walk the mempool are not generally safe to use).
*
Expand Down Expand Up @@ -470,7 +470,7 @@ class CTxMemPool {

typedef boost::multi_index_container<
CTxMemPoolEntry, boost::multi_index::indexed_by<
// sorted by txid
// indexed by txid
boost::multi_index::hashed_unique<
mempoolentry_txid, SaltedTxIdHasher>,
// sorted by fee rate
Expand Down Expand Up @@ -698,7 +698,7 @@ class CTxMemPool {
* limitDescendantSize = max size of descendants any ancestor can have
* errString = populated with error reason if any limits are hit
* fSearchForParents = whether to search a tx's vin for in-mempool parents,
* or look up parents from mapLinks. Must be true for entries not in the
* or look up parents from m_parents. Must be true for entries not in the
* mempool
*/
bool CalculateMemPoolAncestors(
Expand Down

0 comments on commit 6208887

Please sign in to comment.