From 03513e267d25b5086b3f905b6d1bc5635fcda845 Mon Sep 17 00:00:00 2001 From: Determinant Date: Wed, 14 Aug 2019 23:55:12 -0400 Subject: ... --- coreth.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'coreth.go') diff --git a/coreth.go b/coreth.go index e769d06..e5bbef9 100644 --- a/coreth.go +++ b/coreth.go @@ -10,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/event" "github.com/Determinant/coreth/eth" "github.com/Determinant/coreth/node" + "github.com/Determinant/coreth/consensus/dummy" "github.com/ethereum/go-ethereum/crypto" ) @@ -19,10 +20,10 @@ type Hash = common.Hash type ETHChain struct { backend *eth.Ethereum + cb *dummy.ConsensusCallbacks } - func isLocalBlock(block *types.Block) bool { return false } @@ -33,8 +34,9 @@ func NewETHChain(config *eth.Config, etherBase *common.Address) *ETHChain { } mux := new(event.TypeMux) ctx := node.NewServiceContext(mux) - backend, _ := eth.New(&ctx, config) - chain := ÐChain { backend: backend } + cb := new(dummy.ConsensusCallbacks) + backend, _ := eth.New(&ctx, config, cb) + chain := ÐChain { backend: backend, cb: cb } if etherBase == nil { etherBase = &common.Address{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -65,6 +67,10 @@ func (self *ETHChain) AddLocalTxs(txs []*types.Transaction) []error { return self.backend.TxPool().AddLocals(txs) } +func (self *ETHChain) SetOnSeal(cb func(*types.Block)) { + self.cb.OnSeal = cb +} + type Key struct { Address common.Address PrivateKey *ecdsa.PrivateKey -- cgit v1.2.3