Commit 846328a7 authored by David Stainton's avatar David Stainton

voting: Add SendRatePerMinute cfg param

parent 72931ace
......@@ -160,6 +160,9 @@ func (pCfg *Parameters) validate() error {
}
func (pCfg *Parameters) applyDefaults() {
if pCfg.SendRatePerMinute == 0 {
pCfg.SendRatePerMinute = defaultSendRatePerMinute
}
if pCfg.MixLambda == 0 {
pCfg.MixLambda = defaultMixLambda
}
......@@ -172,9 +175,6 @@ func (pCfg *Parameters) applyDefaults() {
if pCfg.SendLambda == 0 {
pCfg.SendLambda = defaultSendLambda
}
if pCfg.SendRatePerMinute == 0 {
pCfg.SendRatePerMinute = defaultSendRatePerMinute
}
if pCfg.SendMaxInterval == 0 {
pCfg.SendMaxInterval = uint64(rand.ExpQuantile(pCfg.SendLambda, defaultSendMaxPercentile))
}
......
......@@ -124,6 +124,9 @@ func (lCfg *Logging) validate() error {
// Parameters is the network parameters.
type Parameters struct {
// SendRatePerMinute is the rate per minute.
SendRatePerMinute uint64
// MixLambda is the inverse of the mean of the exponential distribution
// that the Sphinx packet per-hop mixing delay will be sampled from.
MixLambda float64
......@@ -164,6 +167,9 @@ func (pCfg *Parameters) validate() error {
}
func (pCfg *Parameters) applyDefaults() {
if pCfg.SendRatePerMinute == 0 {
pCfg.SendRatePerMinute = defaultSendRatePerMinute
}
if pCfg.MixLambda == 0 {
pCfg.MixLambda = defaultMixLambda
}
......
......@@ -295,6 +295,7 @@ func (s *state) getDocument(descriptors []*descriptor, params *config.Parameters
// Build the Document.
doc := &s11n.Document{
Epoch: s.votingEpoch,
SendRatePerMinute: params.SendRatePerMinute,
MixLambda: params.MixLambda,
MixMaxDelay: params.MixMaxDelay,
SendLambda: params.SendLambda,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment