Skip to content

Commit

Permalink
tramp: never create zero value htlcs
Browse files Browse the repository at this point in the history
If a spendable channel balance exactly equals the amount, trampoline
payment would create a zero value htlc. Never do that!
  • Loading branch information
JssDWt committed Dec 3, 2024
1 parent bd8779a commit 2aa3665
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libs/gl-plugin/src/tramp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ pub async fn trampolinepay(
let mut acc = 0;
let mut choosen = vec![];
while let Some(channel) = channels.pop() {
if acc == amount_msat {
break;
}

if (channel.spendable_msat + acc) <= amount_msat {
choosen.push((channel.short_channel_id, channel.spendable_msat));
acc += channel.spendable_msat;
Expand Down

0 comments on commit 2aa3665

Please sign in to comment.