diff options
Diffstat (limited to 'coreth.go')
-rw-r--r-- | coreth.go | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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 |