cmd/era: add full-tx flag for transaction detail control

Signed-off-by: kevincatty <zhanshanmao@outlook.com>
This commit is contained in:
kevincatty 2025-03-12 15:15:09 +08:00
parent eb879a76cf
commit bbbe72c300

View file

@ -57,7 +57,11 @@ var (
} }
txsFlag = &cli.BoolFlag{ txsFlag = &cli.BoolFlag{
Name: "txs", Name: "txs",
Usage: "print full transaction values", Usage: "include transaction data in output",
}
fullTxFlag = &cli.BoolFlag{
Name: "full-tx",
Usage: "show full transaction details (requires --txs)",
} }
) )
@ -69,6 +73,7 @@ var (
Action: block, Action: block,
Flags: []cli.Flag{ Flags: []cli.Flag{
txsFlag, txsFlag,
fullTxFlag,
}, },
} }
infoCommand = &cli.Command{ infoCommand = &cli.Command{
@ -122,7 +127,7 @@ func block(ctx *cli.Context) error {
return fmt.Errorf("error reading block %d: %w", num, err) return fmt.Errorf("error reading block %d: %w", num, err)
} }
// Convert block to JSON and print. // Convert block to JSON and print.
val := ethapi.RPCMarshalBlock(block, ctx.Bool(txsFlag.Name), ctx.Bool(txsFlag.Name), params.MainnetChainConfig) val := ethapi.RPCMarshalBlock(block, ctx.Bool(txsFlag.Name), ctx.Bool(fullTxFlag.Name), params.MainnetChainConfig)
b, err := json.MarshalIndent(val, "", " ") b, err := json.MarshalIndent(val, "", " ")
if err != nil { if err != nil {
return fmt.Errorf("error marshaling json: %w", err) return fmt.Errorf("error marshaling json: %w", err)