|
|
@ -41,7 +41,6 @@ class CValidationInterface; |
|
|
|
class CValidationState; |
|
|
|
class CValidationState; |
|
|
|
|
|
|
|
|
|
|
|
struct PrecomputedTransactionData; |
|
|
|
struct PrecomputedTransactionData; |
|
|
|
struct CNodeStateStats; |
|
|
|
|
|
|
|
struct LockPoints; |
|
|
|
struct LockPoints; |
|
|
|
|
|
|
|
|
|
|
|
/** Default for DEFAULT_WHITELISTRELAY. */ |
|
|
|
/** Default for DEFAULT_WHITELISTRELAY. */ |
|
|
@ -206,11 +205,6 @@ static const unsigned int DEFAULT_CHECKLEVEL = 3; |
|
|
|
// Setting the target to > than 550MB will make it likely we can respect the target.
|
|
|
|
// Setting the target to > than 550MB will make it likely we can respect the target.
|
|
|
|
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024; |
|
|
|
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024; |
|
|
|
|
|
|
|
|
|
|
|
/** Register with a network node to receive its signals */ |
|
|
|
|
|
|
|
void RegisterNodeSignals(CNodeSignals& nodeSignals); |
|
|
|
|
|
|
|
/** Unregister a network node */ |
|
|
|
|
|
|
|
void UnregisterNodeSignals(CNodeSignals& nodeSignals); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Process an incoming block. This only returns after the best known valid |
|
|
|
* Process an incoming block. This only returns after the best known valid |
|
|
|
* block is made active. Note that it does not, however, guarantee that the |
|
|
|
* block is made active. Note that it does not, however, guarantee that the |
|
|
@ -240,15 +234,6 @@ bool InitBlockIndex(const CChainParams& chainparams); |
|
|
|
bool LoadBlockIndex(); |
|
|
|
bool LoadBlockIndex(); |
|
|
|
/** Unload database information */ |
|
|
|
/** Unload database information */ |
|
|
|
void UnloadBlockIndex(); |
|
|
|
void UnloadBlockIndex(); |
|
|
|
/** Process protocol messages received from a given node */ |
|
|
|
|
|
|
|
bool ProcessMessages(CNode* pfrom, CConnman& connman); |
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Send queued protocol messages to be sent to a give node. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param[in] pto The node which we are sending messages to. |
|
|
|
|
|
|
|
* @param[in] connman The connection manager for that node. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
bool SendMessages(CNode* pto, CConnman& connman); |
|
|
|
|
|
|
|
/** Run an instance of the script checking thread */ |
|
|
|
/** Run an instance of the script checking thread */ |
|
|
|
void ThreadScriptCheck(); |
|
|
|
void ThreadScriptCheck(); |
|
|
|
/** Check whether we are doing an initial block download (synchronizing from disk or network) */ |
|
|
|
/** Check whether we are doing an initial block download (synchronizing from disk or network) */ |
|
|
@ -291,10 +276,6 @@ void UnlinkPrunedFiles(std::set<int>& setFilesToPrune); |
|
|
|
|
|
|
|
|
|
|
|
/** Create a new block index entry for a given block hash */ |
|
|
|
/** Create a new block index entry for a given block hash */ |
|
|
|
CBlockIndex * InsertBlockIndex(uint256 hash); |
|
|
|
CBlockIndex * InsertBlockIndex(uint256 hash); |
|
|
|
/** Get statistics from node state */ |
|
|
|
|
|
|
|
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats); |
|
|
|
|
|
|
|
/** Increase a node's misbehavior score. */ |
|
|
|
|
|
|
|
void Misbehaving(NodeId nodeid, int howmuch); |
|
|
|
|
|
|
|
/** Flush all state, indexes and buffers to disk. */ |
|
|
|
/** Flush all state, indexes and buffers to disk. */ |
|
|
|
void FlushStateToDisk(); |
|
|
|
void FlushStateToDisk(); |
|
|
|
/** Prune block files and flush state to disk. */ |
|
|
|
/** Prune block files and flush state to disk. */ |
|
|
@ -310,13 +291,6 @@ std::string FormatStateMessage(const CValidationState &state); |
|
|
|
/** Get the BIP9 state for a given deployment at the current tip. */ |
|
|
|
/** Get the BIP9 state for a given deployment at the current tip. */ |
|
|
|
ThresholdState VersionBitsTipState(const Consensus::Params& params, Consensus::DeploymentPos pos); |
|
|
|
ThresholdState VersionBitsTipState(const Consensus::Params& params, Consensus::DeploymentPos pos); |
|
|
|
|
|
|
|
|
|
|
|
struct CNodeStateStats { |
|
|
|
|
|
|
|
int nMisbehavior; |
|
|
|
|
|
|
|
int nSyncHeight; |
|
|
|
|
|
|
|
int nCommonHeight; |
|
|
|
|
|
|
|
std::vector<int> vHeightInFlight; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -545,4 +519,34 @@ static const unsigned int REJECT_ALREADY_KNOWN = 0x101; |
|
|
|
/** Transaction conflicts with a transaction already known */ |
|
|
|
/** Transaction conflicts with a transaction already known */ |
|
|
|
static const unsigned int REJECT_CONFLICT = 0x102; |
|
|
|
static const unsigned int REJECT_CONFLICT = 0x102; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The following things handle network-processing logic
|
|
|
|
|
|
|
|
// (and should be moved to a separate file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Register with a network node to receive its signals */ |
|
|
|
|
|
|
|
void RegisterNodeSignals(CNodeSignals& nodeSignals); |
|
|
|
|
|
|
|
/** Unregister a network node */ |
|
|
|
|
|
|
|
void UnregisterNodeSignals(CNodeSignals& nodeSignals); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct CNodeStateStats { |
|
|
|
|
|
|
|
int nMisbehavior; |
|
|
|
|
|
|
|
int nSyncHeight; |
|
|
|
|
|
|
|
int nCommonHeight; |
|
|
|
|
|
|
|
std::vector<int> vHeightInFlight; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Get statistics from node state */ |
|
|
|
|
|
|
|
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats); |
|
|
|
|
|
|
|
/** Increase a node's misbehavior score. */ |
|
|
|
|
|
|
|
void Misbehaving(NodeId nodeid, int howmuch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Process protocol messages received from a given node */ |
|
|
|
|
|
|
|
bool ProcessMessages(CNode* pfrom, CConnman& connman); |
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Send queued protocol messages to be sent to a give node. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param[in] pto The node which we are sending messages to. |
|
|
|
|
|
|
|
* @param[in] connman The connection manager for that node. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
bool SendMessages(CNode* pto, CConnman& connman); |
|
|
|
|
|
|
|
|
|
|
|
#endif // BITCOIN_MAIN_H
|
|
|
|
#endif // BITCOIN_MAIN_H
|
|
|
|