aboutsummaryrefslogtreecommitdiffstats
path: root/miner
diff options
context:
space:
mode:
authorRalph Caraveo III <deckarep@gmail.com>2018-07-16 15:54:19 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-07-16 15:54:19 +0800
commit5d30be412b0f9181cb007c8893ee583ee4319116 (patch)
tree4593b259665d22c552cc869f08317305119a99e0 /miner
parenteb7f901289dce3f9fe3341da8c0b938ea839f79d (diff)
downloaddexon-5d30be412b0f9181cb007c8893ee583ee4319116.tar.gz
dexon-5d30be412b0f9181cb007c8893ee583ee4319116.tar.zst
dexon-5d30be412b0f9181cb007c8893ee583ee4319116.zip
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
Diffstat (limited to 'miner')
-rw-r--r--miner/worker.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/miner/worker.go b/miner/worker.go
index ff48ecabc..e4e42f877 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -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())