@@ -13152,6 +13152,17 @@ mod tests {
13152
13152
fn test_supports_anchors_zero_htlc_tx_fee() {
13153
13153
// Tests that if both sides support and negotiate `anchors_zero_fee_htlc_tx`, it is the
13154
13154
// 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) {
13155
13166
let secp_ctx = Secp256k1::new();
13156
13167
let fee_estimator = LowerBoundedFeeEstimator::new(&TestFeeEstimator{fee_est: 15000});
13157
13168
let network = Network::Testnet;
@@ -13161,21 +13172,14 @@ mod tests {
13161
13172
let node_id_a = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[1; 32]).unwrap());
13162
13173
let node_id_b = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[2; 32]).unwrap());
13163
13174
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.
13169
13177
let channel_a = OutboundV1Channel::<&TestKeysInterface>::new(
13170
13178
&fee_estimator, &&keys_provider, &&keys_provider, node_id_b,
13171
13179
&channelmanager::provided_init_features(&UserConfig::default()), 10000000, 100000, 42,
13172
13180
&config, 0, 42, None, &logger
13173
13181
).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);
13179
13183
13180
13184
let mut channel_a = OutboundV1Channel::<&TestKeysInterface>::new(
13181
13185
&fee_estimator, &&keys_provider, &&keys_provider, node_id_b,
0 commit comments