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 BlockValidationState; | |||||
class CBlockHeader; | class CBlockHeader; | ||||
class CTxMemPool; | 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. | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* Retrieve unbroadcast transactions from the mempool and reattempt | * Retrieve unbroadcast transactions from the mempool and reattempt | ||||
* sending to peers | * sending to peers | ||||
*/ | */ | ||||
void ReattemptInitialBroadcast(CScheduler &scheduler) const; | void ReattemptInitialBroadcast(CScheduler &scheduler) const; | ||||
private: | private: | ||||
/** | /** | ||||
* Potentially mark a node discouraged based on the contents of a | |||||
* BlockValidationState object | |||||
* | |||||
* @param[in] via_compact_block this bool is passed in because | |||||
* net_processing should punish peers differently depending on whether the | |||||
* data was provided in a compact block message or not. If the compact block | |||||
* had a valid header, but contained invalid txs, the peer should not be | |||||
* punished. See BIP 152. | |||||
* | |||||
* @return Returns true if the peer was punished (probably disconnected) | |||||
*/ | |||||
bool MaybePunishNodeForBlock(NodeId nodeid, | |||||
const BlockValidationState &state, | |||||
bool via_compact_block, | |||||
const std::string &message = ""); | |||||
/** | |||||
* Maybe disconnect a peer and discourage future connections from its | * Maybe disconnect a peer and discourage future connections from its | ||||
* address. | * address. | ||||
* | * | ||||
* @param[in] pnode The node to check. | * @param[in] pnode The node to check. | ||||
* @return True if the peer was marked for disconnection in | * @return True if the peer was marked for disconnection in | ||||
* this function | * this function | ||||
*/ | */ | ||||
bool MaybeDiscourageAndDisconnect(CNode &pnode); | bool MaybeDiscourageAndDisconnect(CNode &pnode); | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |