@@ -13125,6 +13125,17 @@ mod tests {
13125
13125
fn test_supports_anchors_zero_htlc_tx_fee() {
13126
13126
// Tests that if both sides support and negotiate `anchors_zero_fee_htlc_tx`, it is the
13127
13127
// resulting `channel_type`.
13128
+ let mut config = UserConfig::default();
13129
+ config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
13130
+
13131
+ let mut expected_channel_type = ChannelTypeFeatures::empty();
13132
+ expected_channel_type.set_static_remote_key_required();
13133
+ expected_channel_type.set_anchors_zero_fee_htlc_tx_required();
13134
+
13135
+ do_test_supports_channel_type(config, expected_channel_type)
13136
+ }
13137
+
13138
+ fn do_test_supports_channel_type(config: UserConfig, expected_channel_type: ChannelTypeFeatures) {
13128
13139
let secp_ctx = Secp256k1::new();
13129
13140
let fee_estimator = LowerBoundedFeeEstimator::new(&TestFeeEstimator{fee_est: 15000});
13130
13141
let network = Network::Testnet;
@@ -13134,21 +13145,14 @@ mod tests {
13134
13145
let node_id_a = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[1; 32]).unwrap());
13135
13146
let node_id_b = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[2; 32]).unwrap());
13136
13147
13137
- let mut config = UserConfig::default();
13138
- config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
13139
-
13140
- // It is not enough for just the initiator to signal `option_anchors_zero_fee_htlc_tx`, both
13141
- // need to signal it.
13148
+ // Assert that we don't get the target channel type when the receiving node does not signal
13149
+ // support.
13142
13150
let channel_a = OutboundV1Channel::<&TestKeysInterface>::new(
13143
13151
&fee_estimator, &&keys_provider, &&keys_provider, node_id_b,
13144
13152
&channelmanager::provided_init_features(&UserConfig::default()), 10000000, 100000, 42,
13145
13153
&config, 0, 42, None, &logger
13146
13154
).unwrap();
13147
- assert!(!channel_a.funding.get_channel_type().supports_anchors_zero_fee_htlc_tx());
13148
-
13149
- let mut expected_channel_type = ChannelTypeFeatures::empty();
13150
- expected_channel_type.set_static_remote_key_required();
13151
- expected_channel_type.set_anchors_zero_fee_htlc_tx_required();
13155
+ assert!(channel_a.funding.get_channel_type() != &expected_channel_type);
13152
13156
13153
13157
let mut channel_a = OutboundV1Channel::<&TestKeysInterface>::new(
13154
13158
&fee_estimator, &&keys_provider, &&keys_provider, node_id_b,
0 commit comments