@@ -2091,7 +2091,7 @@ void static ProcessOrphanTx(CConnman& connman, CTxMemPool& mempool, std::set<uin
2091
2091
*
2092
2092
* May disconnect from the peer in the case of a bad request.
2093
2093
*
2094
- * @param[in] pfrom The peer that we received the request from
2094
+ * @param[in] peer The peer that we received the request from
2095
2095
* @param[in] chain_params Chain parameters
2096
2096
* @param[in] filter_type The filter type the request is for. Must be basic filters.
2097
2097
* @param[in] start_height The start height for the request
@@ -2101,19 +2101,19 @@ void static ProcessOrphanTx(CConnman& connman, CTxMemPool& mempool, std::set<uin
2101
2101
* @param[out] filter_index The filter index, if the request can be serviced.
2102
2102
* @return True if the request can be serviced.
2103
2103
*/
2104
- static bool PrepareBlockFilterRequest (CNode& pfrom , const CChainParams& chain_params,
2104
+ static bool PrepareBlockFilterRequest (CNode& peer , const CChainParams& chain_params,
2105
2105
BlockFilterType filter_type, uint32_t start_height,
2106
2106
const uint256& stop_hash, uint32_t max_height_diff,
2107
2107
const CBlockIndex*& stop_index,
2108
2108
BlockFilterIndex*& filter_index)
2109
2109
{
2110
2110
const bool supported_filter_type =
2111
2111
(filter_type == BlockFilterType::BASIC &&
2112
- gArgs . GetBoolArg ( " -peerblockfilters " , DEFAULT_PEERBLOCKFILTERS ));
2112
+ (peer. GetLocalServices () & NODE_COMPACT_FILTERS ));
2113
2113
if (!supported_filter_type) {
2114
2114
LogPrint (BCLog::NET, " peer %d requested unsupported block filter type: %d\n " ,
2115
- pfrom .GetId (), static_cast <uint8_t >(filter_type));
2116
- pfrom .fDisconnect = true ;
2115
+ peer .GetId (), static_cast <uint8_t >(filter_type));
2116
+ peer .fDisconnect = true ;
2117
2117
return false ;
2118
2118
}
2119
2119
@@ -2124,8 +2124,8 @@ static bool PrepareBlockFilterRequest(CNode& pfrom, const CChainParams& chain_pa
2124
2124
// Check that the stop block exists and the peer would be allowed to fetch it.
2125
2125
if (!stop_index || !BlockRequestAllowed (stop_index, chain_params.GetConsensus ())) {
2126
2126
LogPrint (BCLog::NET, " peer %d requested invalid block hash: %s\n " ,
2127
- pfrom .GetId (), stop_hash.ToString ());
2128
- pfrom .fDisconnect = true ;
2127
+ peer .GetId (), stop_hash.ToString ());
2128
+ peer .fDisconnect = true ;
2129
2129
return false ;
2130
2130
}
2131
2131
}
@@ -2134,14 +2134,14 @@ static bool PrepareBlockFilterRequest(CNode& pfrom, const CChainParams& chain_pa
2134
2134
if (start_height > stop_height) {
2135
2135
LogPrint (BCLog::NET, " peer %d sent invalid getcfilters/getcfheaders with " /* Continued */
2136
2136
" start height %d and stop height %d\n " ,
2137
- pfrom .GetId (), start_height, stop_height);
2138
- pfrom .fDisconnect = true ;
2137
+ peer .GetId (), start_height, stop_height);
2138
+ peer .fDisconnect = true ;
2139
2139
return false ;
2140
2140
}
2141
2141
if (stop_height - start_height >= max_height_diff) {
2142
2142
LogPrint (BCLog::NET, " peer %d requested too many cfilters/cfheaders: %d / %d\n " ,
2143
- pfrom .GetId (), stop_height - start_height + 1 , max_height_diff);
2144
- pfrom .fDisconnect = true ;
2143
+ peer .GetId (), stop_height - start_height + 1 , max_height_diff);
2144
+ peer .fDisconnect = true ;
2145
2145
return false ;
2146
2146
}
2147
2147
@@ -2159,12 +2159,12 @@ static bool PrepareBlockFilterRequest(CNode& pfrom, const CChainParams& chain_pa
2159
2159
*
2160
2160
* May disconnect from the peer in the case of a bad request.
2161
2161
*
2162
- * @param[in] pfrom The peer that we received the request from
2162
+ * @param[in] peer The peer that we received the request from
2163
2163
* @param[in] vRecv The raw message received
2164
2164
* @param[in] chain_params Chain parameters
2165
2165
* @param[in] connman Pointer to the connection manager
2166
2166
*/
2167
- static void ProcessGetCFilters (CNode& pfrom , CDataStream& vRecv, const CChainParams& chain_params,
2167
+ static void ProcessGetCFilters (CNode& peer , CDataStream& vRecv, const CChainParams& chain_params,
2168
2168
CConnman& connman)
2169
2169
{
2170
2170
uint8_t filter_type_ser;
@@ -2177,23 +2177,22 @@ static void ProcessGetCFilters(CNode& pfrom, CDataStream& vRecv, const CChainPar
2177
2177
2178
2178
const CBlockIndex* stop_index;
2179
2179
BlockFilterIndex* filter_index;
2180
- if (!PrepareBlockFilterRequest (pfrom , chain_params, filter_type, start_height, stop_hash,
2180
+ if (!PrepareBlockFilterRequest (peer , chain_params, filter_type, start_height, stop_hash,
2181
2181
MAX_GETCFILTERS_SIZE, stop_index, filter_index)) {
2182
2182
return ;
2183
2183
}
2184
2184
2185
2185
std::vector<BlockFilter> filters;
2186
-
2187
2186
if (!filter_index->LookupFilterRange (start_height, stop_index, filters)) {
2188
2187
LogPrint (BCLog::NET, " Failed to find block filter in index: filter_type=%s, start_height=%d, stop_hash=%s\n " ,
2189
2188
BlockFilterTypeName (filter_type), start_height, stop_hash.ToString ());
2190
2189
return ;
2191
2190
}
2192
2191
2193
2192
for (const auto & filter : filters) {
2194
- CSerializedNetMsg msg = CNetMsgMaker (pfrom .GetSendVersion ())
2193
+ CSerializedNetMsg msg = CNetMsgMaker (peer .GetSendVersion ())
2195
2194
.Make (NetMsgType::CFILTER, filter);
2196
- connman.PushMessage (&pfrom , std::move (msg));
2195
+ connman.PushMessage (&peer , std::move (msg));
2197
2196
}
2198
2197
}
2199
2198
@@ -2202,12 +2201,12 @@ static void ProcessGetCFilters(CNode& pfrom, CDataStream& vRecv, const CChainPar
2202
2201
*
2203
2202
* May disconnect from the peer in the case of a bad request.
2204
2203
*
2205
- * @param[in] pfrom The peer that we received the request from
2204
+ * @param[in] peer The peer that we received the request from
2206
2205
* @param[in] vRecv The raw message received
2207
2206
* @param[in] chain_params Chain parameters
2208
2207
* @param[in] connman Pointer to the connection manager
2209
2208
*/
2210
- static void ProcessGetCFHeaders (CNode& pfrom , CDataStream& vRecv, const CChainParams& chain_params,
2209
+ static void ProcessGetCFHeaders (CNode& peer , CDataStream& vRecv, const CChainParams& chain_params,
2211
2210
CConnman& connman)
2212
2211
{
2213
2212
uint8_t filter_type_ser;
@@ -2220,7 +2219,7 @@ static void ProcessGetCFHeaders(CNode& pfrom, CDataStream& vRecv, const CChainPa
2220
2219
2221
2220
const CBlockIndex* stop_index;
2222
2221
BlockFilterIndex* filter_index;
2223
- if (!PrepareBlockFilterRequest (pfrom , chain_params, filter_type, start_height, stop_hash,
2222
+ if (!PrepareBlockFilterRequest (peer , chain_params, filter_type, start_height, stop_hash,
2224
2223
MAX_GETCFHEADERS_SIZE, stop_index, filter_index)) {
2225
2224
return ;
2226
2225
}
@@ -2243,26 +2242,26 @@ static void ProcessGetCFHeaders(CNode& pfrom, CDataStream& vRecv, const CChainPa
2243
2242
return ;
2244
2243
}
2245
2244
2246
- CSerializedNetMsg msg = CNetMsgMaker (pfrom .GetSendVersion ())
2245
+ CSerializedNetMsg msg = CNetMsgMaker (peer .GetSendVersion ())
2247
2246
.Make (NetMsgType::CFHEADERS,
2248
2247
filter_type_ser,
2249
2248
stop_index->GetBlockHash (),
2250
2249
prev_header,
2251
2250
filter_hashes);
2252
- connman.PushMessage (&pfrom , std::move (msg));
2251
+ connman.PushMessage (&peer , std::move (msg));
2253
2252
}
2254
2253
2255
2254
/* *
2256
2255
* Handle a getcfcheckpt request.
2257
2256
*
2258
2257
* May disconnect from the peer in the case of a bad request.
2259
2258
*
2260
- * @param[in] pfrom The peer that we received the request from
2259
+ * @param[in] peer The peer that we received the request from
2261
2260
* @param[in] vRecv The raw message received
2262
2261
* @param[in] chain_params Chain parameters
2263
2262
* @param[in] connman Pointer to the connection manager
2264
2263
*/
2265
- static void ProcessGetCFCheckPt (CNode& pfrom , CDataStream& vRecv, const CChainParams& chain_params,
2264
+ static void ProcessGetCFCheckPt (CNode& peer , CDataStream& vRecv, const CChainParams& chain_params,
2266
2265
CConnman& connman)
2267
2266
{
2268
2267
uint8_t filter_type_ser;
@@ -2274,7 +2273,7 @@ static void ProcessGetCFCheckPt(CNode& pfrom, CDataStream& vRecv, const CChainPa
2274
2273
2275
2274
const CBlockIndex* stop_index;
2276
2275
BlockFilterIndex* filter_index;
2277
- if (!PrepareBlockFilterRequest (pfrom , chain_params, filter_type, /* start_height=*/ 0 , stop_hash,
2276
+ if (!PrepareBlockFilterRequest (peer , chain_params, filter_type, /* start_height=*/ 0 , stop_hash,
2278
2277
/* max_height_diff=*/ std::numeric_limits<uint32_t >::max (),
2279
2278
stop_index, filter_index)) {
2280
2279
return ;
@@ -2295,12 +2294,12 @@ static void ProcessGetCFCheckPt(CNode& pfrom, CDataStream& vRecv, const CChainPa
2295
2294
}
2296
2295
}
2297
2296
2298
- CSerializedNetMsg msg = CNetMsgMaker (pfrom .GetSendVersion ())
2297
+ CSerializedNetMsg msg = CNetMsgMaker (peer .GetSendVersion ())
2299
2298
.Make (NetMsgType::CFCHECKPT,
2300
2299
filter_type_ser,
2301
2300
stop_index->GetBlockHash (),
2302
2301
headers);
2303
- connman.PushMessage (&pfrom , std::move (msg));
2302
+ connman.PushMessage (&peer , std::move (msg));
2304
2303
}
2305
2304
2306
2305
void ProcessMessage (
0 commit comments