mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-13 11:25:02 -05:00
![Carl Dong](/assets/img/avatar_default.png)
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.
30 lines
1.3 KiB
C++
30 lines
1.3 KiB
C++
// Copyright (c) 2022 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
#ifndef BITCOIN_KERNEL_MEMPOOL_LIMITS_H
|
|
#define BITCOIN_KERNEL_MEMPOOL_LIMITS_H
|
|
|
|
#include <policy/policy.h>
|
|
|
|
#include <cstdint>
|
|
|
|
namespace kernel {
|
|
/**
|
|
* Options struct containing limit options for a CTxMemPool. Default constructor
|
|
* populates the struct with sane default values which can be modified.
|
|
*
|
|
* Most of the time, this struct should be referenced as CTxMemPool::Limits.
|
|
*/
|
|
struct MemPoolLimits {
|
|
//! The maximum allowed number of transactions in a package including the entry and its ancestors.
|
|
int64_t ancestor_count{DEFAULT_ANCESTOR_LIMIT};
|
|
//! The maximum allowed size in virtual bytes of an entry and its ancestors within a package.
|
|
int64_t ancestor_size_vbytes{DEFAULT_ANCESTOR_SIZE_LIMIT_KVB * 1'000};
|
|
//! The maximum allowed number of transactions in a package including the entry and its descendants.
|
|
int64_t descendant_count{DEFAULT_DESCENDANT_LIMIT};
|
|
//! The maximum allowed size in virtual bytes of an entry and its descendants within a package.
|
|
int64_t descendant_size_vbytes{DEFAULT_DESCENDANT_SIZE_LIMIT_KVB * 1'000};
|
|
};
|
|
} // namespace kernel
|
|
|
|
#endif // BITCOIN_KERNEL_MEMPOOL_LIMITS_H
|