Add routing timeout to .env

This commit is contained in:
Reckless_Satoshi 2022-06-05 09:15:40 -07:00
parent 7c050b560a
commit 4ac3618fd7
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
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
FIAT_EXCHANGE_DURATION = 24
# ROUTING
# Proportional routing fee limit (fraction of total payout: % / 100)
PROPORTIONAL_ROUTING_FEE_LIMIT = 0.0002
# 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_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 = 100

View File

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

View File

@ -78,12 +78,14 @@ def follow_send_payment(hash):
lnpayment.num_satoshis *
float(config("PROPORTIONAL_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(
payment_request=lnpayment.invoice,
fee_limit_sat=fee_limit_sat,
timeout_seconds=60,
) # time out payment in 60 seconds
timeout_seconds=timeout_seconds,
)
order = lnpayment.order_paid
try: