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
e96f2981
Commit
e96f2981
authored
May 30, 2017
by
Péter Szilágyi
Committed by
GitHub
May 30, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14548 from karalabe/ethstats-no-txs
ethstats: don't report transaction content, only hash
parents
dd06c858
09d59da3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
ethstats.go
ethstats/ethstats.go
+10
-12
No files found.
ethstats/ethstats.go
View file @
e96f2981
...
@@ -427,21 +427,15 @@ type blockStats struct {
...
@@ -427,21 +427,15 @@ type blockStats struct {
GasLimit
*
big
.
Int
`json:"gasLimit"`
GasLimit
*
big
.
Int
`json:"gasLimit"`
Diff
string
`json:"difficulty"`
Diff
string
`json:"difficulty"`
TotalDiff
string
`json:"totalDifficulty"`
TotalDiff
string
`json:"totalDifficulty"`
Txs
txStats
`json:"transactions"`
Txs
[]
txStats
`json:"transactions"`
TxHash
common
.
Hash
`json:"transactionsRoot"`
TxHash
common
.
Hash
`json:"transactionsRoot"`
Root
common
.
Hash
`json:"stateRoot"`
Root
common
.
Hash
`json:"stateRoot"`
Uncles
uncleStats
`json:"uncles"`
Uncles
uncleStats
`json:"uncles"`
}
}
// txStats is a custom wrapper around a transaction array to force serializing
// txStats is the information to report about individual transactions.
// empty arrays instead of returning null for them.
type
txStats
struct
{
type
txStats
[]
*
types
.
Transaction
Hash
common
.
Hash
`json:"hash"`
func
(
s
txStats
)
MarshalJSON
()
([]
byte
,
error
)
{
if
txs
:=
([]
*
types
.
Transaction
)(
s
);
len
(
txs
)
>
0
{
return
json
.
Marshal
(
txs
)
}
return
[]
byte
(
"[]"
),
nil
}
}
// uncleStats is a custom wrapper around an uncle array to force serializing
// uncleStats is a custom wrapper around an uncle array to force serializing
...
@@ -480,7 +474,7 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
...
@@ -480,7 +474,7 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
var
(
var
(
header
*
types
.
Header
header
*
types
.
Header
td
*
big
.
Int
td
*
big
.
Int
txs
[]
*
types
.
Transaction
txs
[]
txStats
uncles
[]
*
types
.
Header
uncles
[]
*
types
.
Header
)
)
if
s
.
eth
!=
nil
{
if
s
.
eth
!=
nil
{
...
@@ -491,7 +485,10 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
...
@@ -491,7 +485,10 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
header
=
block
.
Header
()
header
=
block
.
Header
()
td
=
s
.
eth
.
BlockChain
()
.
GetTd
(
header
.
Hash
(),
header
.
Number
.
Uint64
())
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
()
uncles
=
block
.
Uncles
()
}
else
{
}
else
{
// Light nodes would need on-demand lookups for transactions/uncles, skip
// Light nodes would need on-demand lookups for transactions/uncles, skip
...
@@ -501,6 +498,7 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
...
@@ -501,6 +498,7 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
header
=
s
.
les
.
BlockChain
()
.
CurrentHeader
()
header
=
s
.
les
.
BlockChain
()
.
CurrentHeader
()
}
}
td
=
s
.
les
.
BlockChain
()
.
GetTd
(
header
.
Hash
(),
header
.
Number
.
Uint64
())
td
=
s
.
les
.
BlockChain
()
.
GetTd
(
header
.
Hash
(),
header
.
Number
.
Uint64
())
txs
=
[]
txStats
{}
}
}
// Assemble and return the block stats
// Assemble and return the block stats
author
,
_
:=
s
.
engine
.
Author
(
header
)
author
,
_
:=
s
.
engine
.
Author
(
header
)
...
...
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