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
9ce5229d
Commit
9ce5229d
authored
Mar 11, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get transaction via block & index
parent
ece29c5d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
api.go
rpc/api.go
+27
-0
args.go
rpc/args.go
+10
-0
No files found.
rpc/api.go
View file @
9ce5229d
...
@@ -593,8 +593,35 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
...
@@ -593,8 +593,35 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
}
}
*
reply
=
v
*
reply
=
v
case
"eth_getTransactionByHash"
:
case
"eth_getTransactionByHash"
:
return
errNotImplemented
case
"eth_getTransactionByBlockHashAndIndex"
:
case
"eth_getTransactionByBlockHashAndIndex"
:
args
:=
new
(
HashIndexArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
err
}
v
,
err
:=
p
.
GetBlockByHash
(
args
.
BlockHash
,
true
)
if
err
!=
nil
{
return
err
}
if
args
.
TxIndex
>
int64
(
len
(
v
.
Transactions
))
||
args
.
TxIndex
<
0
{
return
NewErrorWithMessage
(
errDecodeArgs
,
"Transaction index does not exist"
)
}
*
reply
=
v
.
Transactions
[
args
.
TxIndex
]
case
"eth_getTransactionByBlockNumberAndIndex"
:
case
"eth_getTransactionByBlockNumberAndIndex"
:
args
:=
new
(
BlockNumIndexArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
err
}
v
,
err
:=
p
.
GetBlockByNumber
(
args
.
BlockNumber
,
true
)
if
err
!=
nil
{
return
err
}
if
args
.
TxIndex
>
int64
(
len
(
v
.
Transactions
))
||
args
.
TxIndex
<
0
{
return
NewErrorWithMessage
(
errDecodeArgs
,
"Transaction index does not exist"
)
}
*
reply
=
v
.
Transactions
[
args
.
TxIndex
]
case
"eth_getUncleByBlockHashAndIndex"
:
case
"eth_getUncleByBlockHashAndIndex"
:
case
"eth_getUncleByBlockNumberAndIndex"
:
case
"eth_getUncleByBlockNumberAndIndex"
:
return
errNotImplemented
return
errNotImplemented
...
...
rpc/args.go
View file @
9ce5229d
...
@@ -217,6 +217,16 @@ func (args *GetDataArgs) requirements() error {
...
@@ -217,6 +217,16 @@ func (args *GetDataArgs) requirements() error {
return
nil
return
nil
}
}
type
BlockNumIndexArgs
struct
{
BlockNumber
int64
TxIndex
int64
}
type
HashIndexArgs
struct
{
BlockHash
string
TxIndex
int64
}
type
Sha3Args
struct
{
type
Sha3Args
struct
{
Data
string
Data
string
}
}
...
...
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