Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core 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 <txmempool.h> | #include <txmempool.h> | ||||
#include <chain.h> | #include <chain.h> | ||||
#include <chainparams.h> // for GetConsensus. | #include <chainparams.h> // for GetConsensus. | ||||
#include <clientversion.h> | #include <clientversion.h> | ||||
#include <coins.h> | |||||
#include <config.h> | #include <config.h> | ||||
#include <consensus/consensus.h> | #include <consensus/consensus.h> | ||||
#include <consensus/tx_verify.h> | #include <consensus/tx_verify.h> | ||||
#include <consensus/validation.h> | #include <consensus/validation.h> | ||||
#include <policy/fees.h> | #include <policy/fees.h> | ||||
#include <policy/policy.h> | #include <policy/policy.h> | ||||
#include <policy/settings.h> | #include <policy/settings.h> | ||||
#include <reverse_iterator.h> | #include <reverse_iterator.h> | ||||
▲ Show 20 Lines • Show All 846 Lines • ▼ Show 20 Lines | for (const auto &it : GetSortedDepthAndScore()) { | ||||
// Not used. CheckTxInputs() should always pass | // Not used. CheckTxInputs() should always pass | ||||
TxValidationState dummy_state; | TxValidationState dummy_state; | ||||
Amount txfee{Amount::zero()}; | Amount txfee{Amount::zero()}; | ||||
bool fCheckResult = | bool fCheckResult = | ||||
tx.IsCoinBase() || | tx.IsCoinBase() || | ||||
Consensus::CheckTxInputs(tx, dummy_state, mempoolDuplicate, | Consensus::CheckTxInputs(tx, dummy_state, mempoolDuplicate, | ||||
spendheight, txfee); | spendheight, txfee); | ||||
assert(fCheckResult); | assert(fCheckResult); | ||||
UpdateCoins(mempoolDuplicate, tx, std::numeric_limits<int>::max()); | for (const auto &input : tx.vin) { | ||||
mempoolDuplicate.SpendCoin(input.prevout); | |||||
} | |||||
AddCoins(mempoolDuplicate, tx, std::numeric_limits<int>::max()); | |||||
} | } | ||||
for (auto it = mapNextTx.cbegin(); it != mapNextTx.cend(); it++) { | for (auto it = mapNextTx.cbegin(); it != mapNextTx.cend(); it++) { | ||||
const TxId &txid = it->second->GetId(); | const TxId &txid = it->second->GetId(); | ||||
indexed_transaction_set::const_iterator it2 = mapTx.find(txid); | indexed_transaction_set::const_iterator it2 = mapTx.find(txid); | ||||
const CTransaction &tx = it2->GetTx(); | const CTransaction &tx = it2->GetTx(); | ||||
assert(it2 != mapTx.end()); | assert(it2 != mapTx.end()); | ||||
assert(&tx == it->second); | assert(&tx == it->second); | ||||
▲ Show 20 Lines • Show All 617 Lines • Show Last 20 Lines |