File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -1176,18 +1176,23 @@ class CNode
1176
1176
m_addr_known->insert (_addr.GetKey ());
1177
1177
}
1178
1178
1179
- void PushAddress (const CAddress& _addr, FastRandomContext &insecure_rand)
1179
+ /* *
1180
+ * Whether the peer supports the address. For example, a peer that does not
1181
+ * implement BIP155 cannot receive Tor v3 addresses because it requires
1182
+ * ADDRv2 (BIP155) encoding.
1183
+ */
1184
+ bool IsAddrCompatible (const CAddress& addr) const
1180
1185
{
1181
- // Whether the peer supports the address in `_addr`. For example,
1182
- // nodes that do not implement BIP155 cannot receive Tor v3 addresses
1183
- // because they require ADDRv2 (BIP155) encoding.
1184
- const bool addr_format_supported = m_wants_addrv2 || _addr.IsAddrV1Compatible ();
1186
+ return m_wants_addrv2 || addr.IsAddrV1Compatible ();
1187
+ }
1185
1188
1189
+ void PushAddress (const CAddress& _addr, FastRandomContext &insecure_rand)
1190
+ {
1186
1191
// Known checking here is only to save space from duplicates.
1187
1192
// SendMessages will filter it again for knowns that were added
1188
1193
// after addresses were pushed.
1189
1194
assert (m_addr_known);
1190
- if (_addr.IsValid () && !m_addr_known->contains (_addr.GetKey ()) && addr_format_supported ) {
1195
+ if (_addr.IsValid () && !m_addr_known->contains (_addr.GetKey ()) && IsAddrCompatible (_addr) ) {
1191
1196
if (vAddrToSend.size () >= MAX_ADDR_TO_SEND) {
1192
1197
vAddrToSend[insecure_rand.randrange (vAddrToSend.size ())] = _addr;
1193
1198
} else {
You can’t perform that action at this time.
0 commit comments