@@ -625,7 +625,7 @@ where
625
625
/// Handles a [`BumpTransactionEvent::ChannelClose`] event variant by producing a fully-signed
626
626
/// transaction spending an anchor output of the commitment transaction to bump its fee and
627
627
/// broadcasts them to the network as a package.
628
- fn handle_channel_close (
628
+ async fn handle_channel_close (
629
629
& self , claim_id : ClaimId , package_target_feerate_sat_per_1000_weight : u32 ,
630
630
commitment_tx : & Transaction , commitment_tx_fee_sat : u64 ,
631
631
anchor_descriptor : & AnchorDescriptor ,
@@ -770,7 +770,7 @@ where
770
770
771
771
/// Handles a [`BumpTransactionEvent::HTLCResolution`] event variant by producing a
772
772
/// fully-signed, fee-bumped HTLC transaction that is broadcast to the network.
773
- fn handle_htlc_resolution (
773
+ async fn handle_htlc_resolution (
774
774
& self , claim_id : ClaimId , target_feerate_sat_per_1000_weight : u32 ,
775
775
htlc_descriptors : & [ HTLCDescriptor ] , tx_lock_time : LockTime ,
776
776
) -> Result < ( ) , ( ) > {
@@ -899,7 +899,7 @@ where
899
899
}
900
900
901
901
/// Handles all variants of [`BumpTransactionEvent`].
902
- pub fn handle_event ( & self , event : & BumpTransactionEvent ) {
902
+ pub async fn handle_event ( & self , event : & BumpTransactionEvent ) {
903
903
match event {
904
904
BumpTransactionEvent :: ChannelClose {
905
905
claim_id,
@@ -915,13 +915,16 @@ where
915
915
log_bytes!( claim_id. 0 ) ,
916
916
commitment_tx. compute_txid( )
917
917
) ;
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
+ {
925
928
log_error ! (
926
929
self . logger,
927
930
"Failed bumping commitment transaction fee for {}" ,
@@ -942,12 +945,15 @@ where
942
945
log_bytes!( claim_id. 0 ) ,
943
946
log_iter!( htlc_descriptors. iter( ) . map( |d| d. outpoint( ) ) )
944
947
) ;
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
+ {
951
957
log_error ! (
952
958
self . logger,
953
959
"Failed bumping HTLC transaction fee for commitment {}" ,
@@ -1009,8 +1015,8 @@ mod tests {
1009
1015
}
1010
1016
}
1011
1017
1012
- #[ test]
1013
- fn test_op_return_under_funds ( ) {
1018
+ #[ tokio :: test]
1019
+ async fn test_op_return_under_funds ( ) {
1014
1020
// Test what happens if we have to select coins but the anchor output value itself suffices
1015
1021
// to pay the required fee.
1016
1022
//
@@ -1069,7 +1075,7 @@ mod tests {
1069
1075
transaction_parameters. channel_type_features =
1070
1076
ChannelTypeFeatures :: anchors_zero_htlc_fee_and_dependencies ( ) ;
1071
1077
1072
- handler . handle_event ( & BumpTransactionEvent :: ChannelClose {
1078
+ let channel_close_event = & BumpTransactionEvent :: ChannelClose {
1073
1079
channel_id : ChannelId ( [ 42 ; 32 ] ) ,
1074
1080
counterparty_node_id : PublicKey :: from_slice ( & [ 2 ; 33 ] ) . unwrap ( ) ,
1075
1081
claim_id : ClaimId ( [ 42 ; 32 ] ) ,
@@ -1085,6 +1091,7 @@ mod tests {
1085
1091
outpoint : OutPoint { txid : Txid :: from_byte_array ( [ 42 ; 32 ] ) , vout : 0 } ,
1086
1092
} ,
1087
1093
pending_htlcs : Vec :: new ( ) ,
1088
- } ) ;
1094
+ } ;
1095
+ handler. handle_event ( channel_close_event) . await ;
1089
1096
}
1090
1097
}
0 commit comments