mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-18 16:42:54 +01:00
Require mempool lock to be held when invoking TRUC checks
This commit is contained in:
@@ -59,6 +59,7 @@ std::optional<std::string> PackageTRUCChecks(const CTxMemPool& pool, const CTran
|
||||
const Package& package,
|
||||
const std::vector<CTxMemPoolEntry::CTxMemPoolEntryRef>& mempool_parents)
|
||||
{
|
||||
AssertLockHeld(pool.cs);
|
||||
// This function is specialized for these limits, and must be reimplemented if they ever change.
|
||||
static_assert(TRUC_ANCESTOR_LIMIT == 2);
|
||||
static_assert(TRUC_DESCENDANT_LIMIT == 2);
|
||||
@@ -173,7 +174,7 @@ std::optional<std::pair<std::string, CTransactionRef>> SingleTRUCChecks(const CT
|
||||
const std::set<Txid>& direct_conflicts,
|
||||
int64_t vsize)
|
||||
{
|
||||
LOCK(pool.cs);
|
||||
AssertLockHeld(pool.cs);
|
||||
// Check TRUC and non-TRUC inheritance.
|
||||
for (const auto& entry_ref : mempool_parents) {
|
||||
const auto& entry = &entry_ref.get();
|
||||
|
||||
@@ -66,7 +66,7 @@ static_assert(TRUC_MAX_VSIZE + TRUC_CHILD_MAX_VSIZE <= DEFAULT_CLUSTER_SIZE_LIMI
|
||||
std::optional<std::pair<std::string, CTransactionRef>> SingleTRUCChecks(const CTxMemPool& pool, const CTransactionRef& ptx,
|
||||
const std::vector<CTxMemPoolEntry::CTxMemPoolEntryRef>& mempool_parents,
|
||||
const std::set<Txid>& direct_conflicts,
|
||||
int64_t vsize);
|
||||
int64_t vsize) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
|
||||
|
||||
/** Must be called for every transaction that is submitted within a package, even if not TRUC.
|
||||
*
|
||||
@@ -91,6 +91,6 @@ std::optional<std::pair<std::string, CTransactionRef>> SingleTRUCChecks(const CT
|
||||
* */
|
||||
std::optional<std::string> PackageTRUCChecks(const CTxMemPool& pool, const CTransactionRef& ptx, int64_t vsize,
|
||||
const Package& package,
|
||||
const std::vector<CTxMemPoolEntry::CTxMemPoolEntryRef>& mempool_parents);
|
||||
const std::vector<CTxMemPoolEntry::CTxMemPoolEntryRef>& mempool_parents) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
|
||||
|
||||
#endif // BITCOIN_POLICY_TRUC_POLICY_H
|
||||
|
||||
Reference in New Issue
Block a user