@@ -173,12 +173,14 @@ pub struct HTLCUpdate {
173
173
pub ( crate ) payment_preimage : Option < PaymentPreimage > ,
174
174
pub ( crate ) source : HTLCSource ,
175
175
pub ( crate ) htlc_value_satoshis : Option < u64 > ,
176
+ pub ( crate ) htlc_value_rgb : Option < u64 > ,
176
177
}
177
178
impl_writeable_tlv_based ! ( HTLCUpdate , {
178
179
( 0 , payment_hash, required) ,
179
180
( 1 , htlc_value_satoshis, option) ,
180
181
( 2 , source, required) ,
181
182
( 4 , payment_preimage, option) ,
183
+ ( 6 , htlc_value_rgb, option) ,
182
184
} ) ;
183
185
184
186
/// If an HTLC expires within this many blocks, don't try to claim it in a shared transaction,
@@ -384,6 +386,7 @@ enum OnchainEvent {
384
386
source : HTLCSource ,
385
387
payment_hash : PaymentHash ,
386
388
htlc_value_satoshis : Option < u64 > ,
389
+ htlc_value_rgb : Option < u64 > ,
387
390
/// None in the second case, above, ie when there is no relevant output in the commitment
388
391
/// transaction which appeared on chain.
389
392
commitment_tx_output_idx : Option < u32 > ,
@@ -465,6 +468,7 @@ impl_writeable_tlv_based_enum_upgradable!(OnchainEvent,
465
468
( 1 , htlc_value_satoshis, option) ,
466
469
( 2 , payment_hash, required) ,
467
470
( 3 , commitment_tx_output_idx, option) ,
471
+ ( 4 , htlc_value_rgb, option) ,
468
472
} ,
469
473
( 1 , MaturingOutput ) => {
470
474
( 0 , descriptor, required) ,
@@ -2266,6 +2270,7 @@ macro_rules! fail_unbroadcast_htlcs {
2266
2270
source: ( * * source) . clone( ) ,
2267
2271
payment_hash: htlc. payment_hash. clone( ) ,
2268
2272
htlc_value_satoshis: Some ( htlc. amount_msat / 1000 ) ,
2273
+ htlc_value_rgb: htlc. amount_rgb,
2269
2274
commitment_tx_output_idx: None ,
2270
2275
} ,
2271
2276
} ;
@@ -3614,7 +3619,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3614
3619
// Produce actionable events from on-chain events having reached their threshold.
3615
3620
for entry in onchain_events_reaching_threshold_conf. drain ( ..) {
3616
3621
match entry. event {
3617
- OnchainEvent :: HTLCUpdate { ref source, payment_hash, htlc_value_satoshis, commitment_tx_output_idx } => {
3622
+ OnchainEvent :: HTLCUpdate { ref source, payment_hash, htlc_value_satoshis, htlc_value_rgb , commitment_tx_output_idx } => {
3618
3623
// Check for duplicate HTLC resolutions.
3619
3624
#[ cfg( debug_assertions) ]
3620
3625
{
@@ -3638,6 +3643,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3638
3643
payment_preimage : None ,
3639
3644
source : source. clone ( ) ,
3640
3645
htlc_value_satoshis,
3646
+ htlc_value_rgb,
3641
3647
} ) ) ;
3642
3648
self . htlcs_resolved_on_chain . push ( IrrevocablyResolvedHTLC {
3643
3649
commitment_tx_output_idx,
@@ -3927,7 +3933,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3927
3933
if pending_htlc. payment_hash == $htlc_output. payment_hash && pending_htlc. amount_msat == $htlc_output. amount_msat {
3928
3934
if let & Some ( ref source) = pending_source {
3929
3935
log_claim!( "revoked counterparty commitment tx" , false , pending_htlc, true ) ;
3930
- payment_data = Some ( ( ( * * source) . clone( ) , $htlc_output. payment_hash, $htlc_output. amount_msat) ) ;
3936
+ payment_data = Some ( ( ( * * source) . clone( ) , $htlc_output. payment_hash, $htlc_output. amount_msat, $htlc_output . amount_rgb ) ) ;
3931
3937
break ;
3932
3938
}
3933
3939
}
@@ -3947,7 +3953,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3947
3953
// transaction. This implies we either learned a preimage, the HTLC
3948
3954
// has timed out, or we screwed up. In any case, we should now
3949
3955
// resolve the source HTLC with the original sender.
3950
- payment_data = Some ( ( ( * source) . clone( ) , htlc_output. payment_hash, htlc_output. amount_msat) ) ;
3956
+ payment_data = Some ( ( ( * source) . clone( ) , htlc_output. payment_hash, htlc_output. amount_msat, htlc_output . amount_rgb ) ) ;
3951
3957
} else if !$holder_tx {
3952
3958
check_htlc_valid_counterparty!( self . current_counterparty_commitment_txid, htlc_output) ;
3953
3959
if payment_data. is_none( ) {
@@ -3995,7 +4001,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3995
4001
3996
4002
// Check that scan_commitment, above, decided there is some source worth relaying an
3997
4003
// HTLC resolution backwards to and figure out whether we learned a preimage from it.
3998
- if let Some ( ( source, payment_hash, amount_msat) ) = payment_data {
4004
+ if let Some ( ( source, payment_hash, amount_msat, amount_rgb ) ) = payment_data {
3999
4005
if accepted_preimage_claim {
4000
4006
if !self . pending_monitor_events . iter ( ) . any (
4001
4007
|update| if let & MonitorEvent :: HTLCEvent ( ref upd) = update { upd. source == source } else { false } ) {
@@ -4015,6 +4021,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4015
4021
payment_preimage : Some ( payment_preimage) ,
4016
4022
payment_hash,
4017
4023
htlc_value_satoshis : Some ( amount_msat / 1000 ) ,
4024
+ htlc_value_rgb : amount_rgb,
4018
4025
} ) ) ;
4019
4026
}
4020
4027
} else if offered_preimage_claim {
@@ -4038,6 +4045,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4038
4045
payment_preimage : Some ( payment_preimage) ,
4039
4046
payment_hash,
4040
4047
htlc_value_satoshis : Some ( amount_msat / 1000 ) ,
4048
+ htlc_value_rgb : amount_rgb,
4041
4049
} ) ) ;
4042
4050
}
4043
4051
} else {
@@ -4058,6 +4066,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
4058
4066
event : OnchainEvent :: HTLCUpdate {
4059
4067
source, payment_hash,
4060
4068
htlc_value_satoshis : Some ( amount_msat / 1000 ) ,
4069
+ htlc_value_rgb : amount_rgb,
4061
4070
commitment_tx_output_idx : Some ( input. previous_output . vout ) ,
4062
4071
} ,
4063
4072
} ;
0 commit comments