Changeset View
Changeset View
Standalone View
Standalone View
src/consensus/tx_verify.cpp
// Copyright (c) 2018 The Bitcoin developers | // Copyright (c) 2018 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <consensus/tx_verify.h> | #include <consensus/tx_verify.h> | ||||
#include <amount.h> | #include <amount.h> | ||||
#include <chain.h> | #include <chain.h> | ||||
#include <chainparams.h> | |||||
#include <coins.h> | #include <coins.h> | ||||
#include <config.h> | |||||
#include <consensus/activation.h> | #include <consensus/activation.h> | ||||
#include <consensus/consensus.h> | #include <consensus/consensus.h> | ||||
#include <consensus/validation.h> | #include <consensus/validation.h> | ||||
#include <primitives/transaction.h> | #include <primitives/transaction.h> | ||||
#include <script/script_flags.h> | #include <script/script_flags.h> | ||||
#include <utilmoneystr.h> // For FormatMoney | #include <utilmoneystr.h> // For FormatMoney | ||||
#include <version.h> // For PROTOCOL_VERSION | #include <version.h> // For PROTOCOL_VERSION | ||||
Show All 24 Lines | bool ContextualCheckTransaction(const Config &config, const CTransaction &tx, | ||||
int64_t nMedianTimePast) { | int64_t nMedianTimePast) { | ||||
if (!IsFinalTx(tx, nHeight, nLockTimeCutoff)) { | if (!IsFinalTx(tx, nHeight, nLockTimeCutoff)) { | ||||
// While this is only one transaction, we use txns in the error to | // While this is only one transaction, we use txns in the error to | ||||
// ensure continuity with other clients. | // ensure continuity with other clients. | ||||
return state.DoS(10, false, REJECT_INVALID, "bad-txns-nonfinal", false, | return state.DoS(10, false, REJECT_INVALID, "bad-txns-nonfinal", false, | ||||
"non-final transaction"); | "non-final transaction"); | ||||
} | } | ||||
if (IsMagneticAnomalyEnabled(config, nHeight)) { | if (IsMagneticAnomalyEnabled(config.GetChainParams().GetConsensus(), | ||||
nHeight)) { | |||||
// Size limit | // Size limit | ||||
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) < | if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) < | ||||
MIN_TX_SIZE) { | MIN_TX_SIZE) { | ||||
return state.DoS(100, false, REJECT_INVALID, "bad-txns-undersize"); | return state.DoS(100, false, REJECT_INVALID, "bad-txns-undersize"); | ||||
} | } | ||||
} | } | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 273 Lines • Show Last 20 Lines |