good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Erigon
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
a
Erigon
Commits
09d59da3
Unverified
Commit
09d59da3
authored
7 years ago
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
ethstats: don't report transaction content, only hash
parent
dd06c858
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ethstats/ethstats.go
+10
-12
10 additions, 12 deletions
ethstats/ethstats.go
with
10 additions
and
12 deletions
ethstats/ethstats.go
+
10
−
12
View file @
09d59da3
...
...
@@ -427,21 +427,15 @@ type blockStats struct {
GasLimit
*
big
.
Int
`json:"gasLimit"`
Diff
string
`json:"difficulty"`
TotalDiff
string
`json:"totalDifficulty"`
Txs
txStats
`json:"transactions"`
Txs
[]
txStats
`json:"transactions"`
TxHash
common
.
Hash
`json:"transactionsRoot"`
Root
common
.
Hash
`json:"stateRoot"`
Uncles
uncleStats
`json:"uncles"`
}
// txStats is a custom wrapper around a transaction array to force serializing
// empty arrays instead of returning null for them.
type
txStats
[]
*
types
.
Transaction
func
(
s
txStats
)
MarshalJSON
()
([]
byte
,
error
)
{
if
txs
:=
([]
*
types
.
Transaction
)(
s
);
len
(
txs
)
>
0
{
return
json
.
Marshal
(
txs
)
}
return
[]
byte
(
"[]"
),
nil
// txStats is the information to report about individual transactions.
type
txStats
struct
{
Hash
common
.
Hash
`json:"hash"`
}
// uncleStats is a custom wrapper around an uncle array to force serializing
...
...
@@ -480,7 +474,7 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
var
(
header
*
types
.
Header
td
*
big
.
Int
txs
[]
*
types
.
Transaction
txs
[]
txStats
uncles
[]
*
types
.
Header
)
if
s
.
eth
!=
nil
{
...
...
@@ -491,7 +485,10 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
header
=
block
.
Header
()
td
=
s
.
eth
.
BlockChain
()
.
GetTd
(
header
.
Hash
(),
header
.
Number
.
Uint64
())
txs
=
block
.
Transactions
()
txs
=
make
([]
txStats
,
len
(
block
.
Transactions
()))
for
i
,
tx
:=
range
block
.
Transactions
()
{
txs
[
i
]
.
Hash
=
tx
.
Hash
()
}
uncles
=
block
.
Uncles
()
}
else
{
// Light nodes would need on-demand lookups for transactions/uncles, skip
...
...
@@ -501,6 +498,7 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
header
=
s
.
les
.
BlockChain
()
.
CurrentHeader
()
}
td
=
s
.
les
.
BlockChain
()
.
GetTd
(
header
.
Hash
(),
header
.
Number
.
Uint64
())
txs
=
[]
txStats
{}
}
// Assemble and return the block stats
author
,
_
:=
s
.
engine
.
Author
(
header
)
...
...
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