Skip to content

Commit

Permalink
minerchain
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdevbear committed Oct 2, 2023
1 parent 564e2be commit 814ffd5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ func (s *Ethereum) Miner() *miner.Miner { return s.miner }

func (s *Ethereum) AccountManager() *accounts.Manager { return s.accountManager }
func (s *Ethereum) BlockChain() *core.BlockChain { return s.blockchain }
func (s *Ethereum) MinerChain() miner.BlockChain { return s.blockchain }
func (s *Ethereum) TxPool() *txpool.TxPool { return s.txPool }
func (s *Ethereum) EventMux() *event.TypeMux { return s.eventMux }
func (s *Ethereum) Engine() consensus.Engine { return s.engine }
Expand Down
2 changes: 1 addition & 1 deletion miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import (
// Backend wraps all methods required for mining. Only full node is capable
// to offer all the functions here.
type Backend interface {
BlockChain() BlockChain
MinerChain() BlockChain
TxPool() *txpool.TxPool
}

Expand Down
4 changes: 4 additions & 0 deletions miner/miner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func (m *mockBackend) BlockChain() BlockChain {
return m.bc
}

func (m *mockBackend) MinerChain() BlockChain {
return m.bc
}

func (m *mockBackend) TxPool() *txpool.TxPool {
return m.txPool
}
Expand Down
4 changes: 2 additions & 2 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus
chainConfig: chainConfig,
engine: engine,
eth: eth,
chain: eth.BlockChain(),
chain: eth.MinerChain(),
mux: mux,
isLocalBlock: isLocalBlock,
coinbase: config.Etherbase,
Expand All @@ -266,7 +266,7 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus
// Subscribe NewTxsEvent for tx pool
worker.txsSub = eth.TxPool().SubscribeNewTxsEvent(worker.txsCh)
// Subscribe events for blockchain
worker.chainHeadSub = eth.BlockChain().SubscribeChainHeadEvent(worker.chainHeadCh)
worker.chainHeadSub = eth.MinerChain().SubscribeChainHeadEvent(worker.chainHeadCh)

// Sanitize recommit interval if the user-specified one is too short.
recommit := worker.config.Recommit
Expand Down
1 change: 1 addition & 0 deletions miner/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func newTestWorkerBackend(t *testing.T, chainConfig *params.ChainConfig, engine
}

func (b *testWorkerBackend) BlockChain() BlockChain { return b.chain }
func (b *testWorkerBackend) MinerChain() BlockChain { return b.chain }
func (b *testWorkerBackend) TxPool() *txpool.TxPool { return b.txPool }

func (b *testWorkerBackend) newRandomTx(creation bool) *types.Transaction {
Expand Down

0 comments on commit 814ffd5

Please sign in to comment.