Skip to content

Commit 4d0bb1b

Browse files
committed
Use new Channel::update_config method to update base fee in test
1 parent bb0901a commit 4d0bb1b

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lightning/src/ln/channel.rs

-3
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,6 @@ pub(crate) const MIN_AFFORDABLE_HTLC_COUNT: usize = 4;
490490
// Holder designates channel data owned for the benefice of the user client.
491491
// Counterparty designates channel data owned by the another channel participant entity.
492492
pub(super) struct Channel<Signer: Sign> {
493-
#[cfg(any(test, feature = "_test_utils"))]
494-
pub(crate) config: LegacyChannelConfig,
495-
#[cfg(not(any(test, feature = "_test_utils")))]
496493
config: LegacyChannelConfig,
497494

498495
// Track the previous `ChannelConfig` so that we can continue forwarding HTLCs that were

lightning/src/ln/payment_tests.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -531,9 +531,14 @@ fn do_retry_with_no_persist(confirm_before_reload: bool) {
531531
// Update the fee on the middle hop to ensure PaymentSent events have the correct (retried) fee
532532
// and not the original fee. We also update node[1]'s relevant config as
533533
// do_claim_payment_along_route expects us to never overpay.
534-
nodes[1].node.channel_state.lock().unwrap().by_id.get_mut(&chan_id_2).unwrap()
535-
.config.options.forwarding_fee_base_msat += 100_000;
536-
new_route.paths[0][0].fee_msat += 100_000;
534+
{
535+
let mut channel_state = nodes[1].node.channel_state.lock().unwrap();
536+
let mut channel = channel_state.by_id.get_mut(&chan_id_2).unwrap();
537+
let mut new_config = channel.get_config();
538+
new_config.forwarding_fee_base_msat += 100_000;
539+
channel.update_config(&new_config, false);
540+
new_route.paths[0][0].fee_msat += 100_000;
541+
}
537542

538543
assert!(nodes[0].node.retry_payment(&new_route, payment_id_1).is_err()); // Shouldn't be allowed to retry a fulfilled payment
539544
nodes[0].node.retry_payment(&new_route, payment_id).unwrap();

0 commit comments

Comments
 (0)