Add routing timeout to .env

This commit is contained in:
Reckless_Satoshi
2022-06-05 09:15:40 -07:00
parent 7c050b560a
commit 4ac3618fd7
3 changed files with 12 additions and 5 deletions

View File

@ -91,11 +91,15 @@ INVOICE_AND_ESCROW_DURATION = 30
# Time to confim chat and confirm fiat (time to Fiat Sent confirmation) HOURS # Time to confim chat and confirm fiat (time to Fiat Sent confirmation) HOURS
FIAT_EXCHANGE_DURATION = 24 FIAT_EXCHANGE_DURATION = 24
# ROUTING
# Proportional routing fee limit (fraction of total payout: % / 100) # Proportional routing fee limit (fraction of total payout: % / 100)
PROPORTIONAL_ROUTING_FEE_LIMIT = 0.0002 PROPORTIONAL_ROUTING_FEE_LIMIT = 0.0002
# Base flat limit fee for routing in Sats (used only when proportional is lower than this) # Base flat limit fee for routing in Sats (used only when proportional is lower than this)
MIN_FLAT_ROUTING_FEE_LIMIT = 10 MIN_FLAT_ROUTING_FEE_LIMIT = 10
MIN_FLAT_ROUTING_FEE_LIMIT_REWARD = 2 MIN_FLAT_ROUTING_FEE_LIMIT_REWARD = 2
# Routing timeouts
REWARDS_TIMEOUT_SECONDS = 60
PAYOUT_TIMEOUT_SECONDS = 60
# Reward tip. Reward for every finished trade in the referral program (Satoshis) # Reward tip. Reward for every finished trade in the referral program (Satoshis)
REWARD_TIP = 100 REWARD_TIP = 100

View File

@ -238,7 +238,7 @@ class LNNode:
if payout["expires_at"] < timezone.now(): if payout["expires_at"] < timezone.now():
payout["context"] = { payout["context"] = {
"bad_invoice": f"The invoice provided has already expired" "bad_invoice": "The invoice provided has already expired"
} }
return payout return payout
@ -257,9 +257,10 @@ class LNNode:
lnpayment.num_satoshis * float(config("PROPORTIONAL_ROUTING_FEE_LIMIT")), lnpayment.num_satoshis * float(config("PROPORTIONAL_ROUTING_FEE_LIMIT")),
float(config("MIN_FLAT_ROUTING_FEE_LIMIT_REWARD")), float(config("MIN_FLAT_ROUTING_FEE_LIMIT_REWARD")),
)) # 200 ppm or 10 sats )) # 200 ppm or 10 sats
timeout_seconds = int(config("PAYOUT_TIMEOUT_SECONDS"))
request = routerrpc.SendPaymentRequest(payment_request=lnpayment.invoice, request = routerrpc.SendPaymentRequest(payment_request=lnpayment.invoice,
fee_limit_sat=fee_limit_sat, fee_limit_sat=fee_limit_sat,
timeout_seconds=30) timeout_seconds=timeout_seconds)
for response in cls.routerstub.SendPaymentV2(request, for response in cls.routerstub.SendPaymentV2(request,
metadata=[("macaroon", metadata=[("macaroon",

View File

@ -78,12 +78,14 @@ def follow_send_payment(hash):
lnpayment.num_satoshis * lnpayment.num_satoshis *
float(config("PROPORTIONAL_ROUTING_FEE_LIMIT")), float(config("PROPORTIONAL_ROUTING_FEE_LIMIT")),
float(config("MIN_FLAT_ROUTING_FEE_LIMIT")), float(config("MIN_FLAT_ROUTING_FEE_LIMIT")),
)) # 200 ppm or 10 sats )) # 1000 ppm or 10 sats
timeout_seconds = int(config("REWARRDS_TIMEOUT_SECONDS"))
request = LNNode.routerrpc.SendPaymentRequest( request = LNNode.routerrpc.SendPaymentRequest(
payment_request=lnpayment.invoice, payment_request=lnpayment.invoice,
fee_limit_sat=fee_limit_sat, fee_limit_sat=fee_limit_sat,
timeout_seconds=60, timeout_seconds=timeout_seconds,
) # time out payment in 60 seconds )
order = lnpayment.order_paid order = lnpayment.order_paid
try: try: