Commit 4163278e authored by Adrian Sutton's avatar Adrian Sutton

op-node: Improve CLI usage and inline err check

parent 3d19b6d2
...@@ -63,7 +63,7 @@ var ( ...@@ -63,7 +63,7 @@ var (
} }
RPCAdminPersistence = &cli.StringFlag{ RPCAdminPersistence = &cli.StringFlag{
Name: "rpc.admin-state", Name: "rpc.admin-state",
Usage: "File path used to persist state changes made via the admin API so they persist across restarts", Usage: "File path used to persist state changes made via the admin API so they persist across restarts. Disabled if not set.",
EnvVars: prefixEnvVars("RPC_ADMIN_STATE"), EnvVars: prefixEnvVars("RPC_ADMIN_STATE"),
} }
L1TrustRPC = &cli.BoolFlag{ L1TrustRPC = &cli.BoolFlag{
......
...@@ -71,8 +71,7 @@ func (p *ActiveConfigPersistence) persist(sequencerStarted bool) error { ...@@ -71,8 +71,7 @@ func (p *ActiveConfigPersistence) persist(sequencerStarted bool) error {
return fmt.Errorf("open file (%v) for writing: %w", tmpFile, err) return fmt.Errorf("open file (%v) for writing: %w", tmpFile, err)
} }
defer file.Close() // Ensure file is closed even if write or sync fails defer file.Close() // Ensure file is closed even if write or sync fails
_, err = file.Write(data) if _, err = file.Write(data); err != nil {
if err != nil {
return fmt.Errorf("write new config to temp file (%v): %w", tmpFile, err) return fmt.Errorf("write new config to temp file (%v): %w", tmpFile, err)
} }
if err := file.Sync(); err != nil { if err := file.Sync(); err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment