raiden-network / microraiden

MIT License
361 stars 101 forks source link

Provide a better error message for receiver ETH balance below limit #453

Open loredanacirstea opened 6 years ago

loredanacirstea commented 6 years ago

Channel manager ETH balance is below limit - is confusing to users The problem is that the account used as a receiver does not have enough ETH. There is a 10**8 WEI threshold that should be mentioned in the error.

boneyard93501 commented 6 years ago

will that work ?

iff --git a/microraiden/proxy/resources/paywall_decorator.py b/microraiden/proxy/resources/paywall_decorator.py
index 2cad739..2e28c55 100644
--- a/microraiden/proxy/resources/paywall_decorator.py
+++ b/microraiden/proxy/resources/paywall_decorator.py
@@ -38,7 +38,12 @@ class Paywall(object):
         if self.channel_manager.node_online() is False:
             return "Ethereum node is not responding", 502
         if self.channel_manager.get_eth_balance() < constants.PROXY_BALANCE_LIMIT:
-            return "Channel manager ETH balance is below limit", 502
+            msg_vals = (self.channel_manager.get_eth_balance(),
+                        self.receiver_address,
+                        constants.PROXY_BALANCE_LIMIT)
+            msg = "Your account balance {} for receiver account {} is below the"
+            msg += " minimum {} wei balance required to operate."
+            return msg.format(*msg_vals), 502
         try:
             data = RequestData(request.headers, request.cookies)
         except ValueError as e:
(END)