Require mempool lock to be held when invoking TRUC checks
This commit is contained in:
1 parent
957ae23241
commit
bc2eb931da
2 files changed
+4
-3
No files matched your search
@@ -59,6 +59,7 @@ std::optional<std::string> PackageTRUCChecks(const CTxMemPool& pool, const CTran
|
|||||||
const Package& package,
|
const Package& package,
|
||||||
const std::vector<CTxMemPoolEntry::CTxMemPoolEntryRef>& mempool_parents)
|
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.
|
// This function is specialized for these limits, and must be reimplemented if they ever change.
|
||||||
static_assert(TRUC_ANCESTOR_LIMIT == 2);
|
static_assert(TRUC_ANCESTOR_LIMIT == 2);
|
||||||
static_assert(TRUC_DESCENDANT_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,
|
const std::set<Txid>& direct_conflicts,
|
||||||
int64_t vsize)
|
int64_t vsize)
|
||||||
{
|
{
|
||||||
LOCK(pool.cs);
|
AssertLockHeld(pool.cs);
|
||||||
// Check TRUC and non-TRUC inheritance.
|
// Check TRUC and non-TRUC inheritance.
|
||||||
for (const auto& entry_ref : mempool_parents) {
|
for (const auto& entry_ref : mempool_parents) {
|
||||||
const auto& entry = &entry_ref.get();
|
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,
|
std::optional<std::pair<std::string, CTransactionRef>> SingleTRUCChecks(const CTxMemPool& pool, const CTransactionRef& ptx,
|
||||||
const std::vector<CTxMemPoolEntry::CTxMemPoolEntryRef>& mempool_parents,
|
const std::vector<CTxMemPoolEntry::CTxMemPoolEntryRef>& mempool_parents,
|
||||||
const std::set<Txid>& direct_conflicts,
|
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.
|
/** 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,
|
std::optional<std::string> PackageTRUCChecks(const CTxMemPool& pool, const CTransactionRef& ptx, int64_t vsize,
|
||||||
const Package& package,
|
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
|
#endif // BITCOIN_POLICY_TRUC_POLICY_H
|
||||||
Reference in new issue
Block a user