aboutsummaryrefslogtreecommitdiff
path: root/coreth.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-10-01 13:28:55 -0400
committerDeterminant <[email protected]>2019-10-01 13:28:55 -0400
commitbc43122f54ed8de21f74ee6393549c9554d732e8 (patch)
tree549fffb8771dd280b29eec1e8691e67eb4b24895 /coreth.go
parent841b2b7225a9318718c3c856a9debdf01bc4f061 (diff)
support "accepted" as block number in JSON-RPC
Diffstat (limited to 'coreth.go')
-rw-r--r--coreth.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/coreth.go b/coreth.go
index 04d782f..fe9e6d6 100644
--- a/coreth.go
+++ b/coreth.go
@@ -29,6 +29,7 @@ type ETHChain struct {
backend *eth.Ethereum
cb *dummy.ConsensusCallbacks
mcb *miner.MinerCallbacks
+ bcb *eth.BackendCallbacks
}
func isLocalBlock(block *types.Block) bool {
@@ -52,8 +53,9 @@ func NewETHChain(config *eth.Config, nodecfg *node.Config, etherBase *common.Add
}
cb := new(dummy.ConsensusCallbacks)
mcb := new(miner.MinerCallbacks)
- backend, _ := eth.New(&ctx, config, cb, mcb, chainDB)
- chain := &ETHChain{backend: backend, cb: cb, mcb: mcb}
+ bcb := new(eth.BackendCallbacks)
+ backend, _ := eth.New(&ctx, config, cb, mcb, bcb, chainDB)
+ chain := &ETHChain{backend: backend, cb: cb, mcb: mcb, bcb: bcb}
if etherBase == nil {
etherBase = &common.Address{
1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -125,6 +127,10 @@ func (self *ETHChain) SetOnFinalizeAndAssemble(cb dummy.OnFinalizeAndAssembleCal
self.cb.OnFinalizeAndAssemble = cb
}
+func (self *ETHChain) SetOnQueryAcceptedBlock(cb func() *types.Block) {
+ self.bcb.OnQueryAcceptedBlock = cb
+}
+
// Returns a new mutable state based on the current HEAD block.
func (self *ETHChain) CurrentState() (*state.StateDB, error) {
return self.backend.BlockChain().State()