aboutsummaryrefslogtreecommitdiff
path: root/coreth.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-08-12 00:00:20 -0400
committerDeterminant <[email protected]>2019-08-12 00:00:20 -0400
commit068cb794976da713fb4671e1bb4e4657d3dcc2b3 (patch)
tree59a869bc21de8d7cba654ad7161ea5495c1eafe7 /coreth.go
parent4c1616a746a648c816042f596eb199174a9858f1 (diff)
...
Diffstat (limited to 'coreth.go')
-rw-r--r--coreth.go24
1 files changed, 22 insertions, 2 deletions
diff --git a/coreth.go b/coreth.go
index c7b5e42..e43ce3e 100644
--- a/coreth.go
+++ b/coreth.go
@@ -27,8 +27,8 @@ type Hash = common.Hash
type ETHChain struct {
mux *event.TypeMux
- worker *miner.Worker
backend *eth.Ethereum
+ worker *miner.Worker
}
type DummyEngine struct {
@@ -248,7 +248,7 @@ func isLocalBlock(block *types.Block) bool {
return false
}
-func NewETHChain(config *miner.Config, chainConfig *params.ChainConfig) *ETHChain {
+func NewETHChain(config *miner.Config, chainConfig *params.ChainConfig, etherBase *common.Address) *ETHChain {
if config == nil {
config = &eth.DefaultConfig.Miner
}
@@ -260,11 +260,31 @@ func NewETHChain(config *miner.Config, chainConfig *params.ChainConfig) *ETHChai
backend, _ := eth.New(&ctx, &eth.DefaultConfig)
chain := &ETHChain {
mux: mux,
+ backend: backend,
worker: miner.NewWorker(config, chainConfig, &DummyEngine{}, backend, mux, isLocalBlock),
}
+ if etherBase == nil {
+ etherBase = &common.Address{
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }
+ }
+ chain.worker.SetEtherbase(*etherBase)
return chain
}
func (self *ETHChain) Start() {
self.worker.Start()
}
+
+func (self *ETHChain) Stop() {
+ self.worker.Stop()
+}
+
+func (self *ETHChain) AddRemoteTxs(txs []*types.Transaction) []error {
+ return self.backend.TxPool().AddRemotes(txs)
+}
+
+func (self *ETHChain) AddLocalTxs(txs []*types.Transaction) []error {
+ return self.backend.TxPool().AddLocals(txs)
+}