Browse Source

fix lndrest payment checking: b64/hex mismatch.

finally fixes https://github.com/lnbits/lnbits/issues/55
and https://github.com/lnbits/lnbits/issues/110
atmext
fiatjaf 4 years ago
parent
commit
f2ea8a0c74
  1. 4
      lnbits/wallets/lndrest.py

4
lnbits/wallets/lndrest.py

@ -131,6 +131,10 @@ class LndRestWallet(Wallet):
# https://api.lightning.community/rest/index.html?python#peersynctype
statuses = {"UNKNOWN": None, "IN_FLIGHT": None, "SUCCEEDED": True, "FAILED": False}
# for some reason our checking_ids are in base64 but the payment hashes
# returned here are in hex, lnd is weird
checking_id = base64.b64decode(checking_id).hex()
for p in r.json()["payments"]:
if p["payment_hash"] == checking_id:
return PaymentStatus(statuses[p["status"]])

Loading…
Cancel
Save