Skip to content

BlockChainAPI.rpcMarshalBlock

Source (upstream pre-purge) Current
File internal/ethapi/api.go api_pow.go
Symbol BlockChainAPI.rpcMarshalBlock BlockChainAPI.rpcMarshalBlock
Ref 40fd887df~1 etc/v1.17.3-full-node

Wraps RPCMarshalBlock and injects totalDifficulty field when inclTx is true.

3-way merge — purge → getc ← upstream

pre-purgefork-only
// rpcMarshalBlock uses the generalized output filler, then adds the total difficulty field, which requires
// a BlockchainAPI.
func (api *BlockChainAPI) rpcMarshalBlock(ctx context.Context, b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) {
fields := RPCMarshalBlock(b, inclTx, fullTx, api.b.ChainConfig())
if inclTx {
fields["totalDifficulty"] = (*hexutil.Big)(api.b.GetTd(ctx, b.Hash()))
}
return fields, nil
}

← RPC & API