Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
6669ef5b
Commit
6669ef5b
authored
Mar 20, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename for clarity
parent
7b45f337
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
21 deletions
+21
-21
api.go
rpc/api.go
+9
-9
args.go
rpc/args.go
+6
-6
args_test.go
rpc/args_test.go
+6
-6
No files found.
rpc/api.go
View file @
6669ef5b
...
...
@@ -46,6 +46,13 @@ func NewEthereumApi(eth *xeth.XEth, dataDir string) *EthereumApi {
return
api
}
func
(
self
*
EthereumApi
)
xeth
()
*
xeth
.
XEth
{
self
.
xethMu
.
RLock
()
defer
self
.
xethMu
.
RUnlock
()
return
self
.
eth
}
func
(
self
*
EthereumApi
)
xethWithStateNum
(
num
int64
)
*
xeth
.
XEth
{
chain
:=
self
.
xeth
()
.
Backend
()
.
ChainManager
()
var
block
*
types
.
Block
...
...
@@ -328,7 +335,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
}
v
,
err
:=
p
.
GetBlockByHash
(
args
.
BlockHash
,
args
.
Transaction
s
)
v
,
err
:=
p
.
GetBlockByHash
(
args
.
BlockHash
,
args
.
IncludeTx
s
)
if
err
!=
nil
{
return
err
}
...
...
@@ -339,7 +346,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
}
v
,
err
:=
p
.
GetBlockByNumber
(
args
.
BlockNumber
,
args
.
Transaction
s
)
v
,
err
:=
p
.
GetBlockByNumber
(
args
.
BlockNumber
,
args
.
IncludeTx
s
)
if
err
!=
nil
{
return
err
}
...
...
@@ -580,13 +587,6 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
nil
}
func
(
self
*
EthereumApi
)
xeth
()
*
xeth
.
XEth
{
self
.
xethMu
.
RLock
()
defer
self
.
xethMu
.
RUnlock
()
return
self
.
eth
}
func
toFilterOptions
(
options
*
FilterOptions
)
*
core
.
FilterOptions
{
var
opts
core
.
FilterOptions
...
...
rpc/args.go
View file @
6669ef5b
...
...
@@ -35,8 +35,8 @@ func blockAge(raw interface{}, number *int64) (err error) {
}
type
GetBlockByHashArgs
struct
{
BlockHash
string
Transaction
s
bool
BlockHash
string
IncludeTx
s
bool
}
func
(
args
*
GetBlockByHashArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
...
...
@@ -57,15 +57,15 @@ func (args *GetBlockByHashArgs) UnmarshalJSON(b []byte) (err error) {
args
.
BlockHash
=
argstr
if
len
(
obj
)
>
1
{
args
.
Transaction
s
=
obj
[
1
]
.
(
bool
)
args
.
IncludeTx
s
=
obj
[
1
]
.
(
bool
)
}
return
nil
}
type
GetBlockByNumberArgs
struct
{
BlockNumber
int64
Transactions
bool
BlockNumber
int64
IncludeTxs
bool
}
func
(
args
*
GetBlockByNumberArgs
)
UnmarshalJSON
(
b
[]
byte
)
(
err
error
)
{
...
...
@@ -86,7 +86,7 @@ func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error) {
}
if
len
(
obj
)
>
1
{
args
.
Transaction
s
=
obj
[
1
]
.
(
bool
)
args
.
IncludeTx
s
=
obj
[
1
]
.
(
bool
)
}
return
nil
...
...
rpc/args_test.go
View file @
6669ef5b
...
...
@@ -82,7 +82,7 @@ func TestGetBlockByHashArgs(t *testing.T) {
input
:=
`["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", true]`
expected
:=
new
(
GetBlockByHashArgs
)
expected
.
BlockHash
=
"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
expected
.
Transaction
s
=
true
expected
.
IncludeTx
s
=
true
args
:=
new
(
GetBlockByHashArgs
)
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
...
...
@@ -93,8 +93,8 @@ func TestGetBlockByHashArgs(t *testing.T) {
t
.
Errorf
(
"BlockHash should be %v but is %v"
,
expected
.
BlockHash
,
args
.
BlockHash
)
}
if
args
.
Transactions
!=
expected
.
Transaction
s
{
t
.
Errorf
(
"
Transactions should be %v but is %v"
,
expected
.
Transactions
,
args
.
Transaction
s
)
if
args
.
IncludeTxs
!=
expected
.
IncludeTx
s
{
t
.
Errorf
(
"
IncludeTxs should be %v but is %v"
,
expected
.
IncludeTxs
,
args
.
IncludeTx
s
)
}
}
...
...
@@ -112,7 +112,7 @@ func TestGetBlockByNumberArgs(t *testing.T) {
input
:=
`["0x1b4", false]`
expected
:=
new
(
GetBlockByNumberArgs
)
expected
.
BlockNumber
=
436
expected
.
Transaction
s
=
false
expected
.
IncludeTx
s
=
false
args
:=
new
(
GetBlockByNumberArgs
)
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
...
...
@@ -123,8 +123,8 @@ func TestGetBlockByNumberArgs(t *testing.T) {
t
.
Errorf
(
"BlockHash should be %v but is %v"
,
expected
.
BlockNumber
,
args
.
BlockNumber
)
}
if
args
.
Transactions
!=
expected
.
Transaction
s
{
t
.
Errorf
(
"
Transactions should be %v but is %v"
,
expected
.
Transactions
,
args
.
Transaction
s
)
if
args
.
IncludeTxs
!=
expected
.
IncludeTx
s
{
t
.
Errorf
(
"
IncludeTxs should be %v but is %v"
,
expected
.
IncludeTxs
,
args
.
IncludeTx
s
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment