@@ -810,18 +810,30 @@ pub(crate) fn make_funding_redeemscript_from_slices(broadcaster_funding_key: &[u
810
810
///
811
811
/// Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
812
812
/// commitment transaction).
813
- #[ rustfmt:: skip]
814
- pub fn build_htlc_transaction ( commitment_txid : & Txid , feerate_per_kw : u32 , contest_delay : u16 , htlc : & HTLCOutputInCommitment , channel_type_features : & ChannelTypeFeatures , broadcaster_delayed_payment_key : & DelayedPaymentKey , revocation_key : & RevocationKey ) -> Transaction {
815
- let txins= vec ! [ build_htlc_input( commitment_txid, htlc, channel_type_features) ] ;
816
-
817
- let mut txouts: Vec < TxOut > = Vec :: new ( ) ;
818
- txouts. push ( build_htlc_output (
819
- feerate_per_kw, contest_delay, htlc, channel_type_features,
820
- broadcaster_delayed_payment_key, revocation_key
821
- ) ) ;
813
+ pub fn build_htlc_transaction (
814
+ commitment_txid : & Txid , feerate_per_kw : u32 , contest_delay : u16 , htlc : & HTLCOutputInCommitment ,
815
+ channel_type_features : & ChannelTypeFeatures ,
816
+ broadcaster_delayed_payment_key : & DelayedPaymentKey , revocation_key : & RevocationKey ,
817
+ ) -> Transaction {
818
+ let txins = vec ! [ build_htlc_input( commitment_txid, htlc, channel_type_features) ] ;
819
+
820
+ let txouts: Vec < TxOut > = vec ! [ build_htlc_output(
821
+ feerate_per_kw,
822
+ contest_delay,
823
+ htlc,
824
+ channel_type_features,
825
+ broadcaster_delayed_payment_key,
826
+ revocation_key,
827
+ ) ] ;
828
+
829
+ let version = if channel_type_features. supports_anchor_zero_fee_commitments ( ) {
830
+ Version :: non_standard ( 3 )
831
+ } else {
832
+ Version :: TWO
833
+ } ;
822
834
823
835
Transaction {
824
- version : Version :: TWO ,
836
+ version,
825
837
lock_time : LockTime :: from_consensus ( if htlc. offered { htlc. cltv_expiry } else { 0 } ) ,
826
838
input : txins,
827
839
output : txouts,
0 commit comments