From ac54fd152da7400cdfda4340dc55caff1b41eb47 Mon Sep 17 00:00:00 2001 From: miiu Date: Wed, 22 May 2024 10:26:19 +0300 Subject: [PATCH] fetch configs and close --- cmd/chainsimulator/flags.go | 4 ++++ cmd/chainsimulator/main.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/cmd/chainsimulator/flags.go b/cmd/chainsimulator/flags.go index 6976a9ee..9cbca96b 100644 --- a/cmd/chainsimulator/flags.go +++ b/cmd/chainsimulator/flags.go @@ -127,6 +127,10 @@ var ( Name: "skip-configs-download", Usage: "The flag is used to specify whether to skip downloading configs", } + fetchConfigsAndClose = cli.BoolFlag{ + Name: "fetch-configs-and-close", + Usage: "This flag is used to specify to fetch all configs and close the chain simulator after", + } ) func applyFlags(ctx *cli.Context, cfg *config.Config) { diff --git a/cmd/chainsimulator/main.go b/cmd/chainsimulator/main.go index e14b6fa4..c536fbcd 100644 --- a/cmd/chainsimulator/main.go +++ b/cmd/chainsimulator/main.go @@ -81,6 +81,7 @@ func main() { autoGenerateBlocks, blockTimeInMs, skipConfigsDownload, + fetchConfigsAndClose, } app.Authors = []cli.Author{ @@ -123,10 +124,14 @@ func startChainSimulator(ctx *cli.Context) error { skipDownload := ctx.GlobalBool(skipConfigsDownload.Name) nodeConfigs := ctx.GlobalString(pathToNodeConfigs.Name) proxyConfigs := ctx.GlobalString(pathToProxyConfigs.Name) + fetchConfigsAndCloseBool := ctx.GlobalBool(fetchConfigsAndClose.Name) err = fetchConfigs(skipDownload, cfg, nodeConfigs, proxyConfigs) if err != nil { return fmt.Errorf("%w while fetching configs", err) } + if fetchConfigsAndCloseBool { + return nil + } bypassTxsSignature := ctx.GlobalBool(bypassTransactionsSignature.Name) log.Warn("signature", "bypass", bypassTxsSignature)