diff options
author | Determinant <[email protected]> | 2019-08-14 23:55:12 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-08-14 23:55:12 -0400 |
commit | 03513e267d25b5086b3f905b6d1bc5635fcda845 (patch) | |
tree | d2c800a6d04f7def64b4061ceb97f5faa13cf8ea /coreth.go | |
parent | 63fc17f85121f84d597742a49b99ab3d022aa6bd (diff) |
...
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 |