good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
59b6b619
Commit
59b6b619
authored
Mar 24, 2015
by
Taylor Gerring
Browse files
Options
Downloads
Patches
Plain Diff
Don't expose backend directly
parent
b9b7442b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
rpc/api.go
+3
-3
3 additions, 3 deletions
rpc/api.go
xeth/xeth.go
+17
-6
17 additions, 6 deletions
xeth/xeth.go
with
20 additions
and
9 deletions
rpc/api.go
+
3
−
3
View file @
59b6b619
...
...
@@ -60,9 +60,9 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
}
*
reply
=
common
.
ToHex
(
crypto
.
Sha3
(
common
.
FromHex
(
args
.
Data
)))
case
"web3_clientVersion"
:
*
reply
=
api
.
xeth
()
.
Backend
()
.
Version
()
*
reply
=
api
.
xeth
()
.
Client
Version
()
case
"net_version"
:
*
reply
=
string
(
api
.
xeth
()
.
Backend
()
.
Protocol
Version
()
)
*
reply
=
api
.
xeth
()
.
Network
Version
()
case
"net_listening"
:
*
reply
=
api
.
xeth
()
.
IsListening
()
case
"net_peerCount"
:
...
...
@@ -84,7 +84,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
case
"eth_accounts"
:
*
reply
=
api
.
xeth
()
.
Accounts
()
case
"eth_blockNumber"
:
v
:=
api
.
xeth
()
.
Backend
()
.
ChainManager
()
.
CurrentBlock
()
.
Number
()
v
:=
api
.
xeth
()
.
CurrentBlock
()
.
Number
()
*
reply
=
common
.
ToHex
(
v
.
Bytes
())
case
"eth_getBalance"
:
args
:=
new
(
GetBalanceArgs
)
...
...
This diff is collapsed.
Click to expand it.
xeth/xeth.go
+
17
−
6
View file @
59b6b619
...
...
@@ -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
.
B
ackend
()
.
ChainManager
()
chain
:=
self
.
b
ackend
.
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
.
B
ackend
()
.
StateDb
())
st
=
state
.
New
(
block
.
Root
(),
self
.
b
ackend
.
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
.
B
ackend
()
)
filter
:=
core
.
NewFilter
(
self
.
b
ackend
)
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
.
B
ackend
()
)
filter
:=
core
.
NewFilter
(
self
.
b
ackend
)
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
.
B
ackend
()
)
filter
:=
core
.
NewFilter
(
self
.
b
ackend
)
filter
.
SetOptions
(
args
)
return
filter
.
Find
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment