From 7de1880506ccb83bbbc76d54475610e7b0a6c245 Mon Sep 17 00:00:00 2001 From: AdriaCarrera Date: Mon, 23 Feb 2026 10:56:51 +0100 Subject: [PATCH] fix: replace emptyAppOptions with tmpAppOptions and add tempDir helper logic --- cmd/exrpd/cmd/root.go | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/cmd/exrpd/cmd/root.go b/cmd/exrpd/cmd/root.go index 54e2cf9..7d41218 100644 --- a/cmd/exrpd/cmd/root.go +++ b/cmd/exrpd/cmd/root.go @@ -50,9 +50,16 @@ import ( "github.com/xrplevm/node/v10/app" ) -type emptyAppOptions struct{} - -func (ao emptyAppOptions) Get(_ string) interface{} { return nil } +type tmpAppOptions struct{} + +func (ao tmpAppOptions) Get(searchFlag string) interface{} { + switch searchFlag { + case flags.FlagHome: + return tempDir(app.DefaultNodeHome) + default: + return nil + } +} // NewRootCmd creates a new root command for a Cosmos SDK application func NewRootCmd() (*cobra.Command, sdktestutil.TestEncodingConfig) { @@ -64,7 +71,7 @@ func NewRootCmd() (*cobra.Command, sdktestutil.TestEncodingConfig) { dbm.NewMemDB(), nil, true, nil, 0, - emptyAppOptions{}, + tmpAppOptions{}, ) encodingConfig := sdktestutil.TestEncodingConfig{ InterfaceRegistry: tempApp.InterfaceRegistry(), @@ -424,3 +431,13 @@ func getChainIDFromOpts(appOpts servertypes.AppOptions) (chainID string, err err return } + +func tempDir(defaultHome string) string { + dir, err := os.MkdirTemp("", ".exrpd-tmp") + if err != nil { + dir = defaultHome + } + defer os.RemoveAll(dir) + + return dir +}