@@ -45,10 +45,10 @@ use bitcoin::{
4545use std:: ops:: Deref ;
4646use std:: sync:: { Arc , Mutex } ;
4747
48- pub ( crate ) enum OnchainSendType {
49- SendRetainingReserve { amount_sats : u64 , cur_anchor_reserve_sats : u64 } ,
50- SendAllRetainingReserve { cur_anchor_reserve_sats : u64 } ,
51- SendAllDrainingReserve ,
48+ pub ( crate ) enum OnchainSendAmount {
49+ ExactRetainingReserve { amount_sats : u64 , cur_anchor_reserve_sats : u64 } ,
50+ AllRetainingReserve { cur_anchor_reserve_sats : u64 } ,
51+ AllDrainingReserve ,
5252}
5353
5454pub ( crate ) mod persist;
@@ -242,7 +242,7 @@ where
242242 }
243243
244244 pub ( crate ) fn send_to_address (
245- & self , address : & bitcoin:: Address , send_amount : OnchainSendType ,
245+ & self , address : & bitcoin:: Address , send_amount : OnchainSendAmount ,
246246 ) -> Result < Txid , Error > {
247247 let confirmation_target = ConfirmationTarget :: OnchainPayment ;
248248 let fee_rate = self . fee_estimator . estimate_fee_rate ( confirmation_target) ;
@@ -252,7 +252,7 @@ where
252252
253253 // Prepare the tx_builder. We properly check the reserve requirements (again) further down.
254254 let tx_builder = match send_amount {
255- OnchainSendType :: SendRetainingReserve { amount_sats, .. } => {
255+ OnchainSendAmount :: ExactRetainingReserve { amount_sats, .. } => {
256256 let mut tx_builder = locked_wallet. build_tx ( ) ;
257257 let amount = Amount :: from_sat ( amount_sats) ;
258258 tx_builder
@@ -261,7 +261,7 @@ where
261261 . enable_rbf ( ) ;
262262 tx_builder
263263 } ,
264- OnchainSendType :: SendAllRetainingReserve { cur_anchor_reserve_sats } => {
264+ OnchainSendAmount :: AllRetainingReserve { cur_anchor_reserve_sats } => {
265265 let change_address_info = locked_wallet. peek_address ( KeychainKind :: Internal , 0 ) ;
266266 let balance = locked_wallet. balance ( ) ;
267267 let spendable_amount_sats = self
@@ -320,7 +320,7 @@ where
320320 . enable_rbf ( ) ;
321321 tx_builder
322322 } ,
323- OnchainSendType :: SendAllDrainingReserve => {
323+ OnchainSendAmount :: AllDrainingReserve => {
324324 let mut tx_builder = locked_wallet. build_tx ( ) ;
325325 tx_builder
326326 . drain_wallet ( )
@@ -344,7 +344,10 @@ where
344344
345345 // Check the reserve requirements (again) and return an error if they aren't met.
346346 match send_amount {
347- OnchainSendType :: SendRetainingReserve { amount_sats, cur_anchor_reserve_sats } => {
347+ OnchainSendAmount :: ExactRetainingReserve {
348+ amount_sats,
349+ cur_anchor_reserve_sats,
350+ } => {
348351 let balance = locked_wallet. balance ( ) ;
349352 let spendable_amount_sats = self
350353 . get_balances_inner ( balance, cur_anchor_reserve_sats)
@@ -371,7 +374,7 @@ where
371374 return Err ( Error :: InsufficientFunds ) ;
372375 }
373376 } ,
374- OnchainSendType :: SendAllRetainingReserve { cur_anchor_reserve_sats } => {
377+ OnchainSendAmount :: AllRetainingReserve { cur_anchor_reserve_sats } => {
375378 let balance = locked_wallet. balance ( ) ;
376379 let spendable_amount_sats = self
377380 . get_balances_inner ( balance, cur_anchor_reserve_sats)
@@ -420,7 +423,7 @@ where
420423 let txid = tx. compute_txid ( ) ;
421424
422425 match send_amount {
423- OnchainSendType :: SendRetainingReserve { amount_sats, .. } => {
426+ OnchainSendAmount :: ExactRetainingReserve { amount_sats, .. } => {
424427 log_info ! (
425428 self . logger,
426429 "Created new transaction {} sending {}sats on-chain to address {}" ,
@@ -429,7 +432,7 @@ where
429432 address
430433 ) ;
431434 } ,
432- OnchainSendType :: SendAllRetainingReserve { cur_anchor_reserve_sats } => {
435+ OnchainSendAmount :: AllRetainingReserve { cur_anchor_reserve_sats } => {
433436 log_info ! (
434437 self . logger,
435438 "Created new transaction {} sending available on-chain funds retaining a reserve of {}sats to address {}" ,
@@ -438,7 +441,7 @@ where
438441 address,
439442 ) ;
440443 } ,
441- OnchainSendType :: SendAllDrainingReserve => {
444+ OnchainSendAmount :: AllDrainingReserve => {
442445 log_info ! (
443446 self . logger,
444447 "Created new transaction {} sending all available on-chain funds to address {}" ,
0 commit comments