Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
Lint: Code style violation: '/home/tomas/src/t2/bitcoin-abc/src/net_processing.cpp' has code style errors. | |||||
// 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 "net_processing.h" | #include "net_processing.h" | ||||
#include "addrman.h" | #include "addrman.h" | ||||
#include "arith_uint256.h" | #include "arith_uint256.h" | ||||
▲ Show 20 Lines • Show All 2,145 Lines • ▼ Show 20 Lines | else if (strCommand == NetMsgType::TX) { | ||||
mempool.check(pcoinsTip); | mempool.check(pcoinsTip); | ||||
} | } | ||||
} | } | ||||
for (uint256 hash : vEraseQueue) { | for (uint256 hash : vEraseQueue) { | ||||
EraseOrphanTx(hash); | EraseOrphanTx(hash); | ||||
} | } | ||||
} else if (fMissingInputs) { | } else if (fMissingInputs) { | ||||
// It may be the case that the orphans parents have all been | |||||
// rejected. | // Pre MalFix, we would fetch the missing input transactions | ||||
bool fRejectedParents = false; | // from this peer, but post-malfix, we can't as we don't have | ||||
for (const CTxIn &txin : tx.vin) { | // the ids | ||||
if (recentRejects->contains(txin.prevout.hash)) { | |||||
fRejectedParents = true; | |||||
break; | |||||
} | |||||
} | |||||
if (!fRejectedParents) { | |||||
uint32_t nFetchFlags = GetFetchFlags( | |||||
pfrom, chainActive.Tip(), chainparams.GetConsensus()); | |||||
for (const CTxIn &txin : tx.vin) { | |||||
CInv _inv(MSG_TX | nFetchFlags, txin.prevout.hash); | |||||
pfrom->AddInventoryKnown(_inv); | |||||
if (!AlreadyHave(_inv)) { | |||||
pfrom->AskFor(_inv); | |||||
} | |||||
} | |||||
AddOrphanTx(ptx, pfrom->GetId()); | AddOrphanTx(ptx, pfrom->GetId()); | ||||
// DoS prevention: do not allow mapOrphanTransactions to grow | // DoS prevention: do not allow mapOrphanTransactions to grow | ||||
// unbounded | // unbounded | ||||
unsigned int nMaxOrphanTx = (unsigned int)std::max( | unsigned int nMaxOrphanTx = (unsigned int)std::max( | ||||
int64_t(0), | (int64_t)0, | ||||
GetArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS)); | GetArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS)); | ||||
unsigned int nEvicted = LimitOrphanTxSize(nMaxOrphanTx); | unsigned int nEvicted = LimitOrphanTxSize(nMaxOrphanTx); | ||||
if (nEvicted > 0) { | if (nEvicted > 0) | ||||
LogPrint("mempool", "mapOrphan overflow, removed %u tx\n", | LogPrint("mempool", "mapOrphan overflow, removed %u tx\n", | ||||
nEvicted); | nEvicted); | ||||
} | |||||
} else { | |||||
LogPrint("mempool", | |||||
"not keeping orphan with rejected parents %s\n", | |||||
tx.GetId().ToString()); | |||||
// We will continue to reject this tx since it has rejected | |||||
// parents so avoid re-requesting it from other peers. | |||||
recentRejects->insert(tx.GetId()); | |||||
} | |||||
} else { | } else { | ||||
if (!state.CorruptionPossible()) { | if (!state.CorruptionPossible()) { | ||||
// Do not use rejection cache for witness transactions or | // Do not use rejection cache for witness transactions or | ||||
// witness-stripped transactions, as they can have been | // witness-stripped transactions, as they can have been | ||||
// malleated. See https://github.com/bitcoin/bitcoin/issues/8279 | // malleated. See https://github.com/bitcoin/bitcoin/issues/8279 | ||||
// for details. | // for details. | ||||
assert(recentRejects); | assert(recentRejects); | ||||
recentRejects->insert(tx.GetId()); | recentRejects->insert(tx.GetId()); | ||||
▲ Show 20 Lines • Show All 1,635 Lines • Show Last 20 Lines |
'/home/tomas/src/t2/bitcoin-abc/src/net_processing.cpp' has code style errors.