From 89e0bcaf5e923746d1332248d59c752e6400aae0 Mon Sep 17 00:00:00 2001 From: Jude Nelson Date: Wed, 1 Mar 2023 13:12:26 -0500 Subject: [PATCH] feat: use config.burnchain.wallet_name instead of "" when we're actually dealing with wallet names --- .../src/burnchains/bitcoin_regtest_controller.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs b/testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs index 8b23d48c1..c0cd7ccd4 100644 --- a/testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs +++ b/testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs @@ -667,13 +667,13 @@ impl BitcoinRegtestController { result_vec } - /// Checks if there is a default wallet with the name of "". - /// If the default wallet does not exist, this function creates a wallet with name "". + /// Checks if the config-supplied wallet exists. + /// If it does not exist, this function creates it. pub fn create_wallet_if_dne(&self) -> RPCResult<()> { let wallets = BitcoinRPCRequest::list_wallets(&self.config)?; - if !wallets.contains(&("".to_string())) { - BitcoinRPCRequest::create_wallet(&self.config, "")?; + if !wallets.contains(&self.config.burnchain.wallet_name) { + BitcoinRPCRequest::create_wallet(&self.config, &self.config.burnchain.wallet_name)?; } Ok(()) } @@ -2138,15 +2138,15 @@ impl BitcoinRPCRequest { let url = { // some methods require a wallet ID let wallet_id = match payload.method.as_str() { - "importaddress" | "listunspent" => Some("".to_string()), + "importaddress" | "listunspent" => Some(config.burnchain.wallet_name.clone()), _ => None, }; let url = config.burnchain.get_rpc_url(wallet_id); Url::parse(&url).expect(&format!("Unable to parse {} as a URL", url)) }; debug!( - "BitcoinRPC builder: {:?}:{:?}@{}", - &config.burnchain.username, &config.burnchain.password, &url + "BitcoinRPC builder '{}': {:?}:{:?}@{}", + &payload.method, &config.burnchain.username, &config.burnchain.password, &url ); let mut req = Request::new(Method::Post, url);