Skip to content

Commit 2adedb5

Browse files
committed
f Don't take &mut self here
1 parent 6264a3a commit 2adedb5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ impl Node {
465465
/// Starts the necessary background tasks, such as handling events coming from user input,
466466
/// LDK/BDK, and the peer-to-peer network. After this returns, the [`Node`] instance can be
467467
/// controlled via the provided API methods in a thread-safe manner.
468-
pub fn start(&mut self) -> Result<(), Error> {
468+
pub fn start(&self) -> Result<(), Error> {
469469
// Acquire a run lock and hold it until we're setup.
470470
let mut run_lock = self.running.write().unwrap();
471471
if run_lock.is_some() {
@@ -479,7 +479,7 @@ impl Node {
479479
}
480480

481481
/// Disconnects all peers, stops all running background tasks, and shuts down [`Node`].
482-
pub fn stop(&mut self) -> Result<(), Error> {
482+
pub fn stop(&self) -> Result<(), Error> {
483483
let mut run_lock = self.running.write().unwrap();
484484
if run_lock.is_none() {
485485
return Err(Error::NotRunning);
@@ -697,14 +697,14 @@ impl Node {
697697
}
698698

699699
/// Retrieve a new on-chain/funding address.
700-
pub fn new_funding_address(&mut self) -> Result<bitcoin::Address, Error> {
700+
pub fn new_funding_address(&self) -> Result<bitcoin::Address, Error> {
701701
let funding_address = self.wallet.get_new_address()?;
702702
log_info!(self.logger, "Generated new funding address: {}", funding_address);
703703
Ok(funding_address)
704704
}
705705

706706
/// Retrieve the current on-chain balance.
707-
pub fn on_chain_balance(&mut self) -> Result<bdk::Balance, Error> {
707+
pub fn on_chain_balance(&self) -> Result<bdk::Balance, Error> {
708708
self.wallet.get_balance()
709709
}
710710

src/tests/functional_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ fn rand_config() -> Config {
124124
fn channel_full_cycle() {
125125
println!("== Node A ==");
126126
let config_a = rand_config();
127-
let mut node_a = Builder::from_config(config_a).build();
127+
let node_a = Builder::from_config(config_a).build();
128128
node_a.start().unwrap();
129129
let addr_a = node_a.new_funding_address().unwrap();
130130

131131
println!("\n== Node B ==");
132132
let config_b = rand_config();
133-
let mut node_b = Builder::from_config(config_b).build();
133+
let node_b = Builder::from_config(config_b).build();
134134
node_b.start().unwrap();
135135
let addr_b = node_b.new_funding_address().unwrap();
136136

0 commit comments

Comments
 (0)