lightning
lightning copied to clipboard
runes: pname restrictions fail if the parameter has an underscore
> lightning-cli commando-rune restrictions='["method=invoice","pnameamount_msat=any"]'
{
"code": -32602,
"message": "restrictions: not a valid restriction: invalid token '\"pnameamount_msat=any\"'"
}
Is this still a valid issue?
Yes, this is still a valid issue.
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
On Wed, Jan 17, 2024 at 05:30:10PM -0800, Ali Raza wrote:
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.
I don't think ChatGPT is gonna help here.
@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.
nice, thanks!
@jb55 Reopening the issue due to:
- Discrepancy between
createrune
andcheckrune
. Eithercreaterune
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"]]'
Closing with PR #7124