mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 10:31:35 +00:00
Handle LND down response to clients
This commit is contained in:
parent
849ef0c4a7
commit
715d7ebf6d
@ -532,10 +532,14 @@ class Logics():
|
|||||||
description = f"RoboSats - Publishing '{str(order)}' - Maker bond - This payment WILL FREEZE IN YOUR WALLET, check on the website if it was successful. It will automatically return unless you cheat or cancel unilaterally."
|
description = f"RoboSats - Publishing '{str(order)}' - Maker bond - This payment WILL FREEZE IN YOUR WALLET, check on the website if it was successful. It will automatically return unless you cheat or cancel unilaterally."
|
||||||
|
|
||||||
# Gen hold Invoice
|
# Gen hold Invoice
|
||||||
|
try:
|
||||||
hold_payment = LNNode.gen_hold_invoice(bond_satoshis,
|
hold_payment = LNNode.gen_hold_invoice(bond_satoshis,
|
||||||
description,
|
description,
|
||||||
invoice_expiry=Order.t_to_expire[Order.Status.WFB],
|
invoice_expiry=Order.t_to_expire[Order.Status.WFB],
|
||||||
cltv_expiry_secs=BOND_EXPIRY*3600)
|
cltv_expiry_secs=BOND_EXPIRY*3600)
|
||||||
|
except Exception as e:
|
||||||
|
if 'status = StatusCode.UNAVAILABLE' in str(e):
|
||||||
|
return False, {'bad_request':'The Lightning Network Daemon (LND) is down. Write in the Telegram group to make sure staff is aware.'}
|
||||||
|
|
||||||
order.maker_bond = LNPayment.objects.create(
|
order.maker_bond = LNPayment.objects.create(
|
||||||
concept = LNPayment.Concepts.MAKEBOND,
|
concept = LNPayment.Concepts.MAKEBOND,
|
||||||
@ -613,11 +617,16 @@ class Logics():
|
|||||||
+ " - Taker bond - This payment WILL FREEZE IN YOUR WALLET, check on the website if it was successful. It will automatically return unless you cheat or cancel unilaterally.")
|
+ " - Taker bond - This payment WILL FREEZE IN YOUR WALLET, check on the website if it was successful. It will automatically return unless you cheat or cancel unilaterally.")
|
||||||
|
|
||||||
# Gen hold Invoice
|
# Gen hold Invoice
|
||||||
|
try:
|
||||||
hold_payment = LNNode.gen_hold_invoice(bond_satoshis,
|
hold_payment = LNNode.gen_hold_invoice(bond_satoshis,
|
||||||
description,
|
description,
|
||||||
invoice_expiry=Order.t_to_expire[Order.Status.TAK],
|
invoice_expiry=Order.t_to_expire[Order.Status.TAK],
|
||||||
cltv_expiry_secs=BOND_EXPIRY*3600)
|
cltv_expiry_secs=BOND_EXPIRY*3600)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
if 'status = StatusCode.UNAVAILABLE' in str(e):
|
||||||
|
return False, {'bad_request':'The Lightning Network Daemon (LND) is down. Write in the Telegram group to make sure staff is aware.'}
|
||||||
|
|
||||||
order.taker_bond = LNPayment.objects.create(
|
order.taker_bond = LNPayment.objects.create(
|
||||||
concept = LNPayment.Concepts.TAKEBOND,
|
concept = LNPayment.Concepts.TAKEBOND,
|
||||||
type = LNPayment.Types.HOLD,
|
type = LNPayment.Types.HOLD,
|
||||||
@ -678,11 +687,17 @@ class Logics():
|
|||||||
description = f"RoboSats - Escrow amount for '{str(order)}' - It WILL FREEZE IN YOUR WALLET. It will be released to the buyer once you confirm you received the fiat. It will automatically return if buyer does not confirm the payment."
|
description = f"RoboSats - Escrow amount for '{str(order)}' - It WILL FREEZE IN YOUR WALLET. It will be released to the buyer once you confirm you received the fiat. It will automatically return if buyer does not confirm the payment."
|
||||||
|
|
||||||
# Gen hold Invoice
|
# Gen hold Invoice
|
||||||
|
try:
|
||||||
hold_payment = LNNode.gen_hold_invoice(escrow_satoshis,
|
hold_payment = LNNode.gen_hold_invoice(escrow_satoshis,
|
||||||
description,
|
description,
|
||||||
invoice_expiry=Order.t_to_expire[Order.Status.WF2],
|
invoice_expiry=Order.t_to_expire[Order.Status.WF2],
|
||||||
cltv_expiry_secs=ESCROW_EXPIRY*3600)
|
cltv_expiry_secs=ESCROW_EXPIRY*3600)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
if 'status = StatusCode.UNAVAILABLE' in str(e):
|
||||||
|
return False, {'bad_request':'The Lightning Network Daemon (LND). Write in the Telegram group to make sure staff is aware.'}
|
||||||
|
|
||||||
|
|
||||||
order.trade_escrow = LNPayment.objects.create(
|
order.trade_escrow = LNPayment.objects.create(
|
||||||
concept = LNPayment.Concepts.TRESCROW,
|
concept = LNPayment.Concepts.TRESCROW,
|
||||||
type = LNPayment.Types.HOLD,
|
type = LNPayment.Types.HOLD,
|
||||||
|
Loading…
Reference in New Issue
Block a user