pub struct DandelionConfig {
pub time_between_hop: Duration,
pub epoch_duration: Duration,
pub fluff_probability: f64,
pub graph: Graph,
}
Expand description
The config used to initialize dandelion.
One notable missing item from the config is Tbase
AKA the timeout parameter to prevent black hole
attacks. This is removed from the config for simplicity, Tbase
is calculated using the formula provided
in the D++ paper:
(-k*(k-1)*hop)/(2*log(1-ep))
Where k
is calculated from the fluff probability, hop
is time_between_hop
and ep
is fixed at 0.1
.
Fields§
§time_between_hop: Duration
The time it takes for a stem transaction to pass through a node, including network latency.
It’s better to be safe and put a slightly higher value than lower.
epoch_duration: Duration
The duration of an epoch.
fluff_probability: f64
q
in the dandelion paper, this is the probability that a node will be in the fluff state for
a certain epoch.
The dandelion paper recommends to make this value small, but the smaller this value, the higher the broadcast latency.
It is recommended for this value to be <= 0.2
, this value MUST be in range 0.0..=1.0
.
graph: Graph
The graph type.
Implementations§
Source§impl DandelionConfig
impl DandelionConfig
Sourcepub const fn number_of_stems(&self) -> usize
pub const fn number_of_stems(&self) -> usize
Returns the number of outbound peers to use to stem transactions.
This value depends on the Graph
chosen.
Sourcepub fn average_embargo_timeout(&self) -> Duration
pub fn average_embargo_timeout(&self) -> Duration
Returns the average embargo timeout, Tbase
in the dandelion++ paper.
This is the average embargo timeout only including this node with k
nodes also putting an embargo timeout
using the exponential distribution, the average until one of them fluffs is Tbase / k
.
Sourcepub fn expected_stem_length(&self) -> f64
pub fn expected_stem_length(&self) -> f64
Returns the expected length of a stem.
Trait Implementations§
Source§impl Clone for DandelionConfig
impl Clone for DandelionConfig
Source§fn clone(&self) -> DandelionConfig
fn clone(&self) -> DandelionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DandelionConfig
impl Debug for DandelionConfig
impl Copy for DandelionConfig
Auto Trait Implementations§
impl Freeze for DandelionConfig
impl RefUnwindSafe for DandelionConfig
impl Send for DandelionConfig
impl Sync for DandelionConfig
impl Unpin for DandelionConfig
impl UnwindSafe for DandelionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes