Skip to content

Commit 78c3080

Browse files
committed
Rename HTLC onchain_value_satoshis to htlc_value_satoshis
In `HTLCUpdate` and `OnchainEvent` tracking, we store the HTLC value (rounded down to whole satoshis). This is somewhat confusingly referred to as the `onchain_value_satoshis` even though it refers to the commitment transaction output value, not the value available on chain (which may have been reduced by an HTLC-Timeout/HTLC-Success transaction).
1 parent a847809 commit 78c3080

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ pub struct HTLCUpdate {
166166
pub(crate) payment_hash: PaymentHash,
167167
pub(crate) payment_preimage: Option<PaymentPreimage>,
168168
pub(crate) source: HTLCSource,
169-
pub(crate) onchain_value_satoshis: Option<u64>,
169+
pub(crate) htlc_value_satoshis: Option<u64>,
170170
}
171171
impl_writeable_tlv_based!(HTLCUpdate, {
172172
(0, payment_hash, required),
173-
(1, onchain_value_satoshis, option),
173+
(1, htlc_value_satoshis, option),
174174
(2, source, required),
175175
(4, payment_preimage, option),
176176
});
@@ -357,7 +357,7 @@ enum OnchainEvent {
357357
HTLCUpdate {
358358
source: HTLCSource,
359359
payment_hash: PaymentHash,
360-
onchain_value_satoshis: Option<u64>,
360+
htlc_value_satoshis: Option<u64>,
361361
/// None in the second case, above, ie when there is no relevant output in the commitment
362362
/// transaction which appeared on chain.
363363
commitment_tx_output_idx: Option<u32>,
@@ -423,7 +423,7 @@ impl MaybeReadable for OnchainEventEntry {
423423
impl_writeable_tlv_based_enum_upgradable!(OnchainEvent,
424424
(0, HTLCUpdate) => {
425425
(0, source, required),
426-
(1, onchain_value_satoshis, option),
426+
(1, htlc_value_satoshis, option),
427427
(2, payment_hash, required),
428428
(3, commitment_tx_output_idx, option),
429429
},
@@ -1689,7 +1689,7 @@ macro_rules! fail_unbroadcast_htlcs {
16891689
event: OnchainEvent::HTLCUpdate {
16901690
source: (**source).clone(),
16911691
payment_hash: htlc.payment_hash.clone(),
1692-
onchain_value_satoshis: Some(htlc.amount_msat / 1000),
1692+
htlc_value_satoshis: Some(htlc.amount_msat / 1000),
16931693
commitment_tx_output_idx: None,
16941694
},
16951695
};
@@ -2523,7 +2523,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
25232523
// Produce actionable events from on-chain events having reached their threshold.
25242524
for entry in onchain_events_reaching_threshold_conf.drain(..) {
25252525
match entry.event {
2526-
OnchainEvent::HTLCUpdate { ref source, payment_hash, onchain_value_satoshis, commitment_tx_output_idx } => {
2526+
OnchainEvent::HTLCUpdate { ref source, payment_hash, htlc_value_satoshis, commitment_tx_output_idx } => {
25272527
// Check for duplicate HTLC resolutions.
25282528
#[cfg(debug_assertions)]
25292529
{
@@ -2545,7 +2545,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
25452545
payment_hash,
25462546
payment_preimage: None,
25472547
source: source.clone(),
2548-
onchain_value_satoshis,
2548+
htlc_value_satoshis,
25492549
}));
25502550
if let Some(idx) = commitment_tx_output_idx {
25512551
self.htlcs_resolved_on_chain.push(IrrevocablyResolvedHTLC { commitment_tx_output_idx: idx, payment_preimage: None });
@@ -2887,7 +2887,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
28872887
source,
28882888
payment_preimage: Some(payment_preimage),
28892889
payment_hash,
2890-
onchain_value_satoshis: Some(amount_msat / 1000),
2890+
htlc_value_satoshis: Some(amount_msat / 1000),
28912891
}));
28922892
}
28932893
} else if offered_preimage_claim {
@@ -2908,7 +2908,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
29082908
source,
29092909
payment_preimage: Some(payment_preimage),
29102910
payment_hash,
2911-
onchain_value_satoshis: Some(amount_msat / 1000),
2911+
htlc_value_satoshis: Some(amount_msat / 1000),
29122912
}));
29132913
}
29142914
} else {
@@ -2926,7 +2926,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
29262926
height,
29272927
event: OnchainEvent::HTLCUpdate {
29282928
source, payment_hash,
2929-
onchain_value_satoshis: Some(amount_msat / 1000),
2929+
htlc_value_satoshis: Some(amount_msat / 1000),
29302930
commitment_tx_output_idx: Some(input.previous_output.vout),
29312931
},
29322932
};

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4841,7 +4841,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
48414841
MonitorEvent::HTLCEvent(htlc_update) => {
48424842
if let Some(preimage) = htlc_update.payment_preimage {
48434843
log_trace!(self.logger, "Claiming HTLC with preimage {} from our monitor", log_bytes!(preimage.0));
4844-
self.claim_funds_internal(self.channel_state.lock().unwrap(), htlc_update.source, preimage, htlc_update.onchain_value_satoshis.map(|v| v * 1000), true, funding_outpoint.to_channel_id());
4844+
self.claim_funds_internal(self.channel_state.lock().unwrap(), htlc_update.source, preimage, htlc_update.htlc_value_satoshis.map(|v| v * 1000), true, funding_outpoint.to_channel_id());
48454845
} else {
48464846
log_trace!(self.logger, "Failing HTLC with hash {} from our monitor", log_bytes!(htlc_update.payment_hash.0));
48474847
self.fail_htlc_backwards_internal(self.channel_state.lock().unwrap(), htlc_update.source, &htlc_update.payment_hash, HTLCFailReason::Reason { failure_code: 0x4000 | 8, data: Vec::new() });

0 commit comments

Comments
 (0)