-
Notifications
You must be signed in to change notification settings - Fork 1
Return error for duplicate concrete params #9
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
Conversation
nothingmuch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
i think it makes sense to also match either amount or req-amount, and same for label and message, arguably as a separate PR, it's weird to me that something like req-amount would be delegated to the Extras type and it makes sense to me that req-amount and amount both present in the same URI would be considered a DuplicateParameter("amount").
| InvalidScheme, | ||
| Address(AddressError), | ||
| Amount(ParseAmountError), | ||
| DuplicateParameter(String), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this could safely be &static str because the expected parameter keys are hard coded, undecided if I prefer this for simplicity & consistency with UnknownRequiredParameter which I think kinda needs to have a String since it makes sense for the error to outlive the erroneous input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had this exact thought and went with String for consistency with UnknownRequiredParameter
|
@nothingmuch agreed, though when we start handling required params, we'll need some way of conveying if it's required or optional |
spacebear21
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 22d109f.
Is there a rationale for not checking duplicates on any extra parameter?
the only reason is that it's being done already by the implementors of the If we eventually handle it here, we can remove the duplicate handling there |
|
BIP21 doesn't specify behavior for duplicate parameters... However, BIP321 says:
So unknown keys should be left to be handled by implementations. Not sure why "amount` is not included in that paragraph, but the invalid URLs example section states that "Amounts must not appear twice". |
|
@shinghim It failed some lint checks that I had to run manually, can you fix those please? |
|
Done. They weren't related to the duplicate checks so i put it in a new commit |
|
There is also a failing test but it appears unrelated as well so I'll merge this as is. |
No description provided.