diff --git a/api/management/commands/follow_invoices.py b/api/management/commands/follow_invoices.py index 46eecf50..ec7887df 100644 --- a/api/management/commands/follow_invoices.py +++ b/api/management/commands/follow_invoices.py @@ -154,17 +154,7 @@ class Command(BaseCommand): queryset = queryset.union(queryset_retries) for lnpayment in queryset: - success, _ = follow_send_payment(lnpayment.payment_hash) - - # If failed, reset mission control. (This won't scale well, just a temporary fix) - if not success: - LNNode.resetmc() - - # If already 3 attempts and last failed. Make it expire (ask for a new invoice) an reset attempts. - if not success and lnpayment.routing_attempts > 2: - lnpayment.status = LNPayment.Status.EXPIRE - lnpayment.routing_attempts = 0 - lnpayment.save() + follow_send_payment(lnpayment.payment_hash) def update_order_status(self, lnpayment): """Background process following LND hold invoices diff --git a/api/tasks.py b/api/tasks.py index 8438f13e..711c358c 100644 --- a/api/tasks.py +++ b/api/tasks.py @@ -93,6 +93,10 @@ def follow_send_payment(hash): ("macaroon", MACAROON.hex()) ]): + + lnpayment.in_flight = True + lnpayment.save() + if response.status == 0: # Status 0 'UNKNOWN' # Not sure when this status happens lnpayment.in_flight = False @@ -112,7 +116,11 @@ def follow_send_payment(hash): lnpayment.last_routing_time = timezone.now() lnpayment.routing_attempts += 1 lnpayment.in_flight = False + if lnpayment.routing_attempts > 2: + lnpayment.status = LNPayment.Status.EXPIRE + lnpayment.routing_attempts = 0 lnpayment.save() + order.status = Order.Status.FAI order.expires_at = timezone.now() + timedelta( seconds=order.t_to_expire(Order.Status.FAI)) @@ -123,6 +131,9 @@ def follow_send_payment(hash): "IN_FLIGHT":False, } print(context) + + # If failed, reset mission control. (This won't scale well, just a temporary fix) + LNNode.resetmc() return False, context if response.status == 2: # Status 2 'SUCCEEDED' @@ -134,7 +145,7 @@ def follow_send_payment(hash): order.expires_at = timezone.now() + timedelta( seconds=order.t_to_expire(Order.Status.SUC)) order.save() - return True, {"IN_FLIGHT":False} + return True, None except Exception as e: if "invoice expired" in str(e): diff --git a/frontend/src/locales/CONTRIBUTING.MD b/frontend/src/locales/CONTRIBUTING.MD index c4295559..194a98b5 100644 --- a/frontend/src/locales/CONTRIBUTING.MD +++ b/frontend/src/locales/CONTRIBUTING.MD @@ -9,7 +9,6 @@ Simply create a new translation file in `frontend/src/locales` (Same folder wher ## Guidelines -<<<<<<< HEAD Each language .json dictionary contains pairs of keys and values in the following format { "key1":"value1", "key2":"value2", ...}. Most keys are the literal English sentence. These simply have to be translated on the right side, for example, in order to translate the `Make Order` button to Spanish we edit the json file to look like this `{... "Make Order":"Crear Orden",...}`. 1. **Not all keys are explicit sentences.** Some keys are not the English senstence but a variable names e.g. "phone_unsafe_alert". In this case you must take a look at the value originally in `en.json`. @@ -29,29 +28,6 @@ Each language .json dictionary contains pairs of keys and values in the followin 8. **Understand the context, where will this string be displayed?** Literal translations might not work well in some languages. While in English the wording is always similar regardless of the position in the UI, in some languages it might be very different if you are translating a button (the user is taking an action) or if you are simply translating a tooltip. It might be clever to translate the strings while looking at the app. However, many strings can only be found while trading. The testnet RoboSats site is great for this use, as you can explore the whole app simply interacting with it with a testnet lightning wallet. However, if you cannot find where a string is displayed, it might be faster to simply write a message on the telegram group @robosats. 9. **Congratulate yourself!** Seriously, it's so awesome you are looking into building up freedom tools!! -======= -Each language .json dictionary contains pairs of keys and values in the following format { "key1":"value1", "key2":"value2", ...}. Most keys are the literal English sentence. These simply have to be translated on the right side, for example, in order to translate the `Make Order` button to Spanish we should change the file to look like this `{... "Make Order":"Crear Orden",...}`. - -1. **Not all keys are explicit sentences.** Some keys are variable names e.g. "phone_unsafe_alert". In these case you must take a look at the value originally in `en.json`. - -2. **The language dictionary is split into 9 sections.** The first key of each section is a reference and does not need to be translated. For example, the second section starts with the key:value `"USER GENERATION PAGE - UserGenPage.js": "Landing Page and User Generation"` . It does not need to be translated, it is just information for the translator to understand what part of the app he will be working on. - -3. **Try to keep a similar length to the original sentence.** In most cases it will be okay if the translation is shorter. However, translations that result in a higher character count might break the UI! Of course, it might not always be possible to stick to the length of the English sentence. In those cases the UI might have to be changed, contact the responsible person for such a change. - -4. **Some sentences contain variables**, for example, {{currencyCode}}. It will insert the currency code where the variable is found. E.g., `"Pay 30 {{currencyCode}}"` will render into "Pay 30 USD". - -5. **Some sentences contain HTML tags.** These tags are usually hyperlinks. For example in `{"phone_unsafe_alert": "Use <1>Tor Browser and visit the <3>Onion site."}` the children text of <1> (Tor Browser) will link to the Tor Download website, and the children of <3> will link to the RoboSats Onion site. - -6. **Some text is high priority, some other text is low priority.** Some keys are likely to change soon or they might not be so relevant for the user of the app. The translation files are sorted from top to bottom by the priority of the translation. The keys by the end of the translation file are more likely to change. It is best to translate from top to bottom. - -7. Use a spell checker ;) - -8. **Understand the context of where the translation will be displayed.** Literal translations might not work well to some languages. While in English the wording is always similar, in some languages it might be very different if you are translating a button (the user is taking an action) or if you are simply translating a tooltip. - -To understand the context it might be clever to translate the strings while looking at the app. However, many strings can only be found while trading. The testnet RoboSats site is great for this as you can explore the whole app simply interacting with it with testnet bitcoin. However, in case of doubt where a text is displayed, it might be faster to simply write a message on the community group @robosats in Telegram. - -9. Congratulate yourself! Seriously, it's so awesome you are looking into building up freedom tools!! ->>>>>>> i18n