@@ -13152,6 +13152,17 @@ mod tests {
1315213152 fn test_supports_anchors_zero_htlc_tx_fee() {
1315313153 // Tests that if both sides support and negotiate `anchors_zero_fee_htlc_tx`, it is the
1315413154 // resulting `channel_type`.
13155+ let mut config = UserConfig::default();
13156+ config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
13157+
13158+ let mut expected_channel_type = ChannelTypeFeatures::empty();
13159+ expected_channel_type.set_static_remote_key_required();
13160+ expected_channel_type.set_anchors_zero_fee_htlc_tx_required();
13161+
13162+ do_test_supports_channel_type(config, expected_channel_type)
13163+ }
13164+
13165+ fn do_test_supports_channel_type(config: UserConfig, expected_channel_type: ChannelTypeFeatures) {
1315513166 let secp_ctx = Secp256k1::new();
1315613167 let fee_estimator = LowerBoundedFeeEstimator::new(&TestFeeEstimator{fee_est: 15000});
1315713168 let network = Network::Testnet;
@@ -13161,21 +13172,14 @@ mod tests {
1316113172 let node_id_a = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[1; 32]).unwrap());
1316213173 let node_id_b = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[2; 32]).unwrap());
1316313174
13164- let mut config = UserConfig::default();
13165- config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
13166-
13167- // It is not enough for just the initiator to signal `option_anchors_zero_fee_htlc_tx`, both
13168- // need to signal it.
13175+ // Assert that we don't get the target channel type when the receiving node does not signal
13176+ // support.
1316913177 let channel_a = OutboundV1Channel::<&TestKeysInterface>::new(
1317013178 &fee_estimator, &&keys_provider, &&keys_provider, node_id_b,
1317113179 &channelmanager::provided_init_features(&UserConfig::default()), 10000000, 100000, 42,
1317213180 &config, 0, 42, None, &logger
1317313181 ).unwrap();
13174- assert!(!channel_a.funding.get_channel_type().supports_anchors_zero_fee_htlc_tx());
13175-
13176- let mut expected_channel_type = ChannelTypeFeatures::empty();
13177- expected_channel_type.set_static_remote_key_required();
13178- expected_channel_type.set_anchors_zero_fee_htlc_tx_required();
13182+ assert!(channel_a.funding.get_channel_type() != &expected_channel_type);
1317913183
1318013184 let mut channel_a = OutboundV1Channel::<&TestKeysInterface>::new(
1318113185 &fee_estimator, &&keys_provider, &&keys_provider, node_id_b,
0 commit comments