net_processing: Move comments to declarations
Also: - Remove extraneous blank line
This commit is contained in:
1 parent
07156eb387
commit
1dd8ed7a84
1 file changed
+51
-50
+51
-50
@@ -475,19 +475,70 @@ private:
|
|||||||
/** Offset into vExtraTxnForCompact to insert the next tx */
|
/** Offset into vExtraTxnForCompact to insert the next tx */
|
||||||
size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0;
|
size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0;
|
||||||
|
|
||||||
|
/** Check whether the last unknown block a peer advertised is not yet known. */
|
||||||
void ProcessBlockAvailability(NodeId nodeid) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
void ProcessBlockAvailability(NodeId nodeid) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
|
/** Update tracking information about which blocks a peer is assumed to have. */
|
||||||
void UpdateBlockAvailability(NodeId nodeid, const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
void UpdateBlockAvailability(NodeId nodeid, const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
bool CanDirectFetch() EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
bool CanDirectFetch() EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To prevent fingerprinting attacks, only send blocks/headers outside of
|
||||||
|
* the active chain if they are no more than a month older (both in time,
|
||||||
|
* and in best equivalent proof of work) than the best header chain we know
|
||||||
|
* about and we fully-validated them at some point.
|
||||||
|
*/
|
||||||
bool BlockRequestAllowed(const CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
bool BlockRequestAllowed(const CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
bool AlreadyHaveBlock(const uint256& block_hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
bool AlreadyHaveBlock(const uint256& block_hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
void ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv& inv);
|
void ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv& inv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validation logic for compact filters request handling.
|
||||||
|
*
|
||||||
|
* May disconnect from the peer in the case of a bad request.
|
||||||
|
*
|
||||||
|
* @param[in] peer The peer that we received the request from
|
||||||
|
* @param[in] filter_type The filter type the request is for. Must be basic filters.
|
||||||
|
* @param[in] start_height The start height for the request
|
||||||
|
* @param[in] stop_hash The stop_hash for the request
|
||||||
|
* @param[in] max_height_diff The maximum number of items permitted to request, as specified in BIP 157
|
||||||
|
* @param[out] stop_index The CBlockIndex for the stop_hash block, if the request can be serviced.
|
||||||
|
* @param[out] filter_index The filter index, if the request can be serviced.
|
||||||
|
* @return True if the request can be serviced.
|
||||||
|
*/
|
||||||
bool PrepareBlockFilterRequest(CNode& peer,
|
bool PrepareBlockFilterRequest(CNode& peer,
|
||||||
BlockFilterType filter_type, uint32_t start_height,
|
BlockFilterType filter_type, uint32_t start_height,
|
||||||
const uint256& stop_hash, uint32_t max_height_diff,
|
const uint256& stop_hash, uint32_t max_height_diff,
|
||||||
const CBlockIndex*& stop_index,
|
const CBlockIndex*& stop_index,
|
||||||
BlockFilterIndex*& filter_index);
|
BlockFilterIndex*& filter_index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle a cfilters request.
|
||||||
|
*
|
||||||
|
* May disconnect from the peer in the case of a bad request.
|
||||||
|
*
|
||||||
|
* @param[in] peer The peer that we received the request from
|
||||||
|
* @param[in] vRecv The raw message received
|
||||||
|
*/
|
||||||
void ProcessGetCFilters(CNode& peer, CDataStream& vRecv);
|
void ProcessGetCFilters(CNode& peer, CDataStream& vRecv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle a cfheaders request.
|
||||||
|
*
|
||||||
|
* May disconnect from the peer in the case of a bad request.
|
||||||
|
*
|
||||||
|
* @param[in] peer The peer that we received the request from
|
||||||
|
* @param[in] vRecv The raw message received
|
||||||
|
*/
|
||||||
void ProcessGetCFHeaders(CNode& peer, CDataStream& vRecv);
|
void ProcessGetCFHeaders(CNode& peer, CDataStream& vRecv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle a getcfcheckpt request.
|
||||||
|
*
|
||||||
|
* May disconnect from the peer in the case of a bad request.
|
||||||
|
*
|
||||||
|
* @param[in] peer The peer that we received the request from
|
||||||
|
* @param[in] vRecv The raw message received
|
||||||
|
*/
|
||||||
void ProcessGetCFCheckPt(CNode& peer, CDataStream& vRecv);
|
void ProcessGetCFCheckPt(CNode& peer, CDataStream& vRecv);
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
@@ -741,7 +792,6 @@ static bool PeerHasHeader(CNodeState *state, const CBlockIndex *pindex) EXCLUSIV
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check whether the last unknown block a peer advertised is not yet known. */
|
|
||||||
void PeerManagerImpl::ProcessBlockAvailability(NodeId nodeid) {
|
void PeerManagerImpl::ProcessBlockAvailability(NodeId nodeid) {
|
||||||
CNodeState *state = State(nodeid);
|
CNodeState *state = State(nodeid);
|
||||||
assert(state != nullptr);
|
assert(state != nullptr);
|
||||||
@@ -757,7 +807,6 @@ void PeerManagerImpl::ProcessBlockAvailability(NodeId nodeid) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update tracking information about which blocks a peer is assumed to have. */
|
|
||||||
void PeerManagerImpl::UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
|
void PeerManagerImpl::UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
|
||||||
CNodeState *state = State(nodeid);
|
CNodeState *state = State(nodeid);
|
||||||
assert(state != nullptr);
|
assert(state != nullptr);
|
||||||
@@ -1182,16 +1231,6 @@ bool PeerManagerImpl::MaybePunishNodeForTx(NodeId nodeid, const TxValidationStat
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// blockchain -> download logic notification
|
|
||||||
//
|
|
||||||
|
|
||||||
// To prevent fingerprinting attacks, only send blocks/headers outside of the
|
|
||||||
// active chain if they are no more than a month older (both in time, and in
|
|
||||||
// best equivalent proof of work) than the best header chain we know about and
|
|
||||||
// we fully-validated them at some point.
|
|
||||||
bool PeerManagerImpl::BlockRequestAllowed(const CBlockIndex* pindex)
|
bool PeerManagerImpl::BlockRequestAllowed(const CBlockIndex* pindex)
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
@@ -2091,20 +2130,6 @@ void PeerManagerImpl::ProcessOrphanTx(std::set<uint256>& orphan_work_set)
|
|||||||
m_mempool.check(m_chainman.ActiveChainstate());
|
m_mempool.check(m_chainman.ActiveChainstate());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Validation logic for compact filters request handling.
|
|
||||||
*
|
|
||||||
* May disconnect from the peer in the case of a bad request.
|
|
||||||
*
|
|
||||||
* @param[in] peer The peer that we received the request from
|
|
||||||
* @param[in] filter_type The filter type the request is for. Must be basic filters.
|
|
||||||
* @param[in] start_height The start height for the request
|
|
||||||
* @param[in] stop_hash The stop_hash for the request
|
|
||||||
* @param[in] max_height_diff The maximum number of items permitted to request, as specified in BIP 157
|
|
||||||
* @param[out] stop_index The CBlockIndex for the stop_hash block, if the request can be serviced.
|
|
||||||
* @param[out] filter_index The filter index, if the request can be serviced.
|
|
||||||
* @return True if the request can be serviced.
|
|
||||||
*/
|
|
||||||
bool PeerManagerImpl::PrepareBlockFilterRequest(CNode& peer,
|
bool PeerManagerImpl::PrepareBlockFilterRequest(CNode& peer,
|
||||||
BlockFilterType filter_type, uint32_t start_height,
|
BlockFilterType filter_type, uint32_t start_height,
|
||||||
const uint256& stop_hash, uint32_t max_height_diff,
|
const uint256& stop_hash, uint32_t max_height_diff,
|
||||||
@@ -2158,14 +2183,6 @@ bool PeerManagerImpl::PrepareBlockFilterRequest(CNode& peer,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle a cfilters request.
|
|
||||||
*
|
|
||||||
* May disconnect from the peer in the case of a bad request.
|
|
||||||
*
|
|
||||||
* @param[in] peer The peer that we received the request from
|
|
||||||
* @param[in] vRecv The raw message received
|
|
||||||
*/
|
|
||||||
void PeerManagerImpl::ProcessGetCFilters(CNode& peer, CDataStream& vRecv)
|
void PeerManagerImpl::ProcessGetCFilters(CNode& peer, CDataStream& vRecv)
|
||||||
{
|
{
|
||||||
uint8_t filter_type_ser;
|
uint8_t filter_type_ser;
|
||||||
@@ -2197,14 +2214,6 @@ void PeerManagerImpl::ProcessGetCFilters(CNode& peer, CDataStream& vRecv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle a cfheaders request.
|
|
||||||
*
|
|
||||||
* May disconnect from the peer in the case of a bad request.
|
|
||||||
*
|
|
||||||
* @param[in] peer The peer that we received the request from
|
|
||||||
* @param[in] vRecv The raw message received
|
|
||||||
*/
|
|
||||||
void PeerManagerImpl::ProcessGetCFHeaders(CNode& peer, CDataStream& vRecv)
|
void PeerManagerImpl::ProcessGetCFHeaders(CNode& peer, CDataStream& vRecv)
|
||||||
{
|
{
|
||||||
uint8_t filter_type_ser;
|
uint8_t filter_type_ser;
|
||||||
@@ -2249,14 +2258,6 @@ void PeerManagerImpl::ProcessGetCFHeaders(CNode& peer, CDataStream& vRecv)
|
|||||||
m_connman.PushMessage(&peer, std::move(msg));
|
m_connman.PushMessage(&peer, std::move(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle a getcfcheckpt request.
|
|
||||||
*
|
|
||||||
* May disconnect from the peer in the case of a bad request.
|
|
||||||
*
|
|
||||||
* @param[in] peer The peer that we received the request from
|
|
||||||
* @param[in] vRecv The raw message received
|
|
||||||
*/
|
|
||||||
void PeerManagerImpl::ProcessGetCFCheckPt(CNode& peer, CDataStream& vRecv)
|
void PeerManagerImpl::ProcessGetCFCheckPt(CNode& peer, CDataStream& vRecv)
|
||||||
{
|
{
|
||||||
uint8_t filter_type_ser;
|
uint8_t filter_type_ser;
|
||||||
|
|||||||
Reference in new issue
Block a user