mempool: Use m_limit for UpdateTransactionsFromBlock

Since:

- UpdateTransactionsFromBlock is only called by
  MaybeUpdateMempoolForReorg, which calls it with the gArgs-determined
  ancestor limits
- UpdateForDescendants is only called by UpdateTransactionsFromBlock
  with the ancestor limits unchanged

We can remove the requirement to specify the ancestor limits for both
UpdateTransactionsFromBlock and UpdateForDescendants and just use the
values in the m_limits member.

Also move some removed comments to MemPoolLimits struct members.

The uint64_t cast in UpdateForDescendants is not new behavior,
see the diff in CChainState::MaybeUpdateMempoolForReorg for where they
were previously.
This commit is contained in:
Carl Dong
2022-05-18 14:44:25 -04:00
parent 9e93b10301
commit 6c5c60c412
4 changed files with 11 additions and 20 deletions

View File

@@ -320,9 +320,7 @@ void CChainState::MaybeUpdateMempoolForReorg(
// previously-confirmed transactions back to the mempool.
// UpdateTransactionsFromBlock finds descendants of any transactions in
// the disconnectpool that were added back and cleans up the mempool state.
const uint64_t ancestor_count_limit = gArgs.GetIntArg("-limitancestorcount", DEFAULT_ANCESTOR_LIMIT);
const uint64_t ancestor_size_limit = gArgs.GetIntArg("-limitancestorsize", DEFAULT_ANCESTOR_SIZE_LIMIT_KVB) * 1000;
m_mempool->UpdateTransactionsFromBlock(vHashUpdate, ancestor_size_limit, ancestor_count_limit);
m_mempool->UpdateTransactionsFromBlock(vHashUpdate);
// Predicate to use for filtering transactions in removeForReorg.
// Checks whether the transaction is still final and, if it spends a coinbase output, mature.