Check cluster limits when using -walletrejectlongchains
This commit is contained in:
1 parent
95762e6759
commit
95a8297d48
3 files changed
+17
-3
No files matched your search
@@ -719,10 +719,11 @@ public:
|
|||||||
util::Result<void> checkChainLimits(const CTransactionRef& tx) override
|
util::Result<void> checkChainLimits(const CTransactionRef& tx) override
|
||||||
{
|
{
|
||||||
if (!m_node.mempool) return {};
|
if (!m_node.mempool) return {};
|
||||||
LockPoints lp;
|
if (!m_node.mempool->CheckPolicyLimits(tx)) {
|
||||||
CTxMemPoolEntry entry(TxGraph::Ref(), tx, 0, 0, 0, 0, false, 0, lp);
|
return util::Error{Untranslated("too many unconfirmed transactions in cluster")};
|
||||||
|
}
|
||||||
LOCK(m_node.mempool->cs);
|
LOCK(m_node.mempool->cs);
|
||||||
return m_node.mempool->CheckPackageLimits({tx}, entry.GetTxSize());
|
return m_node.mempool->CheckPackageLimits({tx}, GetVirtualTransactionSize(*tx));
|
||||||
}
|
}
|
||||||
CFeeRate estimateSmartFee(int num_blocks, bool conservative, FeeCalculation* calc) override
|
CFeeRate estimateSmartFee(int num_blocks, bool conservative, FeeCalculation* calc) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1078,6 +1078,17 @@ void CTxMemPool::RemoveStaged(setEntries &stage, bool updateDescendants, MemPool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CTxMemPool::CheckPolicyLimits(const CTransactionRef& tx)
|
||||||
|
{
|
||||||
|
LOCK(cs);
|
||||||
|
// Use ChangeSet interface to check whether the chain
|
||||||
|
// limits would be violated. Note that the changeset will be destroyed
|
||||||
|
// when it goes out of scope.
|
||||||
|
auto changeset = GetChangeSet();
|
||||||
|
(void) changeset->StageAddition(tx, /*fee=*/0, /*time=*/0, /*entry_height=*/0, /*entry_sequence=*/0, /*spends_coinbase=*/false, /*sigops_cost=*/0, LockPoints{});
|
||||||
|
return changeset->CheckMemPoolPolicyLimits();
|
||||||
|
}
|
||||||
|
|
||||||
int CTxMemPool::Expire(std::chrono::seconds time)
|
int CTxMemPool::Expire(std::chrono::seconds time)
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs);
|
AssertLockHeld(cs);
|
||||||
|
|||||||
@@ -681,6 +681,8 @@ public:
|
|||||||
if (exists(txid)) m_unbroadcast_txids.insert(txid);
|
if (exists(txid)) m_unbroadcast_txids.insert(txid);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool CheckPolicyLimits(const CTransactionRef& tx);
|
||||||
|
|
||||||
/** Removes a transaction from the unbroadcast set */
|
/** Removes a transaction from the unbroadcast set */
|
||||||
void RemoveUnbroadcastTx(const Txid& txid, const bool unchecked = false);
|
void RemoveUnbroadcastTx(const Txid& txid, const bool unchecked = false);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user