Commit 45341231 authored by Matt Joiner's avatar Matt Joiner
Browse files

Move bloom stuff out

It should be removed soon when bootstrapping doesn't rely on it.
parent b0e6286f
......@@ -10,7 +10,6 @@ import (
"github.com/anacrolix/stm"
"github.com/anacrolix/stm/stmutil"
"github.com/benbjohnson/immutable"
"github.com/willf/bloom"
"github.com/anacrolix/dht/v2/krpc"
)
......@@ -53,10 +52,6 @@ func (a *Announce) NumContacted() int {
return stm.AtomicGet(a.numContacted).(int)
}
func newBloomFilterForTraversal() *bloom.BloomFilter {
return bloom.NewWithEstimates(10000, 0.5)
}
// Traverses the DHT graph toward nodes that store peers for the infohash, streaming them to the
// caller, and announcing the local node to each responding node if port is non-zero or impliedPort
// is true.
......
......@@ -25,11 +25,6 @@ func TestAnnounceNoStartingNodes(t *testing.T) {
require.EqualError(t, err, "no initial nodes")
}
func TestDefaultTraversalBloomFilterCharacteristics(t *testing.T) {
bf := newBloomFilterForTraversal()
t.Logf("%d bits with %d hashes per item", bf.Cap(), bf.K())
}
func randomInfohash() (ih [20]byte) {
rand.Read(ih[:])
return
......
package dht
import "github.com/willf/bloom"
func newBloomFilterForTraversal() *bloom.BloomFilter {
return bloom.NewWithEstimates(10000, 0.5)
}
package dht
import (
"testing"
)
func TestDefaultTraversalBloomFilterCharacteristics(t *testing.T) {
bf := newBloomFilterForTraversal()
t.Logf("%d bits with %d hashes per item", bf.Cap(), bf.K())
}
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