@@ -30,6 +30,7 @@ use crate::sign::{
3030} ;
3131use crate :: sign:: ecdsa:: EcdsaChannelSigner ;
3232use crate :: sync:: Mutex ;
33+ use crate :: util:: async_poll:: AsyncResult ;
3334use crate :: util:: logger:: Logger ;
3435
3536use bitcoin:: { OutPoint , Psbt , PubkeyHash , Sequence , ScriptBuf , Transaction , TxIn , TxOut , Witness , WPubkeyHash } ;
@@ -603,7 +604,7 @@ where
603604 /// Handles a [`BumpTransactionEvent::ChannelClose`] event variant by producing a fully-signed
604605 /// transaction spending an anchor output of the commitment transaction to bump its fee and
605606 /// broadcasts them to the network as a package.
606- fn handle_channel_close (
607+ async fn handle_channel_close (
607608 & self , claim_id : ClaimId , package_target_feerate_sat_per_1000_weight : u32 ,
608609 commitment_tx : & Transaction , commitment_tx_fee_sat : u64 , anchor_descriptor : & AnchorDescriptor ,
609610 ) -> Result < ( ) , ( ) > {
@@ -714,7 +715,7 @@ where
714715
715716 /// Handles a [`BumpTransactionEvent::HTLCResolution`] event variant by producing a
716717 /// fully-signed, fee-bumped HTLC transaction that is broadcast to the network.
717- fn handle_htlc_resolution (
718+ async fn handle_htlc_resolution (
718719 & self , claim_id : ClaimId , target_feerate_sat_per_1000_weight : u32 ,
719720 htlc_descriptors : & [ HTLCDescriptor ] , tx_lock_time : LockTime ,
720721 ) -> Result < ( ) , ( ) > {
@@ -818,7 +819,7 @@ where
818819 }
819820
820821 /// Handles all variants of [`BumpTransactionEvent`].
821- pub fn handle_event ( & self , event : & BumpTransactionEvent ) {
822+ pub async fn handle_event ( & self , event : & BumpTransactionEvent ) {
822823 match event {
823824 BumpTransactionEvent :: ChannelClose {
824825 claim_id, package_target_feerate_sat_per_1000_weight, commitment_tx,
@@ -829,7 +830,7 @@ where
829830 if let Err ( _) = self . handle_channel_close (
830831 * claim_id, * package_target_feerate_sat_per_1000_weight, commitment_tx,
831832 * commitment_tx_fee_satoshis, anchor_descriptor,
832- ) {
833+ ) . await {
833834 log_error ! ( self . logger, "Failed bumping commitment transaction fee for {}" ,
834835 commitment_tx. compute_txid( ) ) ;
835836 }
@@ -841,7 +842,7 @@ where
841842 log_bytes!( claim_id. 0 ) , log_iter!( htlc_descriptors. iter( ) . map( |d| d. outpoint( ) ) ) ) ;
842843 if let Err ( _) = self . handle_htlc_resolution (
843844 * claim_id, * target_feerate_sat_per_1000_weight, htlc_descriptors, * tx_lock_time,
844- ) {
845+ ) . await {
845846 log_error ! ( self . logger, "Failed bumping HTLC transaction fee for commitment {}" ,
846847 htlc_descriptors[ 0 ] . commitment_txid) ;
847848 }
@@ -903,8 +904,8 @@ mod tests {
903904 }
904905 }
905906
906- #[ test]
907- fn test_op_return_under_funds ( ) {
907+ #[ tokio :: test]
908+ async fn test_op_return_under_funds ( ) {
908909 // Test what happens if we have to select coins but the anchor output value itself suffices
909910 // to pay the required fee.
910911 //
@@ -964,6 +965,6 @@ mod tests {
964965 outpoint : OutPoint { txid : Txid :: from_byte_array ( [ 42 ; 32 ] ) , vout : 0 } ,
965966 } ,
966967 pending_htlcs : Vec :: new ( ) ,
967- } ) ;
968+ } ) . await ;
968969 }
969970}
0 commit comments