aboutsummaryrefslogtreecommitdiff
path: root/coreth.go
diff options
context:
space:
mode:
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