Skip to content

Commit 175009b

Browse files
committed
fix: Make config opts in stop_bitcoind() match those in start_bitcoind()
1 parent cbf0c52 commit 175009b

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

testnet/stacks-node/src/tests/bitcoin_regtest.rs

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,18 @@ impl BitcoinCoreController {
5858
.arg("-server=1")
5959
.arg("-listenonion=0")
6060
.arg("-rpcbind=127.0.0.1")
61-
.arg(&format!("-port={}", self.config.burnchain.peer_port))
62-
.arg(&format!(
63-
"-datadir={}",
64-
self.config.get_burnchain_path_str()
65-
))
66-
.arg(&format!("-rpcport={}", self.config.burnchain.rpc_port));
61+
.arg(format!("-port={}", self.config.burnchain.peer_port))
62+
.arg(format!("-datadir={}", self.config.get_burnchain_path_str()))
63+
.arg(format!("-rpcport={}", self.config.burnchain.rpc_port));
6764

6865
match (
6966
&self.config.burnchain.username,
7067
&self.config.burnchain.password,
7168
) {
7269
(Some(username), Some(password)) => {
7370
command
74-
.arg(&format!("-rpcuser={}", username))
75-
.arg(&format!("-rpcpassword={}", password));
71+
.arg(format!("-rpcuser={username}"))
72+
.arg(format!("-rpcpassword={password}"));
7673
}
7774
_ => {}
7875
}
@@ -81,7 +78,7 @@ impl BitcoinCoreController {
8178

8279
let mut process = match command.spawn() {
8380
Ok(child) => child,
84-
Err(e) => return Err(BitcoinCoreError::SpawnFailed(format!("{:?}", e))),
81+
Err(e) => return Err(BitcoinCoreError::SpawnFailed(format!("{e:?}"))),
8582
};
8683

8784
let mut out_reader = BufReader::new(process.stdout.take().unwrap());
@@ -111,14 +108,25 @@ impl BitcoinCoreController {
111108
command
112109
.stdout(Stdio::piped())
113110
.arg("-rpcconnect=127.0.0.1")
114-
.arg("-rpcport=8332")
115-
.arg("-rpcuser=neon-tester")
116-
.arg("-rpcpassword=neon-tester-pass")
117-
.arg("stop");
111+
.arg(format!("-rpcport={}", self.config.burnchain.rpc_port));
112+
113+
match (
114+
&self.config.burnchain.username,
115+
&self.config.burnchain.password,
116+
) {
117+
(Some(username), Some(password)) => {
118+
command
119+
.arg(format!("-rpcuser={username}"))
120+
.arg(format!("-rpcpassword={password}"));
121+
}
122+
_ => {}
123+
}
124+
125+
command.arg("stop");
118126

119127
let mut process = match command.spawn() {
120128
Ok(child) => child,
121-
Err(e) => return Err(BitcoinCoreError::SpawnFailed(format!("{:?}", e))),
129+
Err(e) => return Err(BitcoinCoreError::SpawnFailed(format!("{e:?}"))),
122130
};
123131

124132
let mut out_reader = BufReader::new(process.stdout.take().unwrap());
@@ -127,7 +135,7 @@ impl BitcoinCoreController {
127135
if bytes_read == 0 {
128136
break;
129137
}
130-
eprintln!("{}", &line);
138+
eprintln!("{line}");
131139
}
132140
}
133141
Ok(())

0 commit comments

Comments
 (0)