@@ -625,7 +625,7 @@ where
625625 /// Handles a [`BumpTransactionEvent::ChannelClose`] event variant by producing a fully-signed
626626 /// transaction spending an anchor output of the commitment transaction to bump its fee and
627627 /// broadcasts them to the network as a package.
628- fn handle_channel_close (
628+ async fn handle_channel_close (
629629 & self , claim_id : ClaimId , package_target_feerate_sat_per_1000_weight : u32 ,
630630 commitment_tx : & Transaction , commitment_tx_fee_sat : u64 ,
631631 anchor_descriptor : & AnchorDescriptor ,
@@ -770,7 +770,7 @@ where
770770
771771 /// Handles a [`BumpTransactionEvent::HTLCResolution`] event variant by producing a
772772 /// fully-signed, fee-bumped HTLC transaction that is broadcast to the network.
773- fn handle_htlc_resolution (
773+ async fn handle_htlc_resolution (
774774 & self , claim_id : ClaimId , target_feerate_sat_per_1000_weight : u32 ,
775775 htlc_descriptors : & [ HTLCDescriptor ] , tx_lock_time : LockTime ,
776776 ) -> Result < ( ) , ( ) > {
@@ -899,7 +899,7 @@ where
899899 }
900900
901901 /// Handles all variants of [`BumpTransactionEvent`].
902- pub fn handle_event ( & self , event : & BumpTransactionEvent ) {
902+ pub async fn handle_event ( & self , event : & BumpTransactionEvent ) {
903903 match event {
904904 BumpTransactionEvent :: ChannelClose {
905905 claim_id,
@@ -915,13 +915,16 @@ where
915915 log_bytes!( claim_id. 0 ) ,
916916 commitment_tx. compute_txid( )
917917 ) ;
918- if let Err ( _) = self . handle_channel_close (
919- * claim_id,
920- * package_target_feerate_sat_per_1000_weight,
921- commitment_tx,
922- * commitment_tx_fee_satoshis,
923- anchor_descriptor,
924- ) {
918+ if let Err ( _) = self
919+ . handle_channel_close (
920+ * claim_id,
921+ * package_target_feerate_sat_per_1000_weight,
922+ commitment_tx,
923+ * commitment_tx_fee_satoshis,
924+ anchor_descriptor,
925+ )
926+ . await
927+ {
925928 log_error ! (
926929 self . logger,
927930 "Failed bumping commitment transaction fee for {}" ,
@@ -942,12 +945,15 @@ where
942945 log_bytes!( claim_id. 0 ) ,
943946 log_iter!( htlc_descriptors. iter( ) . map( |d| d. outpoint( ) ) )
944947 ) ;
945- if let Err ( _) = self . handle_htlc_resolution (
946- * claim_id,
947- * target_feerate_sat_per_1000_weight,
948- htlc_descriptors,
949- * tx_lock_time,
950- ) {
948+ if let Err ( _) = self
949+ . handle_htlc_resolution (
950+ * claim_id,
951+ * target_feerate_sat_per_1000_weight,
952+ htlc_descriptors,
953+ * tx_lock_time,
954+ )
955+ . await
956+ {
951957 log_error ! (
952958 self . logger,
953959 "Failed bumping HTLC transaction fee for commitment {}" ,
@@ -1009,8 +1015,8 @@ mod tests {
10091015 }
10101016 }
10111017
1012- #[ test]
1013- fn test_op_return_under_funds ( ) {
1018+ #[ tokio :: test]
1019+ async fn test_op_return_under_funds ( ) {
10141020 // Test what happens if we have to select coins but the anchor output value itself suffices
10151021 // to pay the required fee.
10161022 //
@@ -1069,22 +1075,24 @@ mod tests {
10691075 transaction_parameters. channel_type_features =
10701076 ChannelTypeFeatures :: anchors_zero_htlc_fee_and_dependencies ( ) ;
10711077
1072- handler. handle_event ( & BumpTransactionEvent :: ChannelClose {
1073- channel_id : ChannelId ( [ 42 ; 32 ] ) ,
1074- counterparty_node_id : PublicKey :: from_slice ( & [ 2 ; 33 ] ) . unwrap ( ) ,
1075- claim_id : ClaimId ( [ 42 ; 32 ] ) ,
1076- package_target_feerate_sat_per_1000_weight : 868 ,
1077- commitment_tx_fee_satoshis : 930 ,
1078- commitment_tx,
1079- anchor_descriptor : AnchorDescriptor {
1080- channel_derivation_parameters : ChannelDerivationParameters {
1081- value_satoshis : 42_000_000 ,
1082- keys_id : [ 42 ; 32 ] ,
1083- transaction_parameters,
1078+ handler
1079+ . handle_event ( & BumpTransactionEvent :: ChannelClose {
1080+ channel_id : ChannelId ( [ 42 ; 32 ] ) ,
1081+ counterparty_node_id : PublicKey :: from_slice ( & [ 2 ; 33 ] ) . unwrap ( ) ,
1082+ claim_id : ClaimId ( [ 42 ; 32 ] ) ,
1083+ package_target_feerate_sat_per_1000_weight : 868 ,
1084+ commitment_tx_fee_satoshis : 930 ,
1085+ commitment_tx,
1086+ anchor_descriptor : AnchorDescriptor {
1087+ channel_derivation_parameters : ChannelDerivationParameters {
1088+ value_satoshis : 42_000_000 ,
1089+ keys_id : [ 42 ; 32 ] ,
1090+ transaction_parameters,
1091+ } ,
1092+ outpoint : OutPoint { txid : Txid :: from_byte_array ( [ 42 ; 32 ] ) , vout : 0 } ,
10841093 } ,
1085- outpoint : OutPoint { txid : Txid :: from_byte_array ( [ 42 ; 32 ] ) , vout : 0 } ,
1086- } ,
1087- pending_htlcs : Vec :: new ( ) ,
1088- } ) ;
1094+ pending_htlcs : Vec :: new ( ) ,
1095+ } )
1096+ . await ;
10891097 }
10901098}
0 commit comments