Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.h
// 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. | ||||
#ifndef BITCOIN_NET_PROCESSING_H | #ifndef BITCOIN_NET_PROCESSING_H | ||||
#define BITCOIN_NET_PROCESSING_H | #define BITCOIN_NET_PROCESSING_H | ||||
#include <consensus/params.h> | #include <consensus/params.h> | ||||
#include <net.h> | #include <net.h> | ||||
#include <sync.h> | #include <sync.h> | ||||
#include <validationinterface.h> | #include <validationinterface.h> | ||||
extern RecursiveMutex cs_main; | extern RecursiveMutex cs_main; | ||||
extern RecursiveMutex g_cs_orphans; | extern RecursiveMutex g_cs_orphans; | ||||
class CTxMemPool; | |||||
class ChainstateManager; | class ChainstateManager; | ||||
class Config; | class Config; | ||||
/** | /** | ||||
* Default for -maxorphantx, maximum number of orphan transactions kept in | * Default for -maxorphantx, maximum number of orphan transactions kept in | ||||
* memory. | * memory. | ||||
*/ | */ | ||||
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100; | static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100; | ||||
/** | /** | ||||
* Default number of orphan+recently-replaced txn to keep around for block | * Default number of orphan+recently-replaced txn to keep around for block | ||||
* reconstruction. | * reconstruction. | ||||
*/ | */ | ||||
static const unsigned int DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN = 100; | static const unsigned int DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN = 100; | ||||
static const bool DEFAULT_PEERBLOCKFILTERS = false; | static const bool DEFAULT_PEERBLOCKFILTERS = false; | ||||
class PeerLogicValidation final : public CValidationInterface, | class PeerLogicValidation final : public CValidationInterface, | ||||
public NetEventsInterface { | public NetEventsInterface { | ||||
private: | private: | ||||
CConnman *const connman; | CConnman *const connman; | ||||
BanMan *const m_banman; | BanMan *const m_banman; | ||||
ChainstateManager &m_chainman; | ChainstateManager &m_chainman; | ||||
CTxMemPool &m_mempool; | |||||
bool CheckIfBanned(CNode &pnode) EXCLUSIVE_LOCKS_REQUIRED(cs_main); | bool CheckIfBanned(CNode &pnode) EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
public: | public: | ||||
PeerLogicValidation(CConnman *connman, BanMan *banman, | PeerLogicValidation(CConnman *connman, BanMan *banman, | ||||
CScheduler &scheduler, ChainstateManager &chainman); | CScheduler &scheduler, ChainstateManager &chainman, | ||||
CTxMemPool &pool); | |||||
/** | /** | ||||
* Overridden from CValidationInterface. | * Overridden from CValidationInterface. | ||||
*/ | */ | ||||
void | void | ||||
BlockConnected(const std::shared_ptr<const CBlock> &pblock, | BlockConnected(const std::shared_ptr<const CBlock> &pblock, | ||||
const CBlockIndex *pindexConnected, | const CBlockIndex *pindexConnected, | ||||
const std::vector<CTransactionRef> &vtxConflicted) override; | const std::vector<CTransactionRef> &vtxConflicted) override; | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
void Misbehaving(NodeId nodeid, int howmuch, const std::string &reason = "") | void Misbehaving(NodeId nodeid, int howmuch, const std::string &reason = "") | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
/** Relay transaction to every node */ | /** Relay transaction to every node */ | ||||
void RelayTransaction(const TxId &txid, const CConnman &connman); | void RelayTransaction(const TxId &txid, const CConnman &connman); | ||||
bool ProcessMessage(const Config &config, CNode &pfrom, | bool ProcessMessage(const Config &config, CNode &pfrom, | ||||
const std::string &msg_type, CDataStream &vRecv, | const std::string &msg_type, CDataStream &vRecv, | ||||
int64_t nTimeReceived, ChainstateManager &chainman, | int64_t nTimeReceived, CTxMemPool &mempool, | ||||
CConnman &connman, BanMan *banman, | ChainstateManager &chainman, CConnman &connman, | ||||
const std::atomic<bool> &interruptMsgProc); | BanMan *banman, const std::atomic<bool> &interruptMsgProc); | ||||
#endif // BITCOIN_NET_PROCESSING_H | #endif // BITCOIN_NET_PROCESSING_H |