Skip to content

Commit 2d1625e

Browse files
committed
internal/ethapi: fix encoding of uncle headers and pending blocks ethereum#20460
1 parent 4650e3d commit 2d1625e

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
}
@@ -1482,7 +1482,9 @@ func (s *BlockChainAPI) rpcMarshalBlock(b *types.Block, inclTx bool, fullTx bool
14821482
if err != nil {
14831483
return nil, err
14841484
}
1485-
fields["totalDifficulty"] = (*hexutil.Big)(s.b.GetTd(context.Background(), b.Hash()))
1485+
if inclTx {
1486+
fields["totalDifficulty"] = (*hexutil.Big)(s.b.GetTd(context.Background(), b.Hash()))
1487+
}
14861488
return fields, err
14871489
}
14881490

0 commit comments

Comments
 (0)