Check for spendable_msat on trampoline pay#585
Merged
Conversation
cdecker
reviewed
Mar 6, 2025
| ) -> Result<Vec<(cln_rpc::primitives::ShortChannelId, u64)>> { | ||
| let mut acc = 0; | ||
| let mut choosen = vec![]; | ||
| while let Some(channel) = channels.pop() { |
Collaborator
There was a problem hiding this comment.
Simpler, but let's keep this as a cleanup, merge this one so we address the issue asap:
for c in channels.iter().filter(|c| c.spendable_msat.unwrap_or_default() > MIN_HTLC_AMOUNT) {
...
}And we can also add a second .filter() that filters out the ones that have spendable_msat below min_htlc_out_msat, no need to mix those conditions either.
We need to filter out channels that are drained and can not end out an htlc with an actual amount greater than 0. Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
16d46a7 to
9477d42
Compare
JssDWt
reviewed
Mar 6, 2025
Comment on lines
+367
to
+369
| let rest = amount_msat - acc; | ||
| choosen.push((channel.short_channel_id, rest)); | ||
| acc += rest; |
Collaborator
There was a problem hiding this comment.
There's still a case where rest does not add up to the minimum htlc amount. Do you know a good way to handle that?
Member
Author
There was a problem hiding this comment.
Right, we may want to check and skip those channels as well. 🤔
I'll add a follow up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We had some incidents where a trampoline payment created
0msatwhich lead to failed payments that actually did not fail. In order to avoid this we filter out channels that have aspendable_msatvalue of0or below theminimum_htlc_out_msat.