internal/ethapi: fix encoding of uncle headers and pending blocks (#20460)
Fixes #19024 Fixes #19332
This commit is contained in:
		
				
					committed by
					
						 Felix Lange
						Felix Lange
					
				
			
			
				
	
			
			
			
						parent
						
							433937fb42
						
					
				
				
					commit
					7a509b4732
				
			| @@ -642,7 +642,7 @@ func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.B | |||||||
| 		response, err := s.rpcMarshalBlock(block, true, fullTx) | 		response, err := s.rpcMarshalBlock(block, true, fullTx) | ||||||
| 		if err == nil && number == rpc.PendingBlockNumber { | 		if err == nil && number == rpc.PendingBlockNumber { | ||||||
| 			// Pending blocks need to nil out a few fields | 			// 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 | 				response[field] = nil | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @@ -1088,7 +1088,9 @@ func (s *PublicBlockChainAPI) rpcMarshalBlock(b *types.Block, inclTx bool, fullT | |||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		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 | 	return fields, err | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user