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

API SendPaymentV2 'failure_reason': 'FAILURE_REASON_NO_ROUTE' #714

Closed
weltitob opened this issue Jan 28, 2024 · 2 comments · Fixed by lightningnetwork/lnd#8438
Closed

API SendPaymentV2 'failure_reason': 'FAILURE_REASON_NO_ROUTE' #714

weltitob opened this issue Jan 28, 2024 · 2 comments · Fixed by lightningnetwork/lnd#8438
Labels
bug Something isn't working

Comments

@weltitob
Copy link

Hi when paying an invoice with the SendPaymentV2 I get the error 'failure_reason': 'FAILURE_REASON_NO_ROUTE' but when attempting to pay up exactly the same invoice with the v1/channels/transactions REST API endpoint (the deprecated version) instead it works completly fine..

import base64, codecs, json, requests

REST_HOST = 'mybitnet.com:8443'
MACAROON_PATH = './pythonfunctions/keys/lnd_admin.macaroon'
TLS_PATH = './pythonfunctions/fullchain.pem'

#url = f'https://{REST_HOST}/v1/channels/transactions' # DEPRECATED SOON!
url = f'https://{REST_HOST}/v2/router/send'
macaroon = codecs.encode(open(MACAROON_PATH, 'rb').read(), 'hex')
headers = {'Grpc-Metadata-macaroon': macaroon}

invoice_string  = '...'
#https://www.bolt11.org/
#Data either filles with dest, amt and payment_hash or with payment_request
data = {
  'timeout_seconds': 60,
  'payment_request': invoice_string, 
}

r = requests.post(url, headers=headers, stream=True, data=json.dumps(data), verify=False)
for raw_response in r.iter_lines():
  json_response = json.loads(raw_response)
  print(json_response)
@weltitob weltitob added the bug Something isn't working label Jan 28, 2024
@guggero
Copy link
Member

guggero commented Jan 29, 2024

You need to set a fee limit, otherwise it will only try to look for routes with zero fee.

@weltitob
Copy link
Author

You need to set a fee limit, otherwise it will only try to look for routes with zero fee.

Thanks will try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants