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
3a983d24
Commit
3a983d24
authored
Jul 03, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial getTransactionReceipt support
parent
6f69b4d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
eth.go
rpc/api/eth.go
+20
-0
parsing.go
rpc/api/parsing.go
+23
-0
No files found.
rpc/api/eth.go
View file @
3a983d24
...
...
@@ -77,6 +77,7 @@ var (
"eth_submitWork"
:
(
*
ethApi
)
.
SubmitWork
,
"eth_resend"
:
(
*
ethApi
)
.
Resend
,
"eth_pendingTransactions"
:
(
*
ethApi
)
.
PendingTransactions
,
"eth_getTransactionReceipt"
:
(
*
ethApi
)
.
GetTransactionReceipt
,
}
)
...
...
@@ -596,3 +597,22 @@ func (self *ethApi) PendingTransactions(req *shared.Request) (interface{}, error
return
ltxs
,
nil
}
func
(
self
*
ethApi
)
GetTransactionReceipt
(
req
*
shared
.
Request
)
(
interface
{},
error
)
{
args
:=
new
(
HashArgs
)
if
err
:=
self
.
codec
.
Decode
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
nil
,
shared
.
NewDecodeParamError
(
err
.
Error
())
}
rec
,
_
:=
self
.
xeth
.
GetTxReceipt
(
common
.
StringToHash
(
args
.
Hash
))
// We could have an error of "not found". Should disambiguate
// if err != nil {
// return err, nil
// }
if
rec
!=
nil
{
v
:=
NewReceiptRes
(
rec
)
return
v
,
nil
}
return
nil
,
nil
}
rpc/api/parsing.go
View file @
3a983d24
...
...
@@ -402,6 +402,29 @@ func NewUncleRes(h *types.Header) *UncleRes {
// WorkProved string `json:"workProved"`
// }
type
ReceiptRes
struct
{
TransactionHash
*
hexdata
`json:transactionHash`
TransactionIndex
*
hexnum
`json:transactionIndex`
BlockNumber
*
hexnum
`json:blockNumber`
BlockHash
*
hexdata
`json:blockHash`
CumulativeGasUsed
*
hexnum
`json:cumulativeGasUsed`
GasUsed
*
hexnum
`json:gasUsed`
ContractAddress
*
hexdata
`json:contractAddress`
Logs
*
[]
interface
{}
`json:logs`
}
func
NewReceiptRes
(
rec
*
types
.
Receipt
)
*
ReceiptRes
{
if
rec
==
nil
{
return
nil
}
var
v
=
new
(
ReceiptRes
)
// TODO fill out rest of object
v
.
CumulativeGasUsed
=
newHexNum
(
rec
.
CumulativeGasUsed
)
return
v
}
func
numString
(
raw
interface
{})
(
*
big
.
Int
,
error
)
{
var
number
*
big
.
Int
// Parse as integer
...
...
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