aboutsummaryrefslogtreecommitdiff
path: root/coreth.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-08-14 23:55:12 -0400
committerDeterminant <[email protected]>2019-08-14 23:55:12 -0400
commit03513e267d25b5086b3f905b6d1bc5635fcda845 (patch)
treed2c800a6d04f7def64b4061ceb97f5faa13cf8ea /coreth.go
parent63fc17f85121f84d597742a49b99ab3d022aa6bd (diff)
...
Diffstat (limited to 'coreth.go')
-rw-r--r--coreth.go12
1 files changed, 9 insertions, 3 deletions
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 := &ETHChain { backend: backend }
+ cb := new(dummy.ConsensusCallbacks)
+ backend, _ := eth.New(&ctx, config, cb)
+ chain := &ETHChain { 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