fix lndrest payment checking: b64/hex mismatch.
finally fixes https://github.com/lnbits/lnbits/issues/55 and https://github.com/lnbits/lnbits/issues/110
This commit is contained in:
parent
b5a07c7ae7
commit
f2ea8a0c74
1 changed files with 4 additions and 0 deletions
|
|
@ -131,6 +131,10 @@ class LndRestWallet(Wallet):
|
||||||
# https://api.lightning.community/rest/index.html?python#peersynctype
|
# https://api.lightning.community/rest/index.html?python#peersynctype
|
||||||
statuses = {"UNKNOWN": None, "IN_FLIGHT": None, "SUCCEEDED": True, "FAILED": False}
|
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"]:
|
for p in r.json()["payments"]:
|
||||||
if p["payment_hash"] == checking_id:
|
if p["payment_hash"] == checking_id:
|
||||||
return PaymentStatus(statuses[p["status"]])
|
return PaymentStatus(statuses[p["status"]])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue