mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
refactor: Make more transaction size variables signed
This change gets rid of `static_cast`s and compiler warnings.
This commit is contained in:
parent
d23fda0584
commit
92de74ef18
2 changed files with 6 additions and 6 deletions
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue