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

@ -24,6 +24,7 @@ import (
"sync/atomic"
"time"
mapset "github.com/deckarep/golang-set"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/consensus/misc"
@ -35,7 +36,6 @@ import (
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"gopkg.in/fatih/set.v0"
)
const (
@ -67,9 +67,9 @@ type Work struct {
signer types.Signer
state *state.StateDB // apply state changes here
ancestors *set.Set // ancestor set (used for checking uncle parent validity)
family *set.Set // family set (used for checking uncle invalidity)
uncles *set.Set // uncle set
ancestors mapset.Set // ancestor set (used for checking uncle parent validity)
family mapset.Set // family set (used for checking uncle invalidity)
uncles mapset.Set // uncle set
tcount int // tx count in cycle
gasPool *core.GasPool // available gas used to pack transactions
@ -362,9 +362,9 @@ func (self *worker) makeCurrent(parent *types.Block, header *types.Header) error
config: self.config,
signer: types.NewEIP155Signer(self.config.ChainID),
state: state,
ancestors: set.New(),
family: set.New(),
uncles: set.New(),
ancestors: mapset.NewSet(),
family: mapset.NewSet(),
uncles: mapset.NewSet(),
header: header,
createdAt: time.Now(),
}
@ -492,13 +492,13 @@ func (self *worker) commitNewWork() {
func (self *worker) commitUncle(work *Work, uncle *types.Header) error {
hash := uncle.Hash()
if work.uncles.Has(hash) {
if work.uncles.Contains(hash) {
return fmt.Errorf("uncle not unique")
}
if !work.ancestors.Has(uncle.ParentHash) {
if !work.ancestors.Contains(uncle.ParentHash) {
return fmt.Errorf("uncle's parent unknown (%x)", uncle.ParentHash[0:4])
}
if work.family.Has(hash) {
if work.family.Contains(hash) {
return fmt.Errorf("uncle already in family (%x)", hash)
}
work.uncles.Add(uncle.Hash())