1

Attempting a payment through a predefined route using:

lncli -network=testnet queryroutes 02e34c1b4c5f8e7419cf4d10e3bc9651d46dc1af68df6a7b81a24951a9192aa9c4 25000 | lncli -network=testnet sendtoroute -pay_hash=45b9255c8648c6c1f60e394e555f745af31ed7fab385d0cf9e82b62ce8e8dfba - 

Always give me back:

{
    "payment_error": "FinalExpiryTooSoon",
    "payment_preimage": "",
    "payment_route": null
}

Regardless the expiry I set in the addinvoice command. Can someone clarify Why? Moreover, how is it possible to use the sendtoroute command using the routes.json obtained before from the queryroutes command?

  • 1
    Could you try adding “--final_cltv_delta=144” option to your queryroutes command? – Dmitry Laptev Feb 7 at 15:00
  • Adding this option works! – Stefano Angieri Feb 7 at 16:11
  • Glad it helped. Added an explanation of why you need this and posted it as an answer. – Dmitry Laptev Feb 7 at 16:50
2

TL;DR. You need to specify --final_cltv_delta=144 option in the lncli queryroutes command.

Longer answer... When payment is routed through Lightning Network, each intermediate node has a potential ability to steal the funds being transferred. To prevent this from happening, intermediate nodes cannot move the money immediately, but only after a certain period of time. And within this period the funds can be claimed back by a legitimate owner.

final_cltv_delta option specifies this period of time (measured in the number of blocks) for the last node in the chain of hops. When you query routes, the default value is small (I believe it was 9 at some point). But this value is not accepted by most lnd nodes, which require a longer period of 144 by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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