Skip to content

Commit 72bfc81

Browse files
authored
internal/ethapi: fix encoding of uncle headers and pending blocks ethereum#20460 (#1599)
1 parent e48bda9 commit 72bfc81

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/ethapi/api.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ func (s *BlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNu
414414
response, err := s.rpcMarshalBlock(block, true, fullTx)
415415
if err == nil && number == rpc.PendingBlockNumber {
416416
// Pending blocks need to nil out a few fields
417-
for _, field := range []string{"hash", "nonce", "miner"} {
417+
for _, field := range []string{"hash", "nonce", "miner", "number"} {
418418
response[field] = nil
419419
}
420420
}
@@ -1379,7 +1379,9 @@ func (s *BlockChainAPI) rpcMarshalBlock(b *types.Block, inclTx bool, fullTx bool
13791379
if err != nil {
13801380
return nil, err
13811381
}
1382-
fields["totalDifficulty"] = (*hexutil.Big)(s.b.GetTd(context.Background(), b.Hash()))
1382+
if inclTx {
1383+
fields["totalDifficulty"] = (*hexutil.Big)(s.b.GetTd(context.Background(), b.Hash()))
1384+
}
13831385
return fields, err
13841386
}
13851387

0 commit comments

Comments
 (0)