Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13711287
D11613.id33969.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
D11613.id33969.diff
View Options
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -1704,16 +1704,16 @@
}
});
- if (g_avalanche &&
- (!g_avalanche->isQuorumEstablished() ||
- g_avalanche->withPeerManager([&](avalanche::PeerManager &pm) {
- return pm.shouldRequestMoreNodes();
- }))) {
- // Randomly select an avalanche outbound peer to send the getavaaddr
- // message to
- if (!avanode_outbound_ids.empty()) {
- Shuffle(avanode_outbound_ids.begin(), avanode_outbound_ids.end(),
- FastRandomContext());
+ Shuffle(avanode_outbound_ids.begin(), avanode_outbound_ids.end(),
+ FastRandomContext());
+
+ if (g_avalanche && !avanode_outbound_ids.empty()) {
+ if (!g_avalanche->isQuorumEstablished() ||
+ g_avalanche->withPeerManager([&](avalanche::PeerManager &pm) {
+ return pm.shouldRequestMoreNodes();
+ })) {
+ // Randomly select an avalanche outbound peer to send the getavaaddr
+ // message to
const NodeId avanodeId = avanode_outbound_ids.front();
m_connman.ForNode(avanodeId, [&](CNode *pavanode) {
@@ -1729,6 +1729,18 @@
return true;
});
}
+
+ // Send a getavaproofs to one of our peers
+ const NodeId avanodeId = avanode_outbound_ids.back();
+
+ m_connman.ForNode(avanodeId, [&](CNode *pavanode) {
+ LogPrint(BCLog::AVALANCHE,
+ "Requesting compact proofs from peer %d\n", avanodeId);
+ m_connman.PushMessage(pavanode,
+ CNetMsgMaker(pavanode->GetCommonVersion())
+ .Make(NetMsgType::GETAVAPROOFS));
+ return true;
+ });
}
// Schedule next run for 2-5 minutes in the future.
diff --git a/test/functional/abc_p2p_compactproofs.py b/test/functional/abc_p2p_compactproofs.py
--- a/test/functional/abc_p2p_compactproofs.py
+++ b/test/functional/abc_p2p_compactproofs.py
@@ -99,7 +99,26 @@
self.wait_until(
lambda: all([p.last_message.get("getavaproofs") for p in outbound_avapeers]))
assert all([p.message_count.get(
- "getavaproofs", 0) == 1 for p in outbound_avapeers])
+ "getavaproofs", 0) >= 1 for p in outbound_avapeers])
+ assert all([p.message_count.get(
+ "getavaproofs", 0) == 0 for p in non_avapeers])
+ assert all([p.message_count.get(
+ "getavaproofs", 0) == 0 for p in inbound_avapeers])
+
+ self.log.info(
+ "Check we send periodic getavaproofs message to one of our peers")
+
+ def count_outbounds_getavaproofs():
+ return sum([p.message_count.get("getavaproofs", 0)
+ for p in outbound_avapeers])
+
+ outbounds_getavaproofs = count_outbounds_getavaproofs()
+ for i in range(12):
+ node.mockscheduler(AVALANCHE_MAX_PERIODIC_NETWORKING_INTERVAL)
+ self.wait_until(lambda: count_outbounds_getavaproofs()
+ == outbounds_getavaproofs + 1)
+ outbounds_getavaproofs += 1
+
assert all([p.message_count.get(
"getavaproofs", 0) == 0 for p in non_avapeers])
assert all([p.message_count.get(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 26, 11:22 (16 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5573397
Default Alt Text
D11613.id33969.diff (3 KB)
Attached To
D11613: [avalanche] Send getavaproofs periodically to one random peer
Event Timeline
Log In to Comment