Skip to content

Commit

Permalink
Create node backend once in repl mode
Browse files Browse the repository at this point in the history
  • Loading branch information
notmandatory committed Sep 10, 2022
1 parent 322f6f1 commit 33185d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ pub(crate) fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
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 {
Expand Down Expand Up @@ -622,7 +624,6 @@ pub(crate) fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
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())),
Expand All @@ -638,7 +639,6 @@ pub(crate) fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
subcommand:
WalletSubCommand::OnlineWalletSubCommand(online_subcommand),
} => {
let backend = new_backend(&home_dir)?;
let blockchain = new_blockchain(
cli_opts.network,
&wallet_opts,
Expand Down

0 comments on commit 33185d7

Please sign in to comment.