Skip to content

Commit 062738c

Browse files
committed
Merge #13096: [Policy] Fix MAX_STANDARD_TX_WEIGHT check
2f1a30c Fix MAX_STANDARD_TX_WEIGHT check (Johnson Lau) Pull request description: As suggested by the constant name and its comment in policy.h, a transaction with a weight of exactly MAX_STANDARD_TX_WEIGHT should be allowed. Users could be confused. Tree-SHA512: af417de1c6a2e6796ebbb39aa0caad8764302ded155cb1bbfbe457e4567c199cc53256189832b17d4aeec369e190b3edd4c6116d5f0b8cf0ede6dfb4ed83bdd3
2 parents c9eb8d1 + 2f1a30c commit 062738c

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/net_processing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,10 +664,10 @@ bool AddOrphanTx(const CTransactionRef& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRE
664664
// large transaction with a missing parent then we assume
665665
// it will rebroadcast it later, after the parent transaction(s)
666666
// have been mined or received.
667-
// 100 orphans, each of which is at most 99,999 bytes big is
667+
// 100 orphans, each of which is at most 100,000 bytes big is
668668
// at most 10 megabytes of orphans and somewhat more byprev index (in the worst case):
669669
unsigned int sz = GetTransactionWeight(*tx);
670-
if (sz >= MAX_STANDARD_TX_WEIGHT)
670+
if (sz > MAX_STANDARD_TX_WEIGHT)
671671
{
672672
LogPrint(BCLog::MEMPOOL, "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString());
673673
return false;

src/policy/policy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason)
8888
// computing signature hashes is O(ninputs*txsize). Limiting transactions
8989
// to MAX_STANDARD_TX_WEIGHT mitigates CPU exhaustion attacks.
9090
unsigned int sz = GetTransactionWeight(tx);
91-
if (sz >= MAX_STANDARD_TX_WEIGHT) {
91+
if (sz > MAX_STANDARD_TX_WEIGHT) {
9292
reason = "tx-size";
9393
return false;
9494
}

src/wallet/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3078,7 +3078,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransac
30783078
tx = MakeTransactionRef(std::move(txNew));
30793079

30803080
// Limit size
3081-
if (GetTransactionWeight(*tx) >= MAX_STANDARD_TX_WEIGHT)
3081+
if (GetTransactionWeight(*tx) > MAX_STANDARD_TX_WEIGHT)
30823082
{
30833083
strFailReason = _("Transaction too large");
30843084
return false;

0 commit comments

Comments
 (0)