Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend/lightning: check available balance before sending LN payment #2581

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

Beerosagos
Copy link
Collaborator

This adds a backend check on the available balance, to avoid sending a LN payment wihtout sufficient funds.

@Beerosagos Beerosagos requested a review from benma February 27, 2024 13:22
Copy link
Contributor

@benma benma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

if jsonBody.AmountMsat != nil {
amount = jsonBody.AmountMsat
}
if *amount > nodeState.ChannelsBalanceMsat {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can amount be nil? maybe best to check to avoid a panic

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be possible, but added just in case

This adds a backend check on the available balance, to avoid sending a
LN payment wihtout sufficient funds.
@Beerosagos Beerosagos merged commit b86a09b into BitBoxSwiss:staging-ln Feb 27, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants