aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/xeth.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-24 23:33:37 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-24 23:33:37 +0800
commit59b6b619a2d257b6165f9b18dcab566a16eee2a2 (patch)
tree37ce19570898371a4a3edb67f01001c04ad922a3 /xeth/xeth.go
parentb9b7442b74a3a533f3b6eeefe6a1415d59eb8ccf (diff)
downloadgo-tangerine-59b6b619a2d257b6165f9b18dcab566a16eee2a2.tar.gz
go-tangerine-59b6b619a2d257b6165f9b18dcab566a16eee2a2.tar.zst
go-tangerine-59b6b619a2d257b6165f9b18dcab566a16eee2a2.zip
Don't expose backend directly
Diffstat (limited to 'xeth/xeth.go')
-rw-r--r--xeth/xeth.go23
1 files changed, 17 insertions, 6 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 7ec464609..b7d10cac3 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -143,7 +143,7 @@ func (self *XEth) DefaultGasPrice() *big.Int { return defaultGasPrice }
func (self *XEth) RemoteMining() *miner.RemoteAgent { return self.agent }
func (self *XEth) AtStateNum(num int64) *XEth {
- chain := self.Backend().ChainManager()
+ chain := self.backend.ChainManager()
var block *types.Block
// -1 generally means "latest"
@@ -156,14 +156,13 @@ func (self *XEth) AtStateNum(num int64) *XEth {
var st *state.StateDB
if block != nil {
- st = state.New(block.Root(), self.Backend().StateDb())
+ st = state.New(block.Root(), self.backend.StateDb())
} else {
st = chain.State()
}
return self.WithState(st)
}
-func (self *XEth) Backend() *eth.Ethereum { return self.backend }
func (self *XEth) WithState(statedb *state.StateDB) *XEth {
xeth := &XEth{
backend: self.backend,
@@ -224,6 +223,10 @@ func (self *XEth) EthBlockByNumber(num int64) *types.Block {
return self.backend.ChainManager().GetBlockByNumber(uint64(num))
}
+func (self *XEth) CurrentBlock() *types.Block {
+ return self.backend.ChainManager().CurrentBlock()
+}
+
func (self *XEth) Block(v interface{}) *Block {
if n, ok := v.(int32); ok {
return self.BlockByNumber(int64(n))
@@ -254,6 +257,14 @@ func (self *XEth) IsMining() bool {
return self.backend.IsMining()
}
+func (self *XEth) NetworkVersion() string {
+ return string(self.backend.ProtocolVersion())
+}
+
+func (self *XEth) ClientVersion() string {
+ return self.backend.Version()
+}
+
func (self *XEth) SetMining(shouldmine bool) bool {
ismining := self.backend.IsMining()
if shouldmine && !ismining {
@@ -314,7 +325,7 @@ func (self *XEth) SecretToAddress(key string) string {
func (self *XEth) RegisterFilter(args *core.FilterOptions) int {
var id int
- filter := core.NewFilter(self.Backend())
+ filter := core.NewFilter(self.backend)
filter.SetOptions(args)
filter.LogsCallback = func(logs state.Logs) {
self.logMut.Lock()
@@ -340,7 +351,7 @@ func (self *XEth) UninstallFilter(id int) bool {
func (self *XEth) NewFilterString(word string) int {
var id int
- filter := core.NewFilter(self.Backend())
+ filter := core.NewFilter(self.backend)
switch word {
case "pending":
@@ -392,7 +403,7 @@ func (self *XEth) Logs(id int) state.Logs {
}
func (self *XEth) AllLogs(args *core.FilterOptions) state.Logs {
- filter := core.NewFilter(self.Backend())
+ filter := core.NewFilter(self.backend)
filter.SetOptions(args)
return filter.Find()