From 33185d701b63f88947d7c2fb18caa061db9a41fd 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/handlers.rs b/src/handlers.rs index 30ec993..ec1388e 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -592,6 +592,8 @@ 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()))?; + let backend = new_backend(&home_dir)?; + loop { let readline = rl.readline(">> "); match readline { @@ -622,7 +624,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 +639,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,