@@ -13318,6 +13318,17 @@ mod tests {
13318
13318
fn test_supports_anchors_zero_htlc_tx_fee() {
13319
13319
// Tests that if both sides support and negotiate `anchors_zero_fee_htlc_tx`, it is the
13320
13320
// resulting `channel_type`.
13321
+ let mut config = UserConfig::default();
13322
+ config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
13323
+
13324
+ let mut expected_channel_type = ChannelTypeFeatures::empty();
13325
+ expected_channel_type.set_static_remote_key_required();
13326
+ expected_channel_type.set_anchors_zero_fee_htlc_tx_required();
13327
+
13328
+ do_test_supports_channel_type(config, expected_channel_type)
13329
+ }
13330
+
13331
+ fn do_test_supports_channel_type(config: UserConfig, expected_channel_type: ChannelTypeFeatures) {
13321
13332
let secp_ctx = Secp256k1::new();
13322
13333
let fee_estimator = LowerBoundedFeeEstimator::new(&TestFeeEstimator{fee_est: 15000});
13323
13334
let network = Network::Testnet;
@@ -13327,21 +13338,13 @@ mod tests {
13327
13338
let node_id_a = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[1; 32]).unwrap());
13328
13339
let node_id_b = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[2; 32]).unwrap());
13329
13340
13330
- let mut config = UserConfig::default();
13331
- config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
13332
-
13333
- // It is not enough for just the initiator to signal `option_anchors_zero_fee_htlc_tx`, both
13334
- // need to signal it.
13341
+ // Assert that we get `static_remotekey` when no custom config is negotiated.
13335
13342
let channel_a = OutboundV1Channel::<&TestKeysInterface>::new(
13336
13343
&fee_estimator, &&keys_provider, &&keys_provider, node_id_b,
13337
13344
&channelmanager::provided_init_features(&UserConfig::default()), 10000000, 100000, 42,
13338
13345
&config, 0, 42, None, &logger
13339
13346
).unwrap();
13340
- assert!(!channel_a.funding.get_channel_type().supports_anchors_zero_fee_htlc_tx());
13341
-
13342
- let mut expected_channel_type = ChannelTypeFeatures::empty();
13343
- expected_channel_type.set_static_remote_key_required();
13344
- expected_channel_type.set_anchors_zero_fee_htlc_tx_required();
13347
+ assert_eq!(channel_a.funding.get_channel_type(), &ChannelTypeFeatures::only_static_remote_key());
13345
13348
13346
13349
let mut channel_a = OutboundV1Channel::<&TestKeysInterface>::new(
13347
13350
&fee_estimator, &&keys_provider, &&keys_provider, node_id_b,
0 commit comments