Skip to content

Commit

Permalink
Merge pull request #25 from whfuyn/fix-rgb-amount-after-payment-forwa…
Browse files Browse the repository at this point in the history
…rded

fix: rgb amount in channel not updated after payment forwarded
  • Loading branch information
nicbus authored Mar 28, 2024
2 parents 612f33a + fcb1fc5 commit b809437
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/ldk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b809437

Please sign in to comment.