diff options
author | Determinant <[email protected]> | 2019-08-12 00:00:20 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-08-12 00:00:20 -0400 |
commit | 068cb794976da713fb4671e1bb4e4657d3dcc2b3 (patch) | |
tree | 59a869bc21de8d7cba654ad7161ea5495c1eafe7 /coreth.go | |
parent | 4c1616a746a648c816042f596eb199174a9858f1 (diff) |
...
Diffstat (limited to 'coreth.go')
-rw-r--r-- | coreth.go | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -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 = ð.DefaultConfig.Miner } @@ -260,11 +260,31 @@ func NewETHChain(config *miner.Config, chainConfig *params.ChainConfig) *ETHChai backend, _ := eth.New(&ctx, ð.DefaultConfig) chain := ÐChain { 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) +} |