@@ -1991,7 +1991,7 @@ void static ProcessOrphanTx(CConnman* connman, CTxMemPool& mempool, std::set<uin
1991
1991
*
1992
1992
* May disconnect from the peer in the case of a bad request.
1993
1993
*
1994
- * @param[in] pfrom The peer that we received the request from
1994
+ * @param[in] peer The peer that we received the request from
1995
1995
* @param[in] chain_params Chain parameters
1996
1996
* @param[in] filter_type The filter type the request is for. Must be basic filters.
1997
1997
* @param[in] start_height The start height for the request
@@ -2001,7 +2001,7 @@ void static ProcessOrphanTx(CConnman* connman, CTxMemPool& mempool, std::set<uin
2001
2001
* @param[out] filter_index The filter index, if the request can be serviced.
2002
2002
* @return True if the request can be serviced.
2003
2003
*/
2004
- static bool PrepareBlockFilterRequest (CNode& pfrom , const CChainParams& chain_params,
2004
+ static bool PrepareBlockFilterRequest (CNode& peer , const CChainParams& chain_params,
2005
2005
BlockFilterType filter_type, uint32_t start_height,
2006
2006
const uint256& stop_hash, uint32_t max_height_diff,
2007
2007
const CBlockIndex*& stop_index,
@@ -2012,8 +2012,8 @@ static bool PrepareBlockFilterRequest(CNode& pfrom, const CChainParams& chain_pa
2012
2012
gArgs .GetBoolArg (" -peerblockfilters" , DEFAULT_PEERBLOCKFILTERS));
2013
2013
if (!supported_filter_type) {
2014
2014
LogPrint (BCLog::NET, " peer %d requested unsupported block filter type: %d\n " ,
2015
- pfrom .GetId (), static_cast <uint8_t >(filter_type));
2016
- pfrom .fDisconnect = true ;
2015
+ peer .GetId (), static_cast <uint8_t >(filter_type));
2016
+ peer .fDisconnect = true ;
2017
2017
return false ;
2018
2018
}
2019
2019
@@ -2024,8 +2024,8 @@ static bool PrepareBlockFilterRequest(CNode& pfrom, const CChainParams& chain_pa
2024
2024
// Check that the stop block exists and the peer would be allowed to fetch it.
2025
2025
if (!stop_index || !BlockRequestAllowed (stop_index, chain_params.GetConsensus ())) {
2026
2026
LogPrint (BCLog::NET, " peer %d requested invalid block hash: %s\n " ,
2027
- pfrom .GetId (), stop_hash.ToString ());
2028
- pfrom .fDisconnect = true ;
2027
+ peer .GetId (), stop_hash.ToString ());
2028
+ peer .fDisconnect = true ;
2029
2029
return false ;
2030
2030
}
2031
2031
}
@@ -2034,14 +2034,14 @@ static bool PrepareBlockFilterRequest(CNode& pfrom, const CChainParams& chain_pa
2034
2034
if (start_height > stop_height) {
2035
2035
LogPrint (BCLog::NET, " peer %d sent invalid getcfilters/getcfheaders with " /* Continued */
2036
2036
" start height %d and stop height %d\n " ,
2037
- pfrom .GetId (), start_height, stop_height);
2038
- pfrom .fDisconnect = true ;
2037
+ peer .GetId (), start_height, stop_height);
2038
+ peer .fDisconnect = true ;
2039
2039
return false ;
2040
2040
}
2041
2041
if (stop_height - start_height >= max_height_diff) {
2042
2042
LogPrint (BCLog::NET, " peer %d requested too many cfilters/cfheaders: %d / %d\n " ,
2043
- pfrom .GetId (), stop_height - start_height + 1 , max_height_diff);
2044
- pfrom .fDisconnect = true ;
2043
+ peer .GetId (), stop_height - start_height + 1 , max_height_diff);
2044
+ peer .fDisconnect = true ;
2045
2045
return false ;
2046
2046
}
2047
2047
@@ -2059,12 +2059,12 @@ static bool PrepareBlockFilterRequest(CNode& pfrom, const CChainParams& chain_pa
2059
2059
*
2060
2060
* May disconnect from the peer in the case of a bad request.
2061
2061
*
2062
- * @param[in] pfrom The peer that we received the request from
2062
+ * @param[in] peer The peer that we received the request from
2063
2063
* @param[in] vRecv The raw message received
2064
2064
* @param[in] chain_params Chain parameters
2065
2065
* @param[in] connman Pointer to the connection manager
2066
2066
*/
2067
- static void ProcessGetCFilters (CNode& pfrom , CDataStream& vRecv, const CChainParams& chain_params,
2067
+ static void ProcessGetCFilters (CNode& peer , CDataStream& vRecv, const CChainParams& chain_params,
2068
2068
CConnman& connman)
2069
2069
{
2070
2070
uint8_t filter_type_ser;
@@ -2077,23 +2077,22 @@ static void ProcessGetCFilters(CNode& pfrom, CDataStream& vRecv, const CChainPar
2077
2077
2078
2078
const CBlockIndex* stop_index;
2079
2079
BlockFilterIndex* filter_index;
2080
- if (!PrepareBlockFilterRequest (pfrom , chain_params, filter_type, start_height, stop_hash,
2080
+ if (!PrepareBlockFilterRequest (peer , chain_params, filter_type, start_height, stop_hash,
2081
2081
MAX_GETCFILTERS_SIZE, stop_index, filter_index)) {
2082
2082
return ;
2083
2083
}
2084
2084
2085
2085
std::vector<BlockFilter> filters;
2086
-
2087
2086
if (!filter_index->LookupFilterRange (start_height, stop_index, filters)) {
2088
2087
LogPrint (BCLog::NET, " Failed to find block filter in index: filter_type=%s, start_height=%d, stop_hash=%s\n " ,
2089
2088
BlockFilterTypeName (filter_type), start_height, stop_hash.ToString ());
2090
2089
return ;
2091
2090
}
2092
2091
2093
2092
for (const auto & filter : filters) {
2094
- CSerializedNetMsg msg = CNetMsgMaker (pfrom .GetSendVersion ())
2093
+ CSerializedNetMsg msg = CNetMsgMaker (peer .GetSendVersion ())
2095
2094
.Make (NetMsgType::CFILTER, filter);
2096
- connman.PushMessage (&pfrom , std::move (msg));
2095
+ connman.PushMessage (&peer , std::move (msg));
2097
2096
}
2098
2097
}
2099
2098
@@ -2102,12 +2101,12 @@ static void ProcessGetCFilters(CNode& pfrom, CDataStream& vRecv, const CChainPar
2102
2101
*
2103
2102
* May disconnect from the peer in the case of a bad request.
2104
2103
*
2105
- * @param[in] pfrom The peer that we received the request from
2104
+ * @param[in] peer The peer that we received the request from
2106
2105
* @param[in] vRecv The raw message received
2107
2106
* @param[in] chain_params Chain parameters
2108
2107
* @param[in] connman Pointer to the connection manager
2109
2108
*/
2110
- static void ProcessGetCFHeaders (CNode& pfrom , CDataStream& vRecv, const CChainParams& chain_params,
2109
+ static void ProcessGetCFHeaders (CNode& peer , CDataStream& vRecv, const CChainParams& chain_params,
2111
2110
CConnman& connman)
2112
2111
{
2113
2112
uint8_t filter_type_ser;
@@ -2120,7 +2119,7 @@ static void ProcessGetCFHeaders(CNode& pfrom, CDataStream& vRecv, const CChainPa
2120
2119
2121
2120
const CBlockIndex* stop_index;
2122
2121
BlockFilterIndex* filter_index;
2123
- if (!PrepareBlockFilterRequest (pfrom , chain_params, filter_type, start_height, stop_hash,
2122
+ if (!PrepareBlockFilterRequest (peer , chain_params, filter_type, start_height, stop_hash,
2124
2123
MAX_GETCFHEADERS_SIZE, stop_index, filter_index)) {
2125
2124
return ;
2126
2125
}
@@ -2143,26 +2142,26 @@ static void ProcessGetCFHeaders(CNode& pfrom, CDataStream& vRecv, const CChainPa
2143
2142
return ;
2144
2143
}
2145
2144
2146
- CSerializedNetMsg msg = CNetMsgMaker (pfrom .GetSendVersion ())
2145
+ CSerializedNetMsg msg = CNetMsgMaker (peer .GetSendVersion ())
2147
2146
.Make (NetMsgType::CFHEADERS,
2148
2147
filter_type_ser,
2149
2148
stop_index->GetBlockHash (),
2150
2149
prev_header,
2151
2150
filter_hashes);
2152
- connman.PushMessage (&pfrom , std::move (msg));
2151
+ connman.PushMessage (&peer , std::move (msg));
2153
2152
}
2154
2153
2155
2154
/* *
2156
2155
* Handle a getcfcheckpt request.
2157
2156
*
2158
2157
* May disconnect from the peer in the case of a bad request.
2159
2158
*
2160
- * @param[in] pfrom The peer that we received the request from
2159
+ * @param[in] peer The peer that we received the request from
2161
2160
* @param[in] vRecv The raw message received
2162
2161
* @param[in] chain_params Chain parameters
2163
2162
* @param[in] connman Pointer to the connection manager
2164
2163
*/
2165
- static void ProcessGetCFCheckPt (CNode& pfrom , CDataStream& vRecv, const CChainParams& chain_params,
2164
+ static void ProcessGetCFCheckPt (CNode& peer , CDataStream& vRecv, const CChainParams& chain_params,
2166
2165
CConnman& connman)
2167
2166
{
2168
2167
uint8_t filter_type_ser;
@@ -2174,7 +2173,7 @@ static void ProcessGetCFCheckPt(CNode& pfrom, CDataStream& vRecv, const CChainPa
2174
2173
2175
2174
const CBlockIndex* stop_index;
2176
2175
BlockFilterIndex* filter_index;
2177
- if (!PrepareBlockFilterRequest (pfrom , chain_params, filter_type, /* start_height=*/ 0 , stop_hash,
2176
+ if (!PrepareBlockFilterRequest (peer , chain_params, filter_type, /* start_height=*/ 0 , stop_hash,
2178
2177
/* max_height_diff=*/ std::numeric_limits<uint32_t >::max (),
2179
2178
stop_index, filter_index)) {
2180
2179
return ;
@@ -2195,12 +2194,12 @@ static void ProcessGetCFCheckPt(CNode& pfrom, CDataStream& vRecv, const CChainPa
2195
2194
}
2196
2195
}
2197
2196
2198
- CSerializedNetMsg msg = CNetMsgMaker (pfrom .GetSendVersion ())
2197
+ CSerializedNetMsg msg = CNetMsgMaker (peer .GetSendVersion ())
2199
2198
.Make (NetMsgType::CFCHECKPT,
2200
2199
filter_type_ser,
2201
2200
stop_index->GetBlockHash (),
2202
2201
headers);
2203
- connman.PushMessage (&pfrom , std::move (msg));
2202
+ connman.PushMessage (&peer , std::move (msg));
2204
2203
}
2205
2204
2206
2205
bool ProcessMessage (CNode* pfrom, const std::string& msg_type, CDataStream& vRecv, int64_t nTimeReceived, const CChainParams& chainparams, ChainstateManager& chainman, CTxMemPool& mempool, CConnman* connman, BanMan* banman, const std::atomic<bool >& interruptMsgProc)
0 commit comments