all: switch out defunct set library to different one (#16873)

* keystore, ethash, eth, miner, rpc, whisperv6: tech debt with now defunct set.

* whisperv5: swap out gopkg.in/fatih/set.v0 with supported set
This commit is contained in:
Ralph Caraveo III
2018-07-16 00:54:19 -07:00
committed by Péter Szilágyi
parent eb7f901289
commit 5d30be412b
25 changed files with 1069 additions and 843 deletions

View File

@@ -20,11 +20,11 @@ import (
"fmt"
"time"
mapset "github.com/deckarep/golang-set"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
set "gopkg.in/fatih/set.v0"
)
// Peer represents a whisper protocol peer connection.
@@ -34,7 +34,7 @@ type Peer struct {
ws p2p.MsgReadWriter
trusted bool
known *set.Set // Messages already known by the peer to avoid wasting bandwidth
known mapset.Set // Messages already known by the peer to avoid wasting bandwidth
quit chan struct{}
}
@@ -46,7 +46,7 @@ func newPeer(host *Whisper, remote *p2p.Peer, rw p2p.MsgReadWriter) *Peer {
peer: remote,
ws: rw,
trusted: false,
known: set.New(),
known: mapset.NewSet(),
quit: make(chan struct{}),
}
}
@@ -127,7 +127,7 @@ func (peer *Peer) mark(envelope *Envelope) {
// marked checks if an envelope is already known to the remote peer.
func (peer *Peer) marked(envelope *Envelope) bool {
return peer.known.Has(envelope.Hash())
return peer.known.Contains(envelope.Hash())
}
// expire iterates over all the known envelopes in the host and removes all