2

I am trying to use the getroute command, specified as such:

getroute id msatoshi riskfactor [cltv] [fromid] [fuzzpercent] [exclude] [maxhops]
  1. Do I need to include all the elements above, or can I ignore the optional elements (which I understand to be the ones in square brackets) and rely on their default values?
  2. If I can ignore the optional elements, how do I do that?
  3. How can i specify the exclude parameter? I had an error trying with:
    getroute 024...a67 1000000sat 10 exclude="687193x890x0/0, 687193x890x0/1"
    

(I am using Spark wallet's RPC console, FYI.)

2 Answers 2

0

Ok posting a solution of the https://bitcoin.stackexchange.com/a/107205/91194

Sorry if the command line params in JSON are a little bit a mess in core lightning, but it is the best standard format that we found.

The problem is that there is a very difference between double quotes in OSX and double quotes in Linux. Simply are different and our parser go crazy!

So take the example inside the answer of Antonie, he has a OSX system base just because the quote posted is and not ".

So if you run now the command with this difference in mind

clightning -k --testnet getroute id=03b39d1ddf13ce486de74e9e44e0538f960401a9ec75534ba9cfe4100d65426880 amount_msat=1000 riskfactor=1 exclude='["564334x877x1/0","564195x1292x0/1"]'
{
   "route": []
}

Done! but if you can open a issue by linking this answer we try to find a solution for this parser bug (I am not sure that it is a bug btw)

2
  • For what it's worth @vincenzopalazzo i don't have an OSX-based system. No idea how comes the quotes in my answer seem backward. Aug 14, 2023 at 8:22
  • @AntoinePoinsot Yeah I was thinking why you were using OSX based too, but this happens with OSX a lot, I am not sure if there is another way to write them too Aug 14, 2023 at 9:37
0

Using C-lightning RPC interface you can avoid specifying optional parameters, just by not specifying them. Using the console in Spark wallet shouldn't be different.

You can refer to a specific optional argument by its name while omitting the others by using the -k command line option of lightning-cli. So for the example your gave:

lightning-cli -k getroute id=024...a67 msatoshi=1000000sat riskfactor=10 exclude='["564334x877x1/0","564195x1292x0/1"]'

I don't know if Spark provides a way to refer to options by their name. You can always just specify the default of the options as documented.

4
  • Thanks. When I enter the above, including the square brackets, I get the following error: exclude: should be an array: invalid token '"[“687193x890x0/0”,“687193x890x0/1”]"'
    – runam0k
    Jun 23, 2021 at 10:23
  • This is a quote escape issue. Use single quotes around the array. Jun 23, 2021 at 10:36
  • Thanks. I included single quotes around the array - '["687193x890x0/0","687193x890x0/1"]' - and now get the error: exclude: should be an array: invalid token '"[\"687193x890x0/0\",\"687193x890x0/1\"]"'
    – runam0k
    Jun 23, 2021 at 10:52
  • Take a look to the double quote posted in the solution, there are wrong! See why here bitcoin.stackexchange.com/a/119278/91194 Aug 13, 2023 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.