From lncli network=testnet sendtoroute -h
:
NAME:
lncli sendtoroute - send a payment over a predefined route
USAGE:
lncli sendtoroute [command options] [arguments...]
DESCRIPTION:
Send a payment over Lightning using a specific route. One must specify
a list of routes to attempt and the payment hash. This command can even
be chained with the response to queryroutes. This command can be used
to implement channel rebalancing by crafting a self-route, or even
atomic swaps using a self-route that crosses multiple chains.
There are three ways to specify routes:
* using the --routes parameter to manually specify a JSON encoded
set of routes in the format of the return value of queryroutes:
(lncli sendtoroute --payment_hash=<pay_hash> --routes=<route>)
* passing the routes as a positional argument:
(lncli sendtoroute --payment_hash=pay_hash <route>)
* or reading in the routes from stdin, which can allow chaining the
response from queryroutes, or even read in a file with a set of
pre-computed routes:
(lncli queryroutes --args.. | lncli sendtoroute --payment_hash= -
notice the '-' at the end, which signals that lncli should read
the route in from stdin
OPTIONS:
--payment_hash value, --pay_hash value the hash to use within the payment's HTLC
--routes value, -r value a json array string in the format of the response of queryroutes that denotes which routes to use
I use this command to save the routes in a json file:
lncli -network=testnet queryroutes 02e34c1b4c5f8e7419cf4d10e3bc9651d46dc1af68df6a7b81a24951a9192aa9c4 --final_cltv_delta=144 25000->routes.json
Then from the spec, performing:
lncli --network=testnet sendtoroute --payment_hash=03bd33db2dfdebff50ca8a7ae3bade681bbf7f25246248c9416b4441b1dbf4c2 --routes=routes.json
I always get back this error:
[lncli] unable to unmarshal json string from incoming array of routes: invalid character 'r' looking for beginning of value
Am I doing something wrong? What should I set as --routes parameter?