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