From c51e28103e423404e1d0bc534488d669c7a5498f Mon Sep 17 00:00:00 2001 From: tecnovert Date: Wed, 24 Jul 2019 01:33:24 +0200 Subject: [PATCH] getWalletsInfo reports errors per wallet. --- basicswap/basicswap.py | 7 +++++-- basicswap/http_server.py | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index 7ca68f7..d10a9ab 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -1370,7 +1370,7 @@ class BasicSwap(): prevout_s = ' in={}:{}'.format(prev_txnid, prev_n) if fee_rate is None: - fee_rate = self.getRelayFeeRateForCoin(coin_type) + fee_rate = self.getFeeRateForCoin(coin_type) tx_vsize = self.getContractSpendTxVSize(coin_type) tx_fee = (fee_rate * tx_vsize) / 1000 @@ -2262,7 +2262,10 @@ class BasicSwap(): rv = {} for c in Coins: if self.coin_clients[c]['connection_type'] == 'rpc': - rv[c] = self.getWalletInfo(c) + try: + rv[c] = self.getWalletInfo(c) + except Exception as ex: + rv[c] = {'name': chainparams[c]['name'].capitalize(), 'error': str(ex)} return rv def countAcceptedBids(self, offer_id=None): diff --git a/basicswap/http_server.py b/basicswap/http_server.py index d596baa..d39907d 100644 --- a/basicswap/http_server.py +++ b/basicswap/http_server.py @@ -132,8 +132,12 @@ class HttpHandler(BaseHTTPRequestHandler): content += '
' for k, w in wallets.items(): cid = str(int(k)) - content += '

' + w['name'] + '

' \ - + '' \ + content += '

' + w['name'] + '

' + + if 'error' in w: + content += '

Error: {}

'.format(w['error']) + + content += '
' \ + '' \ + '' \ + '' \
Balance:' + w['balance'] + '
Blocks:' + str(w['blocks']) + '
Synced:' + str(w['synced']) + '