diff options
-rw-r--r-- | src/txmempool.cpp | 10 | ||||
-rw-r--r-- | src/txmempool.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 845fbdb66e..79b2b4ec94 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -155,12 +155,12 @@ void CTxMemPool::UpdateTransactionsFromBlock(const std::vector<uint256>& vHashes } util::Result<CTxMemPool::setEntries> CTxMemPool::CalculateAncestorsAndCheckLimits( - size_t entry_size, + int64_t entry_size, size_t entry_count, CTxMemPoolEntry::Parents& staged_ancestors, const Limits& limits) const { - size_t totalSizeWithAncestors = entry_size; + int64_t totalSizeWithAncestors = entry_size; setEntries ancestors; while (!staged_ancestors.empty()) { @@ -171,11 +171,11 @@ util::Result<CTxMemPool::setEntries> CTxMemPool::CalculateAncestorsAndCheckLimit staged_ancestors.erase(stage); totalSizeWithAncestors += stageit->GetTxSize(); - if (stageit->GetSizeWithDescendants() + entry_size > static_cast<uint64_t>(limits.descendant_size_vbytes)) { + if (stageit->GetSizeWithDescendants() + entry_size > limits.descendant_size_vbytes) { return util::Error{Untranslated(strprintf("exceeds descendant size limit for tx %s [limit: %u]", stageit->GetTx().GetHash().ToString(), limits.descendant_size_vbytes))}; } else if (stageit->GetCountWithDescendants() + entry_count > static_cast<uint64_t>(limits.descendant_count)) { return util::Error{Untranslated(strprintf("too many descendants for tx %s [limit: %u]", stageit->GetTx().GetHash().ToString(), limits.descendant_count))}; - } else if (totalSizeWithAncestors > static_cast<uint64_t>(limits.ancestor_size_vbytes)) { + } else if (totalSizeWithAncestors > limits.ancestor_size_vbytes) { return util::Error{Untranslated(strprintf("exceeds ancestor size limit [limit: %u]", limits.ancestor_size_vbytes))}; } @@ -201,7 +201,7 @@ bool CTxMemPool::CheckPackageLimits(const Package& package, std::string &errString) const { CTxMemPoolEntry::Parents staged_ancestors; - size_t total_size = 0; + int64_t total_size = 0; for (const auto& tx : package) { total_size += GetVirtualTransactionSize(*tx); for (const auto& input : tx->vin) { diff --git a/src/txmempool.h b/src/txmempool.h index 846def02cd..a1867eb895 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -442,7 +442,7 @@ private: * * @return all in-mempool ancestors, or an error if any ancestor or descendant limits were hit */ - util::Result<setEntries> CalculateAncestorsAndCheckLimits(size_t entry_size, + util::Result<setEntries> CalculateAncestorsAndCheckLimits(int64_t entry_size, size_t entry_count, CTxMemPoolEntry::Parents &staged_ancestors, const Limits& limits |