Reject invalid parameters instead of silently dropping them#182
Open
benthecarman wants to merge 2 commits intolightningdevkit:mainfrom
Open
Reject invalid parameters instead of silently dropping them#182benthecarman wants to merge 2 commits intolightningdevkit:mainfrom
benthecarman wants to merge 2 commits intolightningdevkit:mainfrom
Conversation
Previously, an invalid fee_rate_sat_per_vb (overflows) was silently collapsed into None via .and_then(), causing the node to substitute its default fee estimation without informing the user. Now the server returns an InvalidRequestError and the CLI rejects invalid fee rates before sending the request. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Previously, setting quantity without amount_msat silently produced a variable-amount offer with no quantity constraint. Now both the server and CLI reject this misconfiguration with a clear error message. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
👋 Thanks for assigning @tnull as a reviewer! |
tnull
reviewed
Apr 8, 2026
| }, | ||
| Commands::OnchainSend { address, amount, send_all, fee_rate_sat_per_vb } => { | ||
| if let Some(rate) = fee_rate_sat_per_vb { | ||
| // Mirrors FeeRate::from_sat_per_vb: sat/vb * 1000/4 = sat/kwu |
Collaborator
There was a problem hiding this comment.
If we get into that territory, let's just take a dependency on bitcoin and use bitcoin::FeeRate?
| Commands::Bolt12Receive { description, amount, expiry_secs, quantity } => { | ||
| if quantity.is_some() && amount.is_none() { | ||
| handle_error_msg( | ||
| "quantity can only be set for fixed-amount offers (amount must be provided)", |
Collaborator
There was a problem hiding this comment.
Debatable, @TheBlueMatt previously wanted to drop quantity from the LDK Node API (lightningdevkit/ldk-node#642, but was closed as abandoned). Matt, do you still think we should?
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.
Previously,
onchain_sendsilently fell back to the node's default fee estimation when given an invalidfee_rate_sat_per_vb(e.g., overflows), andbolt12_receivesilently dropped thequantityparameter whenamount_msatwas not set. Both cases now return an error instead.Matching CLI-side validation added for both cases.