Skip to content

Commit 7f128d9

Browse files
committed
f Rename to send_to_onchain_address/send_all_to_onchain_address
1 parent 76070f9 commit 7f128d9

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,9 @@ impl Node {
837837
}
838838

839839
/// Send an on-chain payment to the given address.
840-
pub fn withdraw(&self, address: &bitcoin::Address, amount_sats: u64) -> Result<Txid, Error> {
840+
pub fn send_to_onchain_address(
841+
&self, address: &bitcoin::Address, amount_sats: u64,
842+
) -> Result<Txid, Error> {
841843
let runtime_lock = self.running.read().unwrap();
842844
if runtime_lock.is_none() {
843845
return Err(Error::NotRunning);
@@ -852,7 +854,7 @@ impl Node {
852854
}
853855

854856
/// Send an on-chain payment to the given address, draining all the available funds.
855-
pub fn withdraw_all(&self, address: &bitcoin::Address) -> Result<Txid, Error> {
857+
pub fn send_all_to_onchain_address(&self, address: &bitcoin::Address) -> Result<Txid, Error> {
856858
let runtime_lock = self.running.read().unwrap();
857859
if runtime_lock.is_none() {
858860
return Err(Error::NotRunning);

src/test/functional_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,9 @@ fn onchain_spend_receive() {
306306
node_b.sync_wallets().unwrap();
307307
assert_eq!(node_b.onchain_balance().unwrap().get_spendable(), 100000);
308308

309-
assert_eq!(Err(Error::InsufficientFunds), node_a.withdraw(&addr_b, 1000));
309+
assert_eq!(Err(Error::InsufficientFunds), node_a.send_to_onchain_address(&addr_b, 1000));
310310

311-
let txid = node_b.withdraw(&addr_a, 1000).unwrap();
311+
let txid = node_b.send_to_onchain_address(&addr_a, 1000).unwrap();
312312
generate_blocks_and_wait(&bitcoind, &electrsd, 6);
313313
wait_for_tx(&electrsd, txid);
314314

@@ -320,7 +320,7 @@ fn onchain_spend_receive() {
320320
assert!(node_b.onchain_balance().unwrap().get_spendable() < 100000);
321321

322322
let addr_b = node_b.new_funding_address().unwrap();
323-
let txid = node_a.withdraw_all(&addr_b).unwrap();
323+
let txid = node_a.send_all_to_onchain_address(&addr_b).unwrap();
324324
generate_blocks_and_wait(&bitcoind, &electrsd, 6);
325325
wait_for_tx(&electrsd, txid);
326326

0 commit comments

Comments
 (0)