|
|
|
@ -1281,7 +1281,7 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} { |
|
|
|
|
// RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are
|
|
|
|
|
// returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain
|
|
|
|
|
// transaction hashes.
|
|
|
|
|
func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *params.ChainConfig) (map[string]interface{}, error) { |
|
|
|
|
func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *params.ChainConfig) map[string]interface{} { |
|
|
|
|
fields := RPCMarshalHeader(block.Header()) |
|
|
|
|
fields["size"] = hexutil.Uint64(block.Size()) |
|
|
|
|
|
|
|
|
@ -1310,7 +1310,7 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *param |
|
|
|
|
if block.Header().WithdrawalsHash != nil { |
|
|
|
|
fields["withdrawals"] = block.Withdrawals() |
|
|
|
|
} |
|
|
|
|
return fields, nil |
|
|
|
|
return fields |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// rpcMarshalHeader uses the generalized output filler, then adds the total difficulty field, which requires
|
|
|
|
@ -1324,14 +1324,11 @@ func (s *BlockChainAPI) rpcMarshalHeader(ctx context.Context, header *types.Head |
|
|
|
|
// rpcMarshalBlock uses the generalized output filler, then adds the total difficulty field, which requires
|
|
|
|
|
// a `BlockchainAPI`.
|
|
|
|
|
func (s *BlockChainAPI) rpcMarshalBlock(ctx context.Context, b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) { |
|
|
|
|
fields, err := RPCMarshalBlock(b, inclTx, fullTx, s.b.ChainConfig()) |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|
fields := RPCMarshalBlock(b, inclTx, fullTx, s.b.ChainConfig()) |
|
|
|
|
if inclTx { |
|
|
|
|
fields["totalDifficulty"] = (*hexutil.Big)(s.b.GetTd(ctx, b.Hash())) |
|
|
|
|
} |
|
|
|
|
return fields, err |
|
|
|
|
return fields, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction
|
|
|
|
|