Skip to content

Commit

Permalink
gossip: remove unnecessary option
Browse files Browse the repository at this point in the history
Co-authored-by: Loong <loongy@users.noreply.github.com>
  • Loading branch information
jazg and loongy committed Jun 29, 2020
1 parent 17e206d commit a564d75
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
2 changes: 1 addition & 1 deletion gossip/gossip.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (g *Gossiper) sendToSubnet(subnet id.Hash, msg wire.Message) {
if subnet == DefaultSubnet {
// If the default subnet hash is provided, return a random subset of all
// known signatories.
addrs := g.dht.Addrs(g.opts.MaxRandomSignatories)
addrs := g.dht.Addrs(g.opts.Alpha)
subnetSignatories = make([]id.Signatory, 0, len(addrs))
for _, addr := range addrs {
sig, err := addr.Signatory()
Expand Down
11 changes: 0 additions & 11 deletions gossip/opt.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ var (
DefaultAlpha = 10
DefaultBias = 0.25
DefaultTimeout = 5 * time.Second
DefaultMaxRandomSignatories = 10
)

type Options struct {
Expand All @@ -19,7 +18,6 @@ type Options struct {
Alpha int
Bias float64
Timeout time.Duration
MaxRandomSignatories int
}

func DefaultOptions() Options {
Expand All @@ -31,7 +29,6 @@ func DefaultOptions() Options {
Alpha: DefaultAlpha,
Bias: DefaultBias,
Timeout: DefaultTimeout,
MaxRandomSignatories: DefaultMaxRandomSignatories,
}
}

Expand All @@ -54,11 +51,3 @@ func (opts Options) WithTimeout(timeout time.Duration) Options {
opts.Timeout = timeout
return opts
}

// WithMaxRandomSignatories returns new Options with the given maximum random
// signatories. This is the maximum number of random signatories that will be
// queried/gossiped to when using the DefaultHash.
func (opts Options) WithMaxRandomSignatories(maxRandomSignatories int) Options {
opts.MaxRandomSignatories = maxRandomSignatories
return opts
}

0 comments on commit a564d75

Please sign in to comment.