Skip to content

Commit

Permalink
exclude types.EmptyUncleHash, remove block/root field for Tron network
Browse files Browse the repository at this point in the history
  • Loading branch information
0rac1e committed Feb 23, 2023
1 parent a41be47 commit 9ecefac
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion core/types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ func (n *BlockNonce) UnmarshalText(input []byte) error {

// Header represents a block header in the Ethereum blockchain.
type Header struct {
Root common.Hash
ParentHash common.Hash `json:"parentHash" gencodec:"required"`
UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"`
Coinbase common.Address `json:"miner"`
Root common.Hash `json:"stateRoot" gencodec:"required"`
TxHash common.Hash `json:"transactionsRoot" gencodec:"required"`
ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"`
Bloom Bloom `json:"logsBloom" gencodec:"required"`
Expand Down
13 changes: 6 additions & 7 deletions core/types/gen_header_json.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/types/gen_header_rlp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ethclient/ethclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface
if head.UncleHash == types.EmptyUncleHash && len(body.UncleHashes) > 0 {
return nil, fmt.Errorf("server returned non-empty uncle list but block header indicates no uncles")
}
if head.UncleHash != types.EmptyUncleHash && len(body.UncleHashes) == 0 {
return nil, fmt.Errorf("server returned empty uncle list but block header indicates uncles")
}
//if head.UncleHash != types.EmptyUncleHash && len(body.UncleHashes) == 0 {
// return nil, fmt.Errorf("server returned empty uncle list but block header indicates uncles")
//}
if head.TxHash == types.EmptyRootHash && len(body.Transactions) > 0 {
return nil, fmt.Errorf("server returned non-empty transaction list but block header indicates no transactions")
}
Expand Down

0 comments on commit 9ecefac

Please sign in to comment.