Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Commit

Permalink
feat(messaging): restore target group size
Browse files Browse the repository at this point in the history
- As to avoid node level issues that were best solved with AE, the delivery target size stipulated in reliable messaging was previously overridden. Now that AE is to be implemented also at node level, we can restore this value.
  • Loading branch information
oetyng authored and dirvine committed Apr 21, 2021
1 parent eb91caa commit 02fca6e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/delivery_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
network::Network,
peer::Peer,
section::Section,
ELDER_SIZE,
supermajority, ELDER_SIZE,
};
use itertools::Itertools;
use sn_messaging::DstLocation;
Expand Down Expand Up @@ -111,17 +111,19 @@ fn candidates(
.sorted_by(|lhs, rhs| lhs.prefix.cmp_distance(&rhs.prefix, target_name))
.map(|info| (&info.prefix, info.elders.len(), info.elders.values()));

let mut dg_size = ELDER_SIZE;
// gives at least 1 honest target among recipients.
let min_group_size = 1 + ELDER_SIZE - supermajority(ELDER_SIZE);
let mut dg_size = min_group_size;
let mut nodes_to_send = Vec::new();
for (idx, (prefix, len, connected)) in sections.enumerate() {
nodes_to_send.extend(connected.cloned());
// If we don't have enough contacts send to as many as possible
// up to majority of Elders
// up to dg_size of Elders
dg_size = cmp::min(len, dg_size);
if len < ELDER_SIZE {
if len < min_group_size {
warn!(
"Delivery group only {:?} when it should be {:?}",
len, ELDER_SIZE
len, min_group_size
)
}

Expand Down

0 comments on commit 02fca6e

Please sign in to comment.