@@ -30,6 +30,7 @@ use crate::sign::{
30
30
} ;
31
31
use crate :: sign:: ecdsa:: EcdsaChannelSigner ;
32
32
use crate :: sync:: Mutex ;
33
+ use crate :: util:: async_poll:: AsyncResult ;
33
34
use crate :: util:: logger:: Logger ;
34
35
35
36
use bitcoin:: { OutPoint , Psbt , PubkeyHash , Sequence , ScriptBuf , Transaction , TxIn , TxOut , Witness , WPubkeyHash } ;
@@ -603,7 +604,7 @@ where
603
604
/// Handles a [`BumpTransactionEvent::ChannelClose`] event variant by producing a fully-signed
604
605
/// transaction spending an anchor output of the commitment transaction to bump its fee and
605
606
/// broadcasts them to the network as a package.
606
- fn handle_channel_close (
607
+ async fn handle_channel_close (
607
608
& self , claim_id : ClaimId , package_target_feerate_sat_per_1000_weight : u32 ,
608
609
commitment_tx : & Transaction , commitment_tx_fee_sat : u64 , anchor_descriptor : & AnchorDescriptor ,
609
610
) -> Result < ( ) , ( ) > {
@@ -714,7 +715,7 @@ where
714
715
715
716
/// Handles a [`BumpTransactionEvent::HTLCResolution`] event variant by producing a
716
717
/// fully-signed, fee-bumped HTLC transaction that is broadcast to the network.
717
- fn handle_htlc_resolution (
718
+ async fn handle_htlc_resolution (
718
719
& self , claim_id : ClaimId , target_feerate_sat_per_1000_weight : u32 ,
719
720
htlc_descriptors : & [ HTLCDescriptor ] , tx_lock_time : LockTime ,
720
721
) -> Result < ( ) , ( ) > {
@@ -818,7 +819,7 @@ where
818
819
}
819
820
820
821
/// Handles all variants of [`BumpTransactionEvent`].
821
- pub fn handle_event ( & self , event : & BumpTransactionEvent ) {
822
+ pub async fn handle_event ( & self , event : & BumpTransactionEvent ) {
822
823
match event {
823
824
BumpTransactionEvent :: ChannelClose {
824
825
claim_id, package_target_feerate_sat_per_1000_weight, commitment_tx,
@@ -829,7 +830,7 @@ where
829
830
if let Err ( _) = self . handle_channel_close (
830
831
* claim_id, * package_target_feerate_sat_per_1000_weight, commitment_tx,
831
832
* commitment_tx_fee_satoshis, anchor_descriptor,
832
- ) {
833
+ ) . await {
833
834
log_error ! ( self . logger, "Failed bumping commitment transaction fee for {}" ,
834
835
commitment_tx. compute_txid( ) ) ;
835
836
}
@@ -841,7 +842,7 @@ where
841
842
log_bytes!( claim_id. 0 ) , log_iter!( htlc_descriptors. iter( ) . map( |d| d. outpoint( ) ) ) ) ;
842
843
if let Err ( _) = self . handle_htlc_resolution (
843
844
* claim_id, * target_feerate_sat_per_1000_weight, htlc_descriptors, * tx_lock_time,
844
- ) {
845
+ ) . await {
845
846
log_error ! ( self . logger, "Failed bumping HTLC transaction fee for commitment {}" ,
846
847
htlc_descriptors[ 0 ] . commitment_txid) ;
847
848
}
@@ -903,8 +904,8 @@ mod tests {
903
904
}
904
905
}
905
906
906
- #[ test]
907
- fn test_op_return_under_funds ( ) {
907
+ #[ tokio :: test]
908
+ async fn test_op_return_under_funds ( ) {
908
909
// Test what happens if we have to select coins but the anchor output value itself suffices
909
910
// to pay the required fee.
910
911
//
@@ -964,6 +965,6 @@ mod tests {
964
965
outpoint : OutPoint { txid : Txid :: from_byte_array ( [ 42 ; 32 ] ) , vout : 0 } ,
965
966
} ,
966
967
pending_htlcs : Vec :: new ( ) ,
967
- } ) ;
968
+ } ) . await ;
968
969
}
969
970
}
0 commit comments