diff options
author | Determinant <[email protected]> | 2019-08-30 09:00:43 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-08-30 09:00:43 -0400 |
commit | 0424afc658dae706b017aeb3d6208026c1f6f547 (patch) | |
tree | cae1127d880fbe8ea5454821d330dc9acc4ed112 /coreth.go | |
parent | bf3776a5d5475f9ee35820099debfc49d71ea10c (diff) |
add callbacks for the miner
Diffstat (limited to 'coreth.go')
-rw-r--r-- | coreth.go | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -7,6 +7,7 @@ import ( "github.com/ava-labs/coreth/consensus/dummy" "github.com/ava-labs/coreth/eth" + "github.com/ava-labs/coreth/miner" "github.com/ava-labs/coreth/node" "github.com/ava-labs/go-ethereum/common" "github.com/ava-labs/go-ethereum/core/state" @@ -24,6 +25,7 @@ type Hash = common.Hash type ETHChain struct { backend *eth.Ethereum cb *dummy.ConsensusCallbacks + mcb *miner.MinerCallbacks } func isLocalBlock(block *types.Block) bool { @@ -37,8 +39,9 @@ func NewETHChain(config *eth.Config, etherBase *common.Address) *ETHChain { mux := new(event.TypeMux) ctx := node.NewServiceContext(mux) cb := new(dummy.ConsensusCallbacks) - backend, _ := eth.New(&ctx, config, cb) - chain := ÐChain{backend: backend, cb: cb} + mcb := new(miner.MinerCallbacks) + backend, _ := eth.New(&ctx, config, cb, mcb) + chain := ÐChain{backend: backend, cb: cb, mcb: mcb} if etherBase == nil { etherBase = &common.Address{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -73,6 +76,10 @@ func (self *ETHChain) SetOnSeal(cb func(*types.Block) error) { self.cb.OnSeal = cb } +func (self *ETHChain) SetOnSealMiner(cb func(*types.Block) error) { + self.mcb.OnSeal = cb +} + func (self *ETHChain) SetOnAPIs(cb dummy.OnAPIsCallbackType) { self.cb.OnAPIs = cb } |