diff options
author | Determinant <[email protected]> | 2020-09-18 13:09:22 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-09-18 13:09:22 -0400 |
commit | 3ea6a7940e40677b629270dfc7a1466bca295bd3 (patch) | |
tree | 1a7f65fcd72e77092525ab01625b8b9d365e3e40 /plugin | |
parent | b0a75c03303fe22f31fe1e1f0fa29a1e1cd78253 (diff) |
clean up the code
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/evm/database.go | 10 | ||||
-rw-r--r-- | plugin/evm/vm.go | 22 |
2 files changed, 10 insertions, 22 deletions
diff --git a/plugin/evm/database.go b/plugin/evm/database.go index 81d1c1d..18890fa 100644 --- a/plugin/evm/database.go +++ b/plugin/evm/database.go @@ -46,16 +46,6 @@ func (db Database) Sync() error { return errOpNotSupported } // NewBatch implements ethdb.Database func (db Database) NewBatch() ethdb.Batch { return Batch{db.Database.NewBatch()} } -//// NewIterator implements ethdb.Database -//func (db Database) NewIterator() ethdb.Iterator { -// return db.Database.NewIterator() -//} - -//// NewIteratorWithPrefix implements ethdb.Database -//func (db Database) NewIteratorWithPrefix(prefix []byte) ethdb.Iterator { -// return db.NewIteratorWithPrefix(prefix) -//} - // NewIterator implements ethdb.Database func (db Database) NewIterator(prefix []byte, start []byte) ethdb.Iterator { return db.NewIteratorWithStartAndPrefix(start, prefix) diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index c02b835..200a08d 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -154,14 +154,14 @@ func init() { type VM struct { ctx *snow.Context - chainID *big.Int - networkID uint64 - genesisHash common.Hash - chain *coreth.ETHChain - chaindb Database - newBlockChan chan *Block - networkChan chan<- commonEng.Message - newTxPoolHeadChan *event.TypeMuxSubscription + chainID *big.Int + networkID uint64 + genesisHash common.Hash + chain *coreth.ETHChain + chaindb Database + newBlockChan chan *Block + networkChan chan<- commonEng.Message + newMinedBlockSub *event.TypeMuxSubscription acceptedDB database.Database @@ -349,15 +349,13 @@ func (vm *VM) Initialize( vm.bdTimerState = bdTimerStateLong vm.bdGenWaitFlag = true - //vm.newTxPoolHeadChan = make(chan core.NewTxPoolHeadEvent, 1) vm.txPoolStabilizedOk = make(chan struct{}, 1) vm.txPoolStabilizedShutdownChan = make(chan struct{}, 1) // Signal goroutine to shutdown // TODO: read size from options vm.pendingAtomicTxs = make(chan *Tx, 1024) vm.atomicTxSubmitChan = make(chan struct{}, 1) vm.shutdownSubmitChan = make(chan struct{}, 1) - //chain.GetTxPool().SubscribeNewHeadEvent(vm.newTxPoolHeadChan) - vm.newTxPoolHeadChan = vm.chain.SubscribeNewMinedBlockEvent() + vm.newMinedBlockSub = vm.chain.SubscribeNewMinedBlockEvent() vm.shutdownWg.Add(1) go ctx.Log.RecoverAndPanic(vm.awaitTxPoolStabilized) chain.Start() @@ -733,7 +731,7 @@ func (vm *VM) awaitTxPoolStabilized() { defer vm.shutdownWg.Done() for { select { - case e := <-vm.newTxPoolHeadChan.Chan(): + case e := <-vm.newMinedBlockSub.Chan(): switch h := e.Data.(type) { case core.NewMinedBlockEvent: vm.txPoolStabilizedLock.Lock() |