Skip to content

Commit 9a57294

Browse files
JssDWtnepet
authored andcommitted
tramp: never create zero value htlcs
If a spendable channel balance exactly equals the amount, trampoline payment would create a zero value htlc. Never do that!
1 parent 1fa8735 commit 9a57294

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libs/gl-plugin/src/tramp.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ pub async fn trampolinepay(
184184
let mut acc = 0;
185185
let mut choosen = vec![];
186186
while let Some(channel) = channels.pop() {
187+
if acc == amount_msat {
188+
break;
189+
}
190+
187191
if (channel.spendable_msat + acc) <= amount_msat {
188192
choosen.push((channel.short_channel_id, channel.spendable_msat));
189193
acc += channel.spendable_msat;

0 commit comments

Comments
 (0)