good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
github
maticnetwork
bor
Commits
8d77ab35
Commit
8d77ab35
authored
Aug 11, 2021
by
Arpit Temani
Browse files
Options
Downloads
Patches
Plain Diff
add by hash
parent
9d085ef6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
internal/ethapi/api.go
+63
-1
63 additions, 1 deletion
internal/ethapi/api.go
with
63 additions
and
1 deletion
internal/ethapi/api.go
+
63
−
1
View file @
8d77ab35
...
@@ -532,7 +532,7 @@ func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI {
...
@@ -532,7 +532,7 @@ func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI {
}
}
// GetTransactionReceipt returns the transaction receipt for the given transaction hash.
// GetTransactionReceipt returns the transaction receipt for the given transaction hash.
func
(
s
*
Public
TransactionPool
API
)
GetTransactionReceiptsByBlockNumber
(
ctx
context
.
Context
,
blockNr
rpc
.
BlockNumber
)
([]
map
[
string
]
interface
{},
error
)
{
func
(
s
*
Public
BlockChain
API
)
GetTransactionReceiptsByBlockNumber
(
ctx
context
.
Context
,
blockNr
rpc
.
BlockNumber
)
([]
map
[
string
]
interface
{},
error
)
{
blockNumber
:=
uint64
(
blockNr
.
Int64
())
blockNumber
:=
uint64
(
blockNr
.
Int64
())
blockHash
:=
rawdb
.
ReadCanonicalHash
(
s
.
b
.
ChainDb
(),
blockNumber
)
blockHash
:=
rawdb
.
ReadCanonicalHash
(
s
.
b
.
ChainDb
(),
blockNumber
)
...
@@ -570,6 +570,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceiptsByBlockNumber(ctx conte
...
@@ -570,6 +570,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceiptsByBlockNumber(ctx conte
"contractAddress"
:
nil
,
"contractAddress"
:
nil
,
"logs"
:
receipt
.
Logs
,
"logs"
:
receipt
.
Logs
,
"logsBloom"
:
receipt
.
Bloom
,
"logsBloom"
:
receipt
.
Bloom
,
"transactions"
:
[]
interface
{}{
tx
},
}
}
// Assign receipt status or post state.
// Assign receipt status or post state.
...
@@ -585,6 +586,67 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceiptsByBlockNumber(ctx conte
...
@@ -585,6 +586,67 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceiptsByBlockNumber(ctx conte
if
receipt
.
ContractAddress
!=
(
common
.
Address
{})
{
if
receipt
.
ContractAddress
!=
(
common
.
Address
{})
{
fields
[
"contractAddress"
]
=
receipt
.
ContractAddress
fields
[
"contractAddress"
]
=
receipt
.
ContractAddress
}
}
fields
=
s
.
appendRPCMarshalBorTransaction
(
ctx
,
block
,
fields
,
true
)
txReceipts
=
append
(
txReceipts
,
fields
)
}
return
txReceipts
,
nil
}
// GetTransactionReceipt returns the transaction receipt for the given transaction hash.
func
(
s
*
PublicBlockChainAPI
)
GetTransactionReceiptsByBlockHash
(
ctx
context
.
Context
,
hash
common
.
Hash
)
([]
map
[
string
]
interface
{},
error
)
{
receipts
,
err
:=
s
.
b
.
GetReceipts
(
ctx
,
hash
)
if
err
!=
nil
{
return
nil
,
err
}
block
,
err
:=
s
.
b
.
BlockByHash
(
ctx
,
hash
)
if
err
!=
nil
{
return
nil
,
err
}
txs
:=
block
.
Transactions
()
if
len
(
txs
)
!=
len
(
receipts
)
{
return
nil
,
fmt
.
Errorf
(
"txs length doesn't equal to receipts' length"
)
}
txReceipts
:=
make
([]
map
[
string
]
interface
{},
0
,
len
(
txs
))
for
idx
,
receipt
:=
range
receipts
{
tx
:=
txs
[
idx
]
var
signer
types
.
Signer
=
types
.
FrontierSigner
{}
if
tx
.
Protected
()
{
signer
=
types
.
NewEIP155Signer
(
tx
.
ChainId
())
}
from
,
_
:=
types
.
Sender
(
signer
,
tx
)
fields
:=
map
[
string
]
interface
{}{
"blockHash"
:
hash
,
"blockNumber"
:
hexutil
.
Uint64
(
block
.
NumberU64
()),
"transactionHash"
:
tx
.
Hash
(),
"transactionIndex"
:
hexutil
.
Uint64
(
idx
),
"from"
:
from
,
"to"
:
tx
.
To
(),
"gasUsed"
:
hexutil
.
Uint64
(
receipt
.
GasUsed
),
"cumulativeGasUsed"
:
hexutil
.
Uint64
(
receipt
.
CumulativeGasUsed
),
"contractAddress"
:
nil
,
"logs"
:
receipt
.
Logs
,
"logsBloom"
:
receipt
.
Bloom
,
"transactions"
:
[]
interface
{}{
tx
},
}
// Assign receipt status or post state.
if
len
(
receipt
.
PostState
)
>
0
{
fields
[
"root"
]
=
hexutil
.
Bytes
(
receipt
.
PostState
)
}
else
{
fields
[
"status"
]
=
hexutil
.
Uint
(
receipt
.
Status
)
}
if
receipt
.
Logs
==
nil
{
fields
[
"logs"
]
=
[][]
*
types
.
Log
{}
}
// If the ContractAddress is 20 0x0 bytes, assume it is not a contract creation
if
receipt
.
ContractAddress
!=
(
common
.
Address
{})
{
fields
[
"contractAddress"
]
=
receipt
.
ContractAddress
}
fields
=
s
.
appendRPCMarshalBorTransaction
(
ctx
,
block
,
fields
,
true
)
txReceipts
=
append
(
txReceipts
,
fields
)
txReceipts
=
append
(
txReceipts
,
fields
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment