@@ -260,15 +260,16 @@ pub struct HTLCUpdate {
260260 pub ( crate ) payment_hash : PaymentHash ,
261261 pub ( crate ) payment_preimage : Option < PaymentPreimage > ,
262262 pub ( crate ) source : HTLCSource ,
263- pub ( crate ) htlc_value_satoshis : Option < u64 > ,
263+ pub ( crate ) htlc_value_msat : Option < u64 > ,
264264 pub ( crate ) user_channel_id : Option < u128 > ,
265265}
266266impl_writeable_tlv_based ! ( HTLCUpdate , {
267267 ( 0 , payment_hash, required) ,
268- ( 1 , htlc_value_satoshis, option ) ,
268+ ( 1 , htlc_value_satoshis, ( legacy , u64 , |_| Ok ( ( ) ) , |us : & HTLCUpdate | us . htlc_value_msat . map ( |v| v / 1000 ) ) ) ,
269269 ( 2 , source, required) ,
270270 ( 4 , payment_preimage, option) ,
271271 ( 5 , user_channel_id, option) ,
272+ ( 7 , htlc_value_msat, ( default_value, htlc_value_satoshis. map( |v: u64 | v * 1000 ) ) ) ,
272273} ) ;
273274
274275/// If an output goes from claimable only by us to claimable by us or our counterparty within this
@@ -3854,7 +3855,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
38543855 payment_hash : htlc. payment_hash ,
38553856 payment_preimage : Some ( * claimed_preimage) ,
38563857 source : * source. clone ( ) ,
3857- htlc_value_satoshis : Some ( htlc. amount_msat ) ,
3858+ htlc_value_msat : Some ( htlc. amount_msat ) ,
38583859 user_channel_id : self . user_channel_id ,
38593860 } ) ) ;
38603861 }
@@ -4573,7 +4574,6 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
45734574 if self . counterparty_fulfilled_htlcs . get ( & SentHTLCId :: from_source ( source) ) . is_some ( ) {
45744575 continue ;
45754576 }
4576- let htlc_value_satoshis = Some ( amount_msat / 1000 ) ;
45774577 let logger = WithContext :: from ( logger, None , None , Some ( payment_hash) ) ;
45784578 // Defensively mark the HTLC as failed back so the expiry-based failure
45794579 // path in `block_connected` doesn't generate a duplicate `HTLCUpdate`
@@ -4592,7 +4592,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
45924592 payment_hash,
45934593 payment_preimage : None ,
45944594 source : source. clone ( ) ,
4595- htlc_value_satoshis ,
4595+ htlc_value_msat : Some ( amount_msat ) ,
45964596 user_channel_id : self . user_channel_id ,
45974597 } ) ,
45984598 & mut self . next_monitor_event_id ,
@@ -4614,7 +4614,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
46144614 event : OnchainEvent :: HTLCUpdate {
46154615 source : source. clone ( ) ,
46164616 payment_hash,
4617- htlc_value_satoshis,
4617+ htlc_value_satoshis : Some ( amount_msat / 1000 ) ,
46184618 commitment_tx_output_idx : None ,
46194619 } ,
46204620 } ;
@@ -5930,7 +5930,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
59305930 payment_hash,
59315931 payment_preimage : None ,
59325932 source,
5933- htlc_value_satoshis,
5933+ htlc_value_msat : htlc_value_satoshis. map ( |v| v * 1000 ) ,
59345934 user_channel_id : self . user_channel_id ,
59355935 } ) ) ;
59365936 self . htlcs_resolved_on_chain . push ( IrrevocablyResolvedHTLC {
@@ -6041,7 +6041,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
60416041 source : source. clone ( ) ,
60426042 payment_preimage : None ,
60436043 payment_hash : htlc. payment_hash ,
6044- htlc_value_satoshis : Some ( htlc. amount_msat / 1000 ) ,
6044+ htlc_value_msat : Some ( htlc. amount_msat ) ,
60456045 user_channel_id : self . user_channel_id ,
60466046 } ) , & mut self . next_monitor_event_id ) ;
60476047 }
@@ -6459,7 +6459,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
64596459 source,
64606460 payment_preimage : Some ( payment_preimage) ,
64616461 payment_hash,
6462- htlc_value_satoshis : Some ( amount_msat / 1000 ) ,
6462+ htlc_value_msat : Some ( amount_msat) ,
64636463 user_channel_id : self . user_channel_id ,
64646464 } ) , & mut self . next_monitor_event_id ) ;
64656465 }
@@ -6484,7 +6484,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
64846484 source,
64856485 payment_preimage : Some ( payment_preimage) ,
64866486 payment_hash,
6487- htlc_value_satoshis : Some ( amount_msat / 1000 ) ,
6487+ htlc_value_msat : Some ( amount_msat) ,
64886488 user_channel_id : self . user_channel_id ,
64896489 } ) , & mut self . next_monitor_event_id ) ;
64906490 }
0 commit comments