Skip to content

Commit 4ee7aec

Browse files
committed
p2p: add m_network to NodeEvictionCandidate struct
1 parent 7321e6f commit 4ee7aec

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ bool CConnman::AttemptToEvictConnection()
10231023
HasAllDesirableServiceFlags(node->nServices),
10241024
peer_relay_txes, peer_filter_not_null, node->nKeyedNetGroup,
10251025
node->m_prefer_evict, node->addr.IsLocal(),
1026-
node->m_inbound_onion};
1026+
node->m_inbound_onion, node->ConnectedThroughNetwork()};
10271027
vEvictionCandidates.push_back(candidate);
10281028
}
10291029
}

src/net.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,7 @@ struct NodeEvictionCandidate
12101210
bool prefer_evict;
12111211
bool m_is_local;
12121212
bool m_is_onion;
1213+
Network m_network;
12131214
};
12141215

12151216
/**

src/test/fuzz/node_eviction.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ FUZZ_TARGET(node_eviction)
3232
/* prefer_evict */ fuzzed_data_provider.ConsumeBool(),
3333
/* m_is_local */ fuzzed_data_provider.ConsumeBool(),
3434
/* m_is_onion */ fuzzed_data_provider.ConsumeBool(),
35+
/* m_network */ fuzzed_data_provider.PickValueInArray(ALL_NETWORKS),
3536
});
3637
}
3738
// Make a copy since eviction_candidates may be in some valid but otherwise

src/test/net_peer_eviction_tests.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5+
#include <netaddress.h>
56
#include <net.h>
7+
#include <test/util/net.h>
68
#include <test/util/setup_common.h>
79

810
#include <boost/test/unit_test.hpp>
@@ -32,6 +34,7 @@ std::vector<NodeEvictionCandidate> GetRandomNodeEvictionCandidates(const int n_c
3234
/* prefer_evict */ random_context.randbool(),
3335
/* m_is_local */ random_context.randbool(),
3436
/* m_is_onion */ random_context.randbool(),
37+
/* m_network */ ALL_NETWORKS[random_context.randrange(ALL_NETWORKS.size())],
3538
});
3639
}
3740
return candidates;

0 commit comments

Comments
 (0)