aboutsummaryrefslogtreecommitdiff
path: root/src/consensus/tx_check.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2019-04-28 15:40:01 -0500
committerJohn Newbery <john@johnnewbery.com>2019-10-29 15:46:45 -0400
commit7204c6434b944f6ad51b3c895837729d3aa56eea (patch)
tree6d39e40394fbee93cdd7c70e6fa09b9d0765b20a /src/consensus/tx_check.cpp
parent1a37de4b3174d19a6d8691ae07e92b32fdfaef11 (diff)
downloadbitcoin-7204c6434b944f6ad51b3c895837729d3aa56eea.tar.xz
[validation] Remove useless ret parameter from Invalid()
ValidationState::Invalid() takes a parameter `ret` which is returned to the caller. All call sites set this to false. Remove the `ret` parameter and just return false always.
Diffstat (limited to 'src/consensus/tx_check.cpp')
-rw-r--r--src/consensus/tx_check.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/consensus/tx_check.cpp b/src/consensus/tx_check.cpp
index a9d5cec4ac..88bb12c713 100644
--- a/src/consensus/tx_check.cpp
+++ b/src/consensus/tx_check.cpp
@@ -11,24 +11,24 @@ bool CheckTransaction(const CTransaction& tx, TxValidationState& state)
{
// Basic checks that don't depend on any context
if (tx.vin.empty())
- return state.Invalid(TxValidationResult::TX_CONSENSUS, false, "bad-txns-vin-empty");
+ return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-vin-empty");
if (tx.vout.empty())
- return state.Invalid(TxValidationResult::TX_CONSENSUS, false, "bad-txns-vout-empty");
+ return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-vout-empty");
// Size limits (this doesn't take the witness into account, as that hasn't been checked for malleability)
if (::GetSerializeSize(tx, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
- return state.Invalid(TxValidationResult::TX_CONSENSUS, false, "bad-txns-oversize");
+ return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-oversize");
// Check for negative or overflow output values (see CVE-2010-5139)
CAmount nValueOut = 0;
for (const auto& txout : tx.vout)
{
if (txout.nValue < 0)
- return state.Invalid(TxValidationResult::TX_CONSENSUS, false, "bad-txns-vout-negative");
+ return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-vout-negative");
if (txout.nValue > MAX_MONEY)
- return state.Invalid(TxValidationResult::TX_CONSENSUS, false, "bad-txns-vout-toolarge");
+ return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-vout-toolarge");
nValueOut += txout.nValue;
if (!MoneyRange(nValueOut))
- return state.Invalid(TxValidationResult::TX_CONSENSUS, false, "bad-txns-txouttotal-toolarge");
+ return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-txouttotal-toolarge");
}
// Check for duplicate inputs (see CVE-2018-17144)
@@ -39,19 +39,19 @@ bool CheckTransaction(const CTransaction& tx, TxValidationState& state)
std::set<COutPoint> vInOutPoints;
for (const auto& txin : tx.vin) {
if (!vInOutPoints.insert(txin.prevout).second)
- return state.Invalid(TxValidationResult::TX_CONSENSUS, false, "bad-txns-inputs-duplicate");
+ return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-inputs-duplicate");
}
if (tx.IsCoinBase())
{
if (tx.vin[0].scriptSig.size() < 2 || tx.vin[0].scriptSig.size() > 100)
- return state.Invalid(TxValidationResult::TX_CONSENSUS, false, "bad-cb-length");
+ return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-cb-length");
}
else
{
for (const auto& txin : tx.vin)
if (txin.prevout.IsNull())
- return state.Invalid(TxValidationResult::TX_CONSENSUS, false, "bad-txns-prevout-null");
+ return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-prevout-null");
}
return true;