mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
Try to fix out of view statements (#5177)
This issue happens when some peer sends a good but already known Seconded statement and the statement-distribution code does not update the statements_received field in the peer_knowledge structure. Subsequently, a Valid statement causes out-of-view message that is incorrectly emitted and causes reputation lose. This PR also introduces a concept of passing the specific pseudo-random generator to subsystems to make it easier to write deterministic tests. This functionality is not really necessary for the specific issue and unit test but it can be useful for other tests and subsystems.
This commit is contained in:
@@ -346,7 +346,7 @@ async fn relay_message<Context>(
|
||||
|
||||
let _span = span.child("interested-peers");
|
||||
// pass on the bitfield distribution to all interested peers
|
||||
let interested_peers = peer_views
|
||||
let mut interested_peers = peer_views
|
||||
.iter()
|
||||
.filter_map(|(peer, view)| {
|
||||
// check interest in the peer in this message's relay parent
|
||||
@@ -363,9 +363,9 @@ async fn relay_message<Context>(
|
||||
}
|
||||
})
|
||||
.collect::<Vec<PeerId>>();
|
||||
let interested_peers = util::choose_random_subset(
|
||||
util::choose_random_subset(
|
||||
|e| gossip_peers.contains(e),
|
||||
interested_peers,
|
||||
&mut interested_peers,
|
||||
MIN_GOSSIP_PEERS,
|
||||
);
|
||||
interested_peers.iter().for_each(|peer| {
|
||||
|
||||
Reference in New Issue
Block a user