Skip to content

Commit

Permalink
internal/ethapi: fix encoding of uncle headers and pending blocks (et…
Browse files Browse the repository at this point in the history
  • Loading branch information
princesinha19 authored and enriquefynn committed Feb 15, 2021
1 parent d6e2a29 commit 353d818
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.B
response, err := s.rpcMarshalBlock(block, true, fullTx)
if err == nil && number == rpc.PendingBlockNumber {
// Pending blocks need to nil out a few fields
for _, field := range []string{"hash", "nonce", "miner"} {
for _, field := range []string{"hash", "nonce", "miner", "number"} {
response[field] = nil
}
}
Expand Down Expand Up @@ -1088,7 +1088,9 @@ func (s *PublicBlockChainAPI) rpcMarshalBlock(b *types.Block, inclTx bool, fullT
if err != nil {
return nil, err
}
fields["totalDifficulty"] = (*hexutil.Big)(s.b.GetTd(b.Hash()))
if inclTx {
fields["totalDifficulty"] = (*hexutil.Big)(s.b.GetTd(b.Hash()))
}
return fields, err
}

Expand Down

0 comments on commit 353d818

Please sign in to comment.