diff --git a/whisper/whisperv6/devp2p_glue.go b/whisper/whisperv6/devp2p_glue.go index 4f2334fd89..e85b7251f7 100644 --- a/whisper/whisperv6/devp2p_glue.go +++ b/whisper/whisperv6/devp2p_glue.go @@ -18,10 +18,11 @@ package whisperv6 import ( "fmt" + "time" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/p2p" set "gopkg.in/fatih/set.v0" - "time" ) // DevP2PPeer is the DevP2P implementation of the Peer interface diff --git a/whisper/whisperv6/libp2p_glue.go b/whisper/whisperv6/libp2p_glue.go index 94471b5809..efc23c2374 100644 --- a/whisper/whisperv6/libp2p_glue.go +++ b/whisper/whisperv6/libp2p_glue.go @@ -21,11 +21,12 @@ import ( "bytes" "context" "fmt" - "github.com/ethereum/go-ethereum/log" "io" "sync" "time" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/rlp" crypto "github.com/libp2p/go-libp2p-crypto" @@ -197,11 +198,12 @@ updateLoop: // LibP2PWhisperServer implements WhisperServer for libp2p. type LibP2PWhisperServer struct { - Host host.Host + Host host.Host // Libp2p host structure PeerMutex sync.RWMutex // Guard the list of active peers + Peers []*LibP2PPeer // List of active peers - whisper *Whisper + whisper *Whisper // Pointer to the whisper object } func (server *LibP2PWhisperServer) connectToPeer(p *LibP2PPeer) error { diff --git a/whisper/whisperv6/peer.go b/whisper/whisperv6/peer.go index 6d295b48b1..eafcc2529e 100644 --- a/whisper/whisperv6/peer.go +++ b/whisper/whisperv6/peer.go @@ -221,6 +221,7 @@ func (peer *PeerBase) stream() p2p.MsgReadWriter { return peer.ws } +// MakeFullNodeBloom returns a bloom filter that accepts all topics func MakeFullNodeBloom() []byte { bloom := make([]byte, BloomFilterSize) for i := 0; i < BloomFilterSize; i++ { diff --git a/whisper/whisperv6/whisper.go b/whisper/whisperv6/whisper.go index 7c6b44598e..d7872e30cb 100644 --- a/whisper/whisperv6/whisper.go +++ b/whisper/whisperv6/whisper.go @@ -99,10 +99,6 @@ type Whisper struct { mailServer MailServer // MailServer interface } -type DevP2PBridge struct { - *Whisper -} - // New creates a Whisper client ready to communicate through the Ethereum P2P network. func New(cfg *Config) *Whisper { if cfg == nil { @@ -1045,6 +1041,7 @@ func isFullNode(bloom []byte) bool { return true } +// BloomFilterMatch checks if a bloom filter is a superset of a series of bytes func BloomFilterMatch(filter, sample []byte) bool { if filter == nil { return true