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
49a912ce
Commit
49a912ce
authored
Mar 26, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undo xeth changes
parent
1f381414
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
14 deletions
+11
-14
api.go
rpc/api.go
+3
-3
args.go
rpc/args.go
+4
-4
args_test.go
rpc/args_test.go
+2
-2
xeth.go
xeth/xeth.go
+2
-5
No files found.
rpc/api.go
View file @
49a912ce
...
@@ -212,7 +212,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
...
@@ -212,7 +212,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
args
:=
new
(
HashIndexArgs
)
args
:=
new
(
HashIndexArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
}
}
tx
:=
api
.
xeth
()
.
EthTransactionByHash
(
args
.
Hash
.
Hex
()
)
tx
:=
api
.
xeth
()
.
EthTransactionByHash
(
args
.
Hash
)
if
tx
!=
nil
{
if
tx
!=
nil
{
*
reply
=
NewTransactionRes
(
tx
)
*
reply
=
NewTransactionRes
(
tx
)
}
}
...
@@ -257,7 +257,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
...
@@ -257,7 +257,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
}
}
uhash
:=
br
.
Uncles
[
args
.
Index
]
.
Hex
()
uhash
:=
br
.
Uncles
[
args
.
Index
]
.
Hex
()
uncle
:=
NewBlockRes
(
api
.
xeth
()
.
EthBlockByH
exstring
(
uhash
))
uncle
:=
NewBlockRes
(
api
.
xeth
()
.
EthBlockByH
ash
(
uhash
))
*
reply
=
uncle
*
reply
=
uncle
case
"eth_getUncleByBlockNumberAndIndex"
:
case
"eth_getUncleByBlockNumberAndIndex"
:
...
@@ -275,7 +275,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
...
@@ -275,7 +275,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
exstring
(
uhash
))
uncle
:=
NewBlockRes
(
api
.
xeth
()
.
EthBlockByH
ash
(
uhash
))
*
reply
=
uncle
*
reply
=
uncle
case
"eth_getCompilers"
:
case
"eth_getCompilers"
:
...
...
rpc/args.go
View file @
49a912ce
...
@@ -61,7 +61,7 @@ func numString(raw interface{}, number *int64) error {
...
@@ -61,7 +61,7 @@ func numString(raw interface{}, number *int64) error {
}
}
type
GetBlockByHashArgs
struct
{
type
GetBlockByHashArgs
struct
{
BlockHash
common
.
Hash
BlockHash
string
IncludeTxs
bool
IncludeTxs
bool
}
}
...
@@ -80,7 +80,7 @@ func (args *GetBlockByHashArgs) UnmarshalJSON(b []byte) (err error) {
...
@@ -80,7 +80,7 @@ func (args *GetBlockByHashArgs) UnmarshalJSON(b []byte) (err error) {
if
!
ok
{
if
!
ok
{
return
NewInvalidTypeError
(
"blockHash"
,
"not a string"
)
return
NewInvalidTypeError
(
"blockHash"
,
"not a string"
)
}
}
args
.
BlockHash
=
common
.
HexToHash
(
argstr
)
args
.
BlockHash
=
argstr
if
len
(
obj
)
>
1
{
if
len
(
obj
)
>
1
{
args
.
IncludeTxs
=
obj
[
1
]
.
(
bool
)
args
.
IncludeTxs
=
obj
[
1
]
.
(
bool
)
...
@@ -360,7 +360,7 @@ func (args *BlockNumIndexArgs) UnmarshalJSON(b []byte) (err error) {
...
@@ -360,7 +360,7 @@ func (args *BlockNumIndexArgs) UnmarshalJSON(b []byte) (err error) {
}
}
type
HashIndexArgs
struct
{
type
HashIndexArgs
struct
{
Hash
common
.
Hash
Hash
string
Index
int64
Index
int64
}
}
...
@@ -379,7 +379,7 @@ func (args *HashIndexArgs) UnmarshalJSON(b []byte) (err error) {
...
@@ -379,7 +379,7 @@ func (args *HashIndexArgs) UnmarshalJSON(b []byte) (err error) {
if
!
ok
{
if
!
ok
{
return
NewInvalidTypeError
(
"hash"
,
"not a string"
)
return
NewInvalidTypeError
(
"hash"
,
"not a string"
)
}
}
args
.
Hash
=
common
.
HexToHash
(
arg0
)
args
.
Hash
=
arg0
if
len
(
obj
)
>
1
{
if
len
(
obj
)
>
1
{
arg1
,
ok
:=
obj
[
1
]
.
(
string
)
arg1
,
ok
:=
obj
[
1
]
.
(
string
)
...
...
rpc/args_test.go
View file @
49a912ce
...
@@ -191,7 +191,7 @@ func TestGetBalanceArgsAddressInvalid(t *testing.T) {
...
@@ -191,7 +191,7 @@ func TestGetBalanceArgsAddressInvalid(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
=
common
.
HexToHash
(
"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
)
expected
.
BlockHash
=
"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
expected
.
IncludeTxs
=
true
expected
.
IncludeTxs
=
true
args
:=
new
(
GetBlockByHashArgs
)
args
:=
new
(
GetBlockByHashArgs
)
...
@@ -1444,7 +1444,7 @@ func TestBlockNumIndexArgsIndexInvalid(t *testing.T) {
...
@@ -1444,7 +1444,7 @@ func TestBlockNumIndexArgsIndexInvalid(t *testing.T) {
func
TestHashIndexArgs
(
t
*
testing
.
T
)
{
func
TestHashIndexArgs
(
t
*
testing
.
T
)
{
input
:=
`["0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "0x1"]`
input
:=
`["0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "0x1"]`
expected
:=
new
(
HashIndexArgs
)
expected
:=
new
(
HashIndexArgs
)
expected
.
Hash
=
common
.
HexToHash
(
"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b"
)
expected
.
Hash
=
"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b"
expected
.
Index
=
1
expected
.
Index
=
1
args
:=
new
(
HashIndexArgs
)
args
:=
new
(
HashIndexArgs
)
...
...
xeth/xeth.go
View file @
49a912ce
...
@@ -160,16 +160,13 @@ func (self *XEth) BlockByHash(strHash string) *Block {
...
@@ -160,16 +160,13 @@ func (self *XEth) BlockByHash(strHash string) *Block {
return
NewBlock
(
block
)
return
NewBlock
(
block
)
}
}
func
(
self
*
XEth
)
EthBlockByHash
(
hash
common
.
Hash
)
*
types
.
Block
{
func
(
self
*
XEth
)
EthBlockByHash
(
strHash
string
)
*
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