From fa0454e9728ceea5bdbffb9ed0e51a32db7c74ab Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Fri, 9 Sep 2022 21:50:02 -0500 Subject: [PATCH] Create node backend once in repl mode --- src/handlers.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/handlers.rs b/src/handlers.rs index 30ec993..536ce7d 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -592,6 +592,14 @@ pub(crate) fn handle_command(cli_opts: CliOpts) -> Result { let split_regex = Regex::new(crate::REPL_LINE_SPLIT_REGEX) .map_err(|e| Error::Generic(e.to_string()))?; + #[cfg(any( + feature = "electrum", + feature = "esplora", + feature = "compact_filters", + feature = "rpc" + ))] + let backend = new_backend(&home_dir)?; + loop { let readline = rl.readline(">> "); match readline { @@ -622,7 +630,6 @@ pub(crate) fn handle_command(cli_opts: CliOpts) -> Result { let result = match repl_subcommand { #[cfg(feature = "regtest-node")] ReplSubCommand::Node { subcommand } => { - let backend = new_backend(&home_dir)?; match backend.exec_cmd(subcommand) { Ok(result) => Ok(result), Err(e) => Ok(serde_json::Value::String(e.to_string())), @@ -638,7 +645,6 @@ pub(crate) fn handle_command(cli_opts: CliOpts) -> Result { subcommand: WalletSubCommand::OnlineWalletSubCommand(online_subcommand), } => { - let backend = new_backend(&home_dir)?; let blockchain = new_blockchain( cli_opts.network, &wallet_opts, -- 2.49.0