Skip to content

Commit e04a1b3

Browse files
authored
Merge pull request #975 from TheBlueMatt/2021-06-fix-fee-calc
Make the base fee configurable in ChannelConfig
2 parents 12253e5 + 4cc0d9d commit e04a1b3

File tree

12 files changed

+410
-116
lines changed

12 files changed

+410
-116
lines changed

fuzz/src/chanmon_consistency.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
338338
let monitor = Arc::new(TestChainMonitor::new(broadcast.clone(), logger.clone(), fee_est.clone(), Arc::new(TestPersister{}), Arc::clone(&keys_manager)));
339339

340340
let mut config = UserConfig::default();
341-
config.channel_options.fee_proportional_millionths = 0;
341+
config.channel_options.forwarding_fee_proportional_millionths = 0;
342342
config.channel_options.announced_channel = true;
343343
let network = Network::Bitcoin;
344344
let params = ChainParameters {
@@ -357,7 +357,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
357357
let chain_monitor = Arc::new(TestChainMonitor::new(broadcast.clone(), logger.clone(), fee_est.clone(), Arc::new(TestPersister{}), Arc::clone(& $keys_manager)));
358358

359359
let mut config = UserConfig::default();
360-
config.channel_options.fee_proportional_millionths = 0;
360+
config.channel_options.forwarding_fee_proportional_millionths = 0;
361361
config.channel_options.announced_channel = true;
362362

363363
let mut monitors = HashMap::new();

fuzz/src/full_stack.rs

+3-9
Large diffs are not rendered by default.

lightning-background-processor/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ mod tests {
238238
let mut nodes = Vec::new();
239239
for i in 0..num_nodes {
240240
let tx_broadcaster = Arc::new(test_utils::TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new()), blocks: Arc::new(Mutex::new(Vec::new()))});
241-
let fee_estimator = Arc::new(test_utils::TestFeeEstimator { sat_per_kw: 253 });
241+
let fee_estimator = Arc::new(test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) });
242242
let chain_source = Arc::new(test_utils::TestChainSource::new(Network::Testnet));
243243
let logger = Arc::new(test_utils::TestLogger::with_id(format!("node {}", i)));
244244
let persister = Arc::new(FilesystemPersister::new(format!("{}_persister_{}", persist_dir, i)));

lightning/src/chain/channelmonitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,7 @@ mod tests {
28522852
let secp_ctx = Secp256k1::new();
28532853
let logger = Arc::new(TestLogger::new());
28542854
let broadcaster = Arc::new(TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new()), blocks: Arc::new(Mutex::new(Vec::new()))});
2855-
let fee_estimator = Arc::new(TestFeeEstimator { sat_per_kw: 253 });
2855+
let fee_estimator = Arc::new(TestFeeEstimator { sat_per_kw: Mutex::new(253) });
28562856

28572857
let dummy_key = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap());
28582858
let dummy_tx = Transaction { version: 0, lock_time: 0, input: Vec::new(), output: Vec::new() };

lightning/src/ln/channel.rs

+47-35
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,6 @@ struct CommitmentTxInfoCached {
456456
}
457457

458458
pub const OUR_MAX_HTLCS: u16 = 50; //TODO
459-
const SPENDING_INPUT_FOR_A_OUTPUT_WEIGHT: u64 = 79; // prevout: 36, nSequence: 4, script len: 1, witness lengths: (3+1)/4, sig: 73/4, if-selector: 1, redeemScript: (6 ops + 2*33 pubkeys + 1*2 delay)/4
460459

461460
#[cfg(not(test))]
462461
const COMMITMENT_TX_BASE_WEIGHT: u64 = 724;
@@ -3426,7 +3425,7 @@ impl<Signer: Sign> Channel<Signer> {
34263425
}
34273426

34283427
pub fn get_fee_proportional_millionths(&self) -> u32 {
3429-
self.config.fee_proportional_millionths
3428+
self.config.forwarding_fee_proportional_millionths
34303429
}
34313430

34323431
pub fn get_cltv_expiry_delta(&self) -> u16 {
@@ -3499,24 +3498,8 @@ impl<Signer: Sign> Channel<Signer> {
34993498

35003499
/// Gets the fee we'd want to charge for adding an HTLC output to this Channel
35013500
/// Allowed in any state (including after shutdown)
3502-
pub fn get_holder_fee_base_msat<F: Deref>(&self, fee_estimator: &F) -> u32
3503-
where F::Target: FeeEstimator
3504-
{
3505-
// For lack of a better metric, we calculate what it would cost to consolidate the new HTLC
3506-
// output value back into a transaction with the regular channel output:
3507-
3508-
// the fee cost of the HTLC-Success/HTLC-Timeout transaction:
3509-
let mut res = self.feerate_per_kw as u64 * cmp::max(HTLC_TIMEOUT_TX_WEIGHT, HTLC_SUCCESS_TX_WEIGHT) / 1000;
3510-
3511-
if self.is_outbound() {
3512-
// + the marginal fee increase cost to us in the commitment transaction:
3513-
res += self.feerate_per_kw as u64 * COMMITMENT_TX_WEIGHT_PER_HTLC / 1000;
3514-
}
3515-
3516-
// + the marginal cost of an input which spends the HTLC-Success/HTLC-Timeout output:
3517-
res += fee_estimator.get_est_sat_per_1000_weight(ConfirmationTarget::Normal) as u64 * SPENDING_INPUT_FOR_A_OUTPUT_WEIGHT / 1000;
3518-
3519-
res as u32
3501+
pub fn get_outbound_forwarding_fee_base_msat(&self) -> u32 {
3502+
self.config.forwarding_fee_base_msat
35203503
}
35213504

35223505
/// Returns true if we've ever received a message from the remote end for this Channel
@@ -4460,7 +4443,7 @@ fn is_unsupported_shutdown_script(their_features: &InitFeatures, script: &Script
44604443
return !script.is_p2pkh() && !script.is_p2sh() && !script.is_v0_p2wpkh() && !script.is_v0_p2wsh()
44614444
}
44624445

4463-
const SERIALIZATION_VERSION: u8 = 1;
4446+
const SERIALIZATION_VERSION: u8 = 2;
44644447
const MIN_SERIALIZATION_VERSION: u8 = 1;
44654448

44664449
impl_writeable_tlv_based_enum!(InboundHTLCRemovalReason,;
@@ -4502,7 +4485,13 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
45024485
write_ver_prefix!(writer, SERIALIZATION_VERSION, MIN_SERIALIZATION_VERSION);
45034486

45044487
self.user_id.write(writer)?;
4505-
self.config.write(writer)?;
4488+
4489+
// Write out the old serialization for the config object. This is read by version-1
4490+
// deserializers, but we will read the version in the TLV at the end instead.
4491+
self.config.forwarding_fee_proportional_millionths.write(writer)?;
4492+
self.config.cltv_expiry_delta.write(writer)?;
4493+
self.config.announced_channel.write(writer)?;
4494+
self.config.commit_upfront_shutdown_pubkey.write(writer)?;
45064495

45074496
self.channel_id.write(writer)?;
45084497
(self.channel_state | ChannelState::PeerDisconnected as u32).write(writer)?;
@@ -4661,10 +4650,15 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
46614650
self.counterparty_dust_limit_satoshis.write(writer)?;
46624651
self.holder_dust_limit_satoshis.write(writer)?;
46634652
self.counterparty_max_htlc_value_in_flight_msat.write(writer)?;
4653+
4654+
// Note that this field is ignored by 0.0.99+ as the TLV Optional variant is used instead.
46644655
self.counterparty_selected_channel_reserve_satoshis.unwrap_or(0).write(writer)?;
4656+
46654657
self.counterparty_htlc_minimum_msat.write(writer)?;
46664658
self.holder_htlc_minimum_msat.write(writer)?;
46674659
self.counterparty_max_accepted_htlcs.write(writer)?;
4660+
4661+
// Note that this field is ignored by 0.0.99+ as the TLV Optional variant is used instead.
46684662
self.minimum_depth.unwrap_or(0).write(writer)?;
46694663

46704664
match &self.counterparty_forwarding_info {
@@ -4700,6 +4694,7 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
47004694
// override that.
47014695
(1, self.minimum_depth, option),
47024696
(3, self.counterparty_selected_channel_reserve_satoshis, option),
4697+
(5, self.config, required),
47034698
});
47044699

47054700
Ok(())
@@ -4710,10 +4705,21 @@ const MAX_ALLOC_SIZE: usize = 64*1024;
47104705
impl<'a, Signer: Sign, K: Deref> ReadableArgs<&'a K> for Channel<Signer>
47114706
where K::Target: KeysInterface<Signer = Signer> {
47124707
fn read<R : ::std::io::Read>(reader: &mut R, keys_source: &'a K) -> Result<Self, DecodeError> {
4713-
let _ver = read_ver_prefix!(reader, SERIALIZATION_VERSION);
4708+
let ver = read_ver_prefix!(reader, SERIALIZATION_VERSION);
47144709

47154710
let user_id = Readable::read(reader)?;
4716-
let config: ChannelConfig = Readable::read(reader)?;
4711+
4712+
let mut config = Some(ChannelConfig::default());
4713+
if ver == 1 {
4714+
// Read the old serialization of the ChannelConfig from version 0.0.98.
4715+
config.as_mut().unwrap().forwarding_fee_proportional_millionths = Readable::read(reader)?;
4716+
config.as_mut().unwrap().cltv_expiry_delta = Readable::read(reader)?;
4717+
config.as_mut().unwrap().announced_channel = Readable::read(reader)?;
4718+
config.as_mut().unwrap().commit_upfront_shutdown_pubkey = Readable::read(reader)?;
4719+
} else {
4720+
// Read the 8 bytes of backwards-compatibility ChannelConfig data.
4721+
let mut _val: u64 = Readable::read(reader)?;
4722+
}
47174723

47184724
let channel_id = Readable::read(reader)?;
47194725
let channel_state = Readable::read(reader)?;
@@ -4843,20 +4849,25 @@ impl<'a, Signer: Sign, K: Deref> ReadableArgs<&'a K> for Channel<Signer>
48434849
let counterparty_dust_limit_satoshis = Readable::read(reader)?;
48444850
let holder_dust_limit_satoshis = Readable::read(reader)?;
48454851
let counterparty_max_htlc_value_in_flight_msat = Readable::read(reader)?;
4846-
let mut counterparty_selected_channel_reserve_satoshis = Some(Readable::read(reader)?);
4847-
if counterparty_selected_channel_reserve_satoshis == Some(0) {
4848-
// Versions up to 0.0.98 had counterparty_selected_channel_reserve_satoshis as a
4849-
// non-option, writing 0 for what we now consider None.
4850-
counterparty_selected_channel_reserve_satoshis = None;
4852+
let mut counterparty_selected_channel_reserve_satoshis = None;
4853+
if ver == 1 {
4854+
// Read the old serialization from version 0.0.98.
4855+
counterparty_selected_channel_reserve_satoshis = Some(Readable::read(reader)?);
4856+
} else {
4857+
// Read the 8 bytes of backwards-compatibility data.
4858+
let _dummy: u64 = Readable::read(reader)?;
48514859
}
48524860
let counterparty_htlc_minimum_msat = Readable::read(reader)?;
48534861
let holder_htlc_minimum_msat = Readable::read(reader)?;
48544862
let counterparty_max_accepted_htlcs = Readable::read(reader)?;
4855-
let mut minimum_depth = Some(Readable::read(reader)?);
4856-
if minimum_depth == Some(0) {
4857-
// Versions up to 0.0.98 had minimum_depth as a non-option, writing 0 for what we now
4858-
// consider None.
4859-
minimum_depth = None;
4863+
4864+
let mut minimum_depth = None;
4865+
if ver == 1 {
4866+
// Read the old serialization from version 0.0.98.
4867+
minimum_depth = Some(Readable::read(reader)?);
4868+
} else {
4869+
// Read the 4 bytes of backwards-compatibility data.
4870+
let _dummy: u32 = Readable::read(reader)?;
48604871
}
48614872

48624873
let counterparty_forwarding_info = match <u8 as Readable>::read(reader)? {
@@ -4887,6 +4898,7 @@ impl<'a, Signer: Sign, K: Deref> ReadableArgs<&'a K> for Channel<Signer>
48874898
(0, announcement_sigs, option),
48884899
(1, minimum_depth, option),
48894900
(3, counterparty_selected_channel_reserve_satoshis, option),
4901+
(5, config, option), // Note that if none is provided we will *not* overwrite the existing one.
48904902
});
48914903

48924904
let mut secp_ctx = Secp256k1::new();
@@ -4895,7 +4907,7 @@ impl<'a, Signer: Sign, K: Deref> ReadableArgs<&'a K> for Channel<Signer>
48954907
Ok(Channel {
48964908
user_id,
48974909

4898-
config,
4910+
config: config.unwrap(),
48994911
channel_id,
49004912
channel_state,
49014913
secp_ctx,

lightning/src/ln/channelmanager.rs

+23-9
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,10 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
11371137
///
11381138
/// Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
11391139
/// greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
1140+
///
1141+
/// Note that we do not check if you are currently connected to the given peer. If no
1142+
/// connection is available, the outbound `open_channel` message may fail to send, resulting in
1143+
/// the channel eventually being silently forgotten.
11401144
pub fn create_channel(&self, their_network_key: PublicKey, channel_value_satoshis: u64, push_msat: u64, user_id: u64, override_config: Option<UserConfig>) -> Result<(), APIError> {
11411145
if channel_value_satoshis < 1000 {
11421146
return Err(APIError::APIMisuseError { err: format!("Channel value must be at least 1000 satoshis. It was {}", channel_value_satoshis) });
@@ -1555,15 +1559,23 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
15551559
// short_channel_id is non-0 in any ::Forward.
15561560
if let &PendingHTLCRouting::Forward { ref short_channel_id, .. } = routing {
15571561
let id_option = channel_state.as_ref().unwrap().short_to_id.get(&short_channel_id).cloned();
1558-
let forwarding_id = match id_option {
1559-
None => { // unknown_next_peer
1560-
return_err!("Don't have available channel for forwarding as requested.", 0x4000 | 10, &[0;0]);
1561-
},
1562-
Some(id) => id.clone(),
1563-
};
15641562
if let Some((err, code, chan_update)) = loop {
1563+
let forwarding_id = match id_option {
1564+
None => { // unknown_next_peer
1565+
break Some(("Don't have available channel for forwarding as requested.", 0x4000 | 10, None));
1566+
},
1567+
Some(id) => id.clone(),
1568+
};
1569+
15651570
let chan = channel_state.as_mut().unwrap().by_id.get_mut(&forwarding_id).unwrap();
15661571

1572+
if !chan.should_announce() && !self.default_configuration.accept_forwards_to_priv_channels {
1573+
// Note that the behavior here should be identical to the above block - we
1574+
// should NOT reveal the existence or non-existence of a private channel if
1575+
// we don't allow forwards outbound over them.
1576+
break Some(("Don't have available channel for forwarding as requested.", 0x4000 | 10, None));
1577+
}
1578+
15671579
// Note that we could technically not return an error yet here and just hope
15681580
// that the connection is reestablished or monitor updated by the time we get
15691581
// around to doing the actual forward, but better to fail early if we can and
@@ -1575,7 +1587,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
15751587
if *amt_to_forward < chan.get_counterparty_htlc_minimum_msat() { // amount_below_minimum
15761588
break Some(("HTLC amount was below the htlc_minimum_msat", 0x1000 | 11, Some(self.get_channel_update_for_unicast(chan).unwrap())));
15771589
}
1578-
let fee = amt_to_forward.checked_mul(chan.get_fee_proportional_millionths() as u64).and_then(|prop_fee| { (prop_fee / 1000000).checked_add(chan.get_holder_fee_base_msat(&self.fee_estimator) as u64) });
1590+
let fee = amt_to_forward.checked_mul(chan.get_fee_proportional_millionths() as u64)
1591+
.and_then(|prop_fee| { (prop_fee / 1000000)
1592+
.checked_add(chan.get_outbound_forwarding_fee_base_msat() as u64) });
15791593
if fee.is_none() || msg.amount_msat < fee.unwrap() || (msg.amount_msat - fee.unwrap()) < *amt_to_forward { // fee_insufficient
15801594
break Some(("Prior hop has deviated from specified fees parameters or origin node has obsolete ones", 0x1000 | 12, Some(self.get_channel_update_for_unicast(chan).unwrap())));
15811595
}
@@ -1660,7 +1674,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
16601674
cltv_expiry_delta: chan.get_cltv_expiry_delta(),
16611675
htlc_minimum_msat: chan.get_counterparty_htlc_minimum_msat(),
16621676
htlc_maximum_msat: OptionalField::Present(chan.get_announced_htlc_max_msat()),
1663-
fee_base_msat: chan.get_holder_fee_base_msat(&self.fee_estimator),
1677+
fee_base_msat: chan.get_outbound_forwarding_fee_base_msat(),
16641678
fee_proportional_millionths: chan.get_fee_proportional_millionths(),
16651679
excess_data: Vec::new(),
16661680
};
@@ -5107,7 +5121,7 @@ pub mod bench {
51075121
let genesis_hash = bitcoin::blockdata::constants::genesis_block(network).header.block_hash();
51085122

51095123
let tx_broadcaster = test_utils::TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new()), blocks: Arc::new(Mutex::new(Vec::new()))};
5110-
let fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: 253 };
5124+
let fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) };
51115125

51125126
let mut config: UserConfig = Default::default();
51135127
config.own_channel_config.minimum_depth = 1;

lightning/src/ln/functional_test_utils.rs

+22-12
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
269269
// Check that if we serialize and then deserialize all our channel monitors we get the
270270
// same set of outputs to watch for on chain as we have now. Note that if we write
271271
// tests that fully close channels and remove the monitors at some point this may break.
272-
let feeest = test_utils::TestFeeEstimator { sat_per_kw: 253 };
272+
let feeest = test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) };
273273
let mut deserialized_monitors = Vec::new();
274274
{
275275
let old_monitors = self.chain_monitor.chain_monitor.monitors.read().unwrap();
@@ -295,7 +295,7 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
295295
<(BlockHash, ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>)>::read(&mut ::std::io::Cursor::new(w.0), ChannelManagerReadArgs {
296296
default_config: *self.node.get_current_default_configuration(),
297297
keys_manager: self.keys_manager,
298-
fee_estimator: &test_utils::TestFeeEstimator { sat_per_kw: 253 },
298+
fee_estimator: &test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) },
299299
chain_monitor: self.chain_monitor,
300300
tx_broadcaster: &test_utils::TestBroadcaster {
301301
txn_broadcasted: Mutex::new(self.tx_broadcaster.txn_broadcasted.lock().unwrap().clone()),
@@ -1206,7 +1206,10 @@ pub const TEST_FINAL_CLTV: u32 = 70;
12061206
pub fn route_payment<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_route: &[&Node<'a, 'b, 'c>], recv_value: u64) -> (PaymentPreimage, PaymentHash, PaymentSecret) {
12071207
let net_graph_msg_handler = &origin_node.net_graph_msg_handler;
12081208
let logger = test_utils::TestLogger::new();
1209-
let route = get_route(&origin_node.node.get_our_node_id(), &net_graph_msg_handler.network_graph.read().unwrap(), &expected_route.last().unwrap().node.get_our_node_id(), Some(InvoiceFeatures::known()), None, &Vec::new(), recv_value, TEST_FINAL_CLTV, &logger).unwrap();
1209+
let route = get_route(&origin_node.node.get_our_node_id(), &net_graph_msg_handler.network_graph.read().unwrap(),
1210+
&expected_route.last().unwrap().node.get_our_node_id(), Some(InvoiceFeatures::known()),
1211+
Some(&origin_node.node.list_usable_channels().iter().collect::<Vec<_>>()), &[],
1212+
recv_value, TEST_FINAL_CLTV, &logger).unwrap();
12101213
assert_eq!(route.paths.len(), 1);
12111214
assert_eq!(route.paths[0].len(), expected_route.len());
12121215
for (node, hop) in expected_route.iter().zip(route.paths[0].iter()) {
@@ -1316,7 +1319,7 @@ pub fn create_chanmon_cfgs(node_count: usize) -> Vec<TestChanMonCfg> {
13161319
txn_broadcasted: Mutex::new(Vec::new()),
13171320
blocks: Arc::new(Mutex::new(vec![(genesis_block(Network::Testnet).header, 0)])),
13181321
};
1319-
let fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: 253 };
1322+
let fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) };
13201323
let chain_source = test_utils::TestChainSource::new(Network::Testnet);
13211324
let logger = test_utils::TestLogger::with_id(format!("node {}", i));
13221325
let persister = test_utils::TestPersister::new();
@@ -1341,22 +1344,29 @@ pub fn create_node_cfgs<'a>(node_count: usize, chanmon_cfgs: &'a Vec<TestChanMon
13411344
nodes
13421345
}
13431346

1347+
pub fn test_default_channel_config() -> UserConfig {
1348+
let mut default_config = UserConfig::default();
1349+
// Set cltv_expiry_delta slightly lower to keep the final CLTV values inside one byte in our
1350+
// tests so that our script-length checks don't fail (see ACCEPTED_HTLC_SCRIPT_WEIGHT).
1351+
default_config.channel_options.cltv_expiry_delta = 6*6;
1352+
default_config.channel_options.announced_channel = true;
1353+
default_config.peer_channel_config_limits.force_announced_channel_preference = false;
1354+
// When most of our tests were written, the default HTLC minimum was fixed at 1000.
1355+
// It now defaults to 1, so we simply set it to the expected value here.
1356+
default_config.own_channel_config.our_htlc_minimum_msat = 1000;
1357+
default_config
1358+
}
1359+
13441360
pub fn create_node_chanmgrs<'a, 'b>(node_count: usize, cfgs: &'a Vec<NodeCfg<'b>>, node_config: &[Option<UserConfig>]) -> Vec<ChannelManager<EnforcingSigner, &'a TestChainMonitor<'b>, &'b test_utils::TestBroadcaster, &'a test_utils::TestKeysInterface, &'b test_utils::TestFeeEstimator, &'b test_utils::TestLogger>> {
13451361
let mut chanmgrs = Vec::new();
13461362
for i in 0..node_count {
1347-
let mut default_config = UserConfig::default();
1348-
// Set cltv_expiry_delta slightly lower to keep the final CLTV values inside one byte in our
1349-
// tests so that our script-length checks don't fail (see ACCEPTED_HTLC_SCRIPT_WEIGHT).
1350-
default_config.channel_options.cltv_expiry_delta = 6*6;
1351-
default_config.channel_options.announced_channel = true;
1352-
default_config.peer_channel_config_limits.force_announced_channel_preference = false;
1353-
default_config.own_channel_config.our_htlc_minimum_msat = 1000; // sanitization being done by the sender, to exerce receiver logic we need to lift of limit
13541363
let network = Network::Testnet;
13551364
let params = ChainParameters {
13561365
network,
13571366
best_block: BestBlock::from_genesis(network),
13581367
};
1359-
let node = ChannelManager::new(cfgs[i].fee_estimator, &cfgs[i].chain_monitor, cfgs[i].tx_broadcaster, cfgs[i].logger, cfgs[i].keys_manager, if node_config[i].is_some() { node_config[i].clone().unwrap() } else { default_config }, params);
1368+
let node = ChannelManager::new(cfgs[i].fee_estimator, &cfgs[i].chain_monitor, cfgs[i].tx_broadcaster, cfgs[i].logger, cfgs[i].keys_manager,
1369+
if node_config[i].is_some() { node_config[i].clone().unwrap() } else { test_default_channel_config() }, params);
13601370
chanmgrs.push(node);
13611371
}
13621372

0 commit comments

Comments
 (0)