aboutsummaryrefslogtreecommitdiff
path: root/coreth.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-08-30 09:00:43 -0400
committerDeterminant <[email protected]>2019-08-30 09:00:43 -0400
commit0424afc658dae706b017aeb3d6208026c1f6f547 (patch)
treecae1127d880fbe8ea5454821d330dc9acc4ed112 /coreth.go
parentbf3776a5d5475f9ee35820099debfc49d71ea10c (diff)
add callbacks for the miner
Diffstat (limited to 'coreth.go')
-rw-r--r--coreth.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/coreth.go b/coreth.go
index 03f9adf..f7c54d6 100644
--- a/coreth.go
+++ b/coreth.go
@@ -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 := &ETHChain{backend: backend, cb: cb}
+ mcb := new(miner.MinerCallbacks)
+ backend, _ := eth.New(&ctx, config, cb, mcb)
+ chain := &ETHChain{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
}