Skip to content

Commit 33185d7

Browse files
committed
Create node backend once in repl mode
1 parent 322f6f1 commit 33185d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/handlers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ pub(crate) fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
592592
let split_regex = Regex::new(crate::REPL_LINE_SPLIT_REGEX)
593593
.map_err(|e| Error::Generic(e.to_string()))?;
594594

595+
let backend = new_backend(&home_dir)?;
596+
595597
loop {
596598
let readline = rl.readline(">> ");
597599
match readline {
@@ -622,7 +624,6 @@ pub(crate) fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
622624
let result = match repl_subcommand {
623625
#[cfg(feature = "regtest-node")]
624626
ReplSubCommand::Node { subcommand } => {
625-
let backend = new_backend(&home_dir)?;
626627
match backend.exec_cmd(subcommand) {
627628
Ok(result) => Ok(result),
628629
Err(e) => Ok(serde_json::Value::String(e.to_string())),
@@ -638,7 +639,6 @@ pub(crate) fn handle_command(cli_opts: CliOpts) -> Result<String, Error> {
638639
subcommand:
639640
WalletSubCommand::OnlineWalletSubCommand(online_subcommand),
640641
} => {
641-
let backend = new_backend(&home_dir)?;
642642
let blockchain = new_blockchain(
643643
cli_opts.network,
644644
&wallet_opts,

0 commit comments

Comments
 (0)