From fcb1fc5f35cc0f38505ca2484fcf1eb221e59b08 Mon Sep 17 00:00:00 2001 From: Fuyin Date: Thu, 28 Mar 2024 20:27:07 +0800 Subject: [PATCH] fix: rgb amount in channel not updated after payment forwarded --- rust-lightning | 2 +- src/ldk.rs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/rust-lightning b/rust-lightning index 80497c4..153f521 160000 --- a/rust-lightning +++ b/rust-lightning @@ -1 +1 @@ -Subproject commit 80497c4086beea490b56e5b8413b7f6d86f2c042 +Subproject commit 153f5215287ad78bb11fd1697273f50220c8fea9 diff --git a/src/ldk.rs b/src/ldk.rs index 1f24d70..b3d707a 100644 --- a/src/ldk.rs +++ b/src/ldk.rs @@ -554,7 +554,29 @@ async fn handle_ldk_events( fee_earned_msat, claim_from_onchain_tx, outbound_amount_forwarded_msat, + outbound_amount_forwarded_rgb, } => { + if let Some(amount_rgb) = outbound_amount_forwarded_rgb { + let ldk_data_dir_path = Path::new(&static_state.ldk_data_dir); + let prev_channel_id_str = prev_channel_id.expect("prev_channel_id").to_string(); + let next_channel_id_str = next_channel_id.expect("next_channel_id").to_string(); + + update_rgb_channel_amount( + &prev_channel_id_str, + 0, + amount_rgb, + ldk_data_dir_path, + false, + ); + update_rgb_channel_amount( + &next_channel_id_str, + amount_rgb, + 0, + ldk_data_dir_path, + false, + ); + } + let read_only_network_graph = unlocked_state.network_graph.read_only(); let nodes = read_only_network_graph.nodes(); let channels = unlocked_state.channel_manager.list_channels();