diff options
| author | Johnson Lau <[email protected]> | 2018-04-27 01:24:48 +0800 |
|---|---|---|
| committer | Johnson Lau <[email protected]> | 2018-05-05 00:00:28 +0800 |
| commit | 2f1a30c63e421b191c62059132b1cd40c24bd4d5 (patch) | |
| tree | 38c1f3ddbfb92a907290769220556ecc2c200054 /src | |
| parent | Merge #13165: doc: Mention good first issue list in CONTRIBUTING.md (diff) | |
| download | discoin-2f1a30c63e421b191c62059132b1cd40c24bd4d5.tar.xz discoin-2f1a30c63e421b191c62059132b1cd40c24bd4d5.zip | |
Fix MAX_STANDARD_TX_WEIGHT check
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/net_processing.cpp | 4 | ||||
| -rw-r--r-- | src/policy/policy.cpp | 2 | ||||
| -rw-r--r-- | src/wallet/wallet.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index cc819a01c..1d09bdc3b 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -664,10 +664,10 @@ bool AddOrphanTx(const CTransactionRef& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRE // large transaction with a missing parent then we assume // it will rebroadcast it later, after the parent transaction(s) // have been mined or received. - // 100 orphans, each of which is at most 99,999 bytes big is + // 100 orphans, each of which is at most 100,000 bytes big is // at most 10 megabytes of orphans and somewhat more byprev index (in the worst case): unsigned int sz = GetTransactionWeight(*tx); - if (sz >= MAX_STANDARD_TX_WEIGHT) + if (sz > MAX_STANDARD_TX_WEIGHT) { LogPrint(BCLog::MEMPOOL, "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString()); return false; diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index 5963bf371..d95fa3ade 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -91,7 +91,7 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnes // computing signature hashes is O(ninputs*txsize). Limiting transactions // to MAX_STANDARD_TX_WEIGHT mitigates CPU exhaustion attacks. unsigned int sz = GetTransactionWeight(tx); - if (sz >= MAX_STANDARD_TX_WEIGHT) { + if (sz > MAX_STANDARD_TX_WEIGHT) { reason = "tx-size"; return false; } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 9533e6ff5..5bdb3fe29 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3053,7 +3053,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransac tx = MakeTransactionRef(std::move(txNew)); // Limit size - if (GetTransactionWeight(*tx) >= MAX_STANDARD_TX_WEIGHT) + if (GetTransactionWeight(*tx) > MAX_STANDARD_TX_WEIGHT) { strFailReason = _("Transaction too large"); return false; |