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

runes: pname restrictions fail if the parameter has an underscore #5542

Closed
jb55 opened this issue Aug 21, 2022 · 8 comments · Fixed by #7124
Closed

runes: pname restrictions fail if the parameter has an underscore #5542

jb55 opened this issue Aug 21, 2022 · 8 comments · Fixed by #7124
Assignees
Milestone

Comments

@jb55
Copy link
Collaborator

jb55 commented Aug 21, 2022

   > lightning-cli commando-rune restrictions='["method=invoice","pnameamount_msat=any"]'
{
   "code": -32602,
   "message": "restrictions: not a valid restriction: invalid token '\"pnameamount_msat=any\"'"
}
@niftynei niftynei added the good first issue good for onboarding label Sep 22, 2022
@bshramin
Copy link
Contributor

Is this still a valid issue?

@niftynei
Copy link
Collaborator

Yes, this is still a valid issue.

niftynei added a commit to niftynei/lightning that referenced this issue May 28, 2023
@aliraza556
Copy link

aliraza556 commented Jan 18, 2024

HI @jb55,

1- Check Parameter Name: Ensure that pnameamount_msat is a valid parameter name for the invoice method in lightning-cli. If it's not a recognized parameter, the command will fail.

2- Syntax Check: Ensure that the syntax of the restrictions array is correct. In some cases, the way arguments are passed, especially in a shell environment, can affect how they are interpreted.

3 -Documentation Reference: Consult the documentation for lightning-cli and commando-rune to ensure that your syntax and usage of the parameters align with the documented method.

4- Experiment with Different Formats: Sometimes, trying different formats can help identify the issue. For example, you could try simplifying the command to see if it works with just one restriction, then add the second one.

Try modifying the command like this:
1st:
lightning-cli commando-rune restrictions='["method=invoice","amount_msat=any"]'

2nd: [ if the pname prefix is required and amount_msat is the correct parameter:]
lightning-cli commando-rune restrictions='["method=invoice","pname=amount_msat=any"]'

Note: use bash terminal

@jb55
Copy link
Collaborator Author

jb55 commented Jan 18, 2024 via email

@ShahanaFarooqui
Copy link
Collaborator

@jb55 Not sure if this issue auto-fixed in the meantime or the command was malformed from the starting. But the command is working with version 23.11. Note that the restrictions parameter expects arrays of restrictions.

lightning-cli commando-rune restrictions='[["method=invoice"], ["pnameamount_msat=any"]]'
lightning-cli commando-rune restrictions='[["method=pay"], ["pnameamount_msat<10000"]]'

Please feel free to comment here if it still doesn't work for you. Closing the issue for now.

@jb55
Copy link
Collaborator Author

jb55 commented Jan 19, 2024

nice, thanks!

@ShahanaFarooqui ShahanaFarooqui self-assigned this Feb 20, 2024
@ShahanaFarooqui ShahanaFarooqui removed the good first issue good for onboarding label Feb 20, 2024
@ShahanaFarooqui ShahanaFarooqui added this to the v24.05 milestone Feb 20, 2024
@ShahanaFarooqui
Copy link
Collaborator

ShahanaFarooqui commented Feb 20, 2024

@jb55 Reopening the issue due to:

  • Discrepancy between createrune and checkrune. Either createrune should also remove _ from parameter names before creating the rune or checkrune should also work with _.
  • Documentation also needs to be updated accordingly.

Till it is addressed, pname restrictions can be used after manually removing _ from parameters. eg:
lightning-cli commando-rune restrictions='[["method=invoice"], ["pnameamountmsat=any"]]'
Or
lightning-cli createrune restrictions='[["method=pay"], ["pnameamountmsat<10000"]]'

@ShahanaFarooqui ShahanaFarooqui linked a pull request May 24, 2024 that will close this issue
@ShahanaFarooqui
Copy link
Collaborator

Closing with PR #7124

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 a pull request may close this issue.

5 participants