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
c7dc379d
Commit
c7dc379d
authored
Mar 26, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GetBlockByHashArgs
parent
7e1e2643
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
9 deletions
+12
-9
api.go
rpc/api.go
+4
-4
args.go
rpc/args.go
+2
-2
args_test.go
rpc/args_test.go
+1
-1
xeth.go
xeth/xeth.go
+5
-2
No files found.
rpc/api.go
View file @
c7dc379d
...
@@ -245,7 +245,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
...
@@ -245,7 +245,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return
err
return
err
}
}
block
:=
api
.
xeth
()
.
EthBlockByH
ash
(
args
.
Hash
)
block
:=
api
.
xeth
()
.
EthBlockByH
exstring
(
args
.
Hash
)
br
:=
NewBlockRes
(
block
)
br
:=
NewBlockRes
(
block
)
br
.
fullTx
=
true
br
.
fullTx
=
true
...
@@ -273,14 +273,14 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
...
@@ -273,14 +273,14 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return
err
return
err
}
}
br
:=
NewBlockRes
(
api
.
xeth
()
.
EthBlockByH
ash
(
args
.
Hash
))
br
:=
NewBlockRes
(
api
.
xeth
()
.
EthBlockByH
exstring
(
args
.
Hash
))
if
args
.
Index
>
int64
(
len
(
br
.
Uncles
))
||
args
.
Index
<
0
{
if
args
.
Index
>
int64
(
len
(
br
.
Uncles
))
||
args
.
Index
<
0
{
return
NewValidationError
(
"Index"
,
"does not exist"
)
return
NewValidationError
(
"Index"
,
"does not exist"
)
}
}
uhash
:=
br
.
Uncles
[
args
.
Index
]
.
Hex
()
uhash
:=
br
.
Uncles
[
args
.
Index
]
.
Hex
()
uncle
:=
NewBlockRes
(
api
.
xeth
()
.
EthBlockByH
ash
(
uhash
))
uncle
:=
NewBlockRes
(
api
.
xeth
()
.
EthBlockByH
exstring
(
uhash
))
*
reply
=
uncle
*
reply
=
uncle
case
"eth_getUncleByBlockNumberAndIndex"
:
case
"eth_getUncleByBlockNumberAndIndex"
:
...
@@ -298,7 +298,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
...
@@ -298,7 +298,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
}
}
uhash
:=
v
.
Uncles
[
args
.
Index
]
.
Hex
()
uhash
:=
v
.
Uncles
[
args
.
Index
]
.
Hex
()
uncle
:=
NewBlockRes
(
api
.
xeth
()
.
EthBlockByH
ash
(
uhash
))
uncle
:=
NewBlockRes
(
api
.
xeth
()
.
EthBlockByH
exstring
(
uhash
))
*
reply
=
uncle
*
reply
=
uncle
case
"eth_getCompilers"
:
case
"eth_getCompilers"
:
...
...
rpc/args.go
View file @
c7dc379d
...
@@ -35,7 +35,7 @@ func blockHeight(raw interface{}, number *int64) (err error) {
...
@@ -35,7 +35,7 @@ func blockHeight(raw interface{}, number *int64) (err error) {
}
}
type
GetBlockByHashArgs
struct
{
type
GetBlockByHashArgs
struct
{
BlockHash
string
BlockHash
common
.
Hash
IncludeTxs
bool
IncludeTxs
bool
}
}
...
@@ -54,7 +54,7 @@ func (args *GetBlockByHashArgs) UnmarshalJSON(b []byte) (err error) {
...
@@ -54,7 +54,7 @@ func (args *GetBlockByHashArgs) UnmarshalJSON(b []byte) (err error) {
if
!
ok
{
if
!
ok
{
return
NewDecodeParamError
(
"BlockHash not a string"
)
return
NewDecodeParamError
(
"BlockHash not a string"
)
}
}
args
.
BlockHash
=
argstr
args
.
BlockHash
=
common
.
HexToHash
(
argstr
)
if
len
(
obj
)
>
1
{
if
len
(
obj
)
>
1
{
args
.
IncludeTxs
=
obj
[
1
]
.
(
bool
)
args
.
IncludeTxs
=
obj
[
1
]
.
(
bool
)
...
...
rpc/args_test.go
View file @
c7dc379d
...
@@ -83,7 +83,7 @@ func TestGetBalanceEmptyArgs(t *testing.T) {
...
@@ -83,7 +83,7 @@ func TestGetBalanceEmptyArgs(t *testing.T) {
func
TestGetBlockByHashArgs
(
t
*
testing
.
T
)
{
func
TestGetBlockByHashArgs
(
t
*
testing
.
T
)
{
input
:=
`["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", true]`
input
:=
`["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", true]`
expected
:=
new
(
GetBlockByHashArgs
)
expected
:=
new
(
GetBlockByHashArgs
)
expected
.
BlockHash
=
"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
expected
.
BlockHash
=
common
.
HexToHash
(
"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
)
expected
.
IncludeTxs
=
true
expected
.
IncludeTxs
=
true
args
:=
new
(
GetBlockByHashArgs
)
args
:=
new
(
GetBlockByHashArgs
)
...
...
xeth/xeth.go
View file @
c7dc379d
...
@@ -160,13 +160,16 @@ func (self *XEth) BlockByHash(strHash string) *Block {
...
@@ -160,13 +160,16 @@ func (self *XEth) BlockByHash(strHash string) *Block {
return
NewBlock
(
block
)
return
NewBlock
(
block
)
}
}
func
(
self
*
XEth
)
EthBlockByHash
(
strHash
string
)
*
types
.
Block
{
func
(
self
*
XEth
)
EthBlockByHash
(
hash
common
.
Hash
)
*
types
.
Block
{
hash
:=
common
.
HexToHash
(
strHash
)
block
:=
self
.
backend
.
ChainManager
()
.
GetBlock
(
hash
)
block
:=
self
.
backend
.
ChainManager
()
.
GetBlock
(
hash
)
return
block
return
block
}
}
func
(
self
*
XEth
)
EthBlockByHexstring
(
strHash
string
)
*
types
.
Block
{
return
self
.
EthBlockByHash
(
common
.
HexToHash
(
strHash
))
}
func
(
self
*
XEth
)
EthTransactionByHash
(
hash
string
)
*
types
.
Transaction
{
func
(
self
*
XEth
)
EthTransactionByHash
(
hash
string
)
*
types
.
Transaction
{
data
,
_
:=
self
.
backend
.
ExtraDb
()
.
Get
(
common
.
FromHex
(
hash
))
data
,
_
:=
self
.
backend
.
ExtraDb
()
.
Get
(
common
.
FromHex
(
hash
))
if
len
(
data
)
!=
0
{
if
len
(
data
)
!=
0
{
...
...
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