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