@@ -333,6 +333,7 @@ pub const HTLC_FAIL_BACK_BUFFER: u32 = CLTV_CLAIM_BUFFER + LATENCY_GRACE_PERIOD_
333333/// This type is used in [`Event::PersistClaimInfo`] and [`Event::ClaimInfoRequest`] to
334334/// associate persisted [`ClaimInfo`] with the correct commitment transaction.
335335#[ derive( Clone , Copy , Debug , Hash , PartialEq , Eq ) ]
336+ #[ cfg_attr( test, derive( PartialOrd , Ord ) ) ]
336337pub struct ClaimKey ( pub ( crate ) Txid ) ;
337338
338339impl Writeable for ClaimKey {
@@ -2480,6 +2481,17 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
24802481 inner. unsafe_get_latest_holder_commitment_txn ( & logger)
24812482 }
24822483
2484+ /// Like [`Self::unsafe_get_latest_holder_commitment_txn`] but returns the commitment
2485+ /// transaction for the confirmed funding scope (which may be a splice/alternative funding).
2486+ #[ cfg( any( test, feature = "_test_utils" ) ) ]
2487+ pub fn unsafe_get_latest_holder_commitment_txn_for_confirmed_scope < L : Logger > (
2488+ & self , logger : & L ,
2489+ ) -> Vec < Transaction > {
2490+ let mut inner = self . inner . lock ( ) . unwrap ( ) ;
2491+ let logger = WithChannelMonitor :: from_impl ( logger, & * inner, None ) ;
2492+ inner. unsafe_get_latest_holder_commitment_txn_for_confirmed_scope ( & logger)
2493+ }
2494+
24832495 /// Processes transactions in a newly connected block, which may result in any of the following:
24842496 /// - update the monitor's state against resolved HTLCs
24852497 /// - punish the counterparty in the case of seeing a revoked commitment transaction
@@ -5454,6 +5466,32 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
54545466 holder_transactions
54555467 }
54565468
5469+ /// Like [`Self::unsafe_get_latest_holder_commitment_txn`] but returns the commitment
5470+ /// transaction for the confirmed funding scope (which may be a splice/alternative funding).
5471+ #[ cfg( any( test, feature = "_test_utils" ) ) ]
5472+ fn unsafe_get_latest_holder_commitment_txn_for_confirmed_scope < L : Logger > (
5473+ & mut self , logger : & WithContext < L > ,
5474+ ) -> Vec < Transaction > {
5475+ log_debug ! (
5476+ logger,
5477+ "Getting signed copy of latest holder commitment transaction for confirmed scope!"
5478+ ) ;
5479+ let funding = get_confirmed_funding_scope ! ( self ) ;
5480+ let sig = self
5481+ . onchain_tx_handler
5482+ . signer
5483+ . unsafe_sign_holder_commitment (
5484+ & funding. channel_parameters ,
5485+ & funding. current_holder_commitment_tx ,
5486+ & self . onchain_tx_handler . secp_ctx ,
5487+ )
5488+ . expect ( "sign holder commitment" ) ;
5489+ let redeem_script = funding. channel_parameters . make_funding_redeemscript ( ) ;
5490+ let commitment_tx =
5491+ funding. current_holder_commitment_tx . add_holder_sig ( & redeem_script, sig) ;
5492+ vec ! [ commitment_tx]
5493+ }
5494+
54575495 #[ rustfmt:: skip]
54585496 fn block_connected < B : BroadcasterInterface , F : FeeEstimator , L : Logger > (
54595497 & mut self , header : & Header , txdata : & TransactionData , height : u32 , broadcaster : B ,
0 commit comments