getWalletsInfo reports errors per wallet.

This commit is contained in:
tecnovert 2019-07-24 01:33:24 +02:00
parent 683c6e6661
commit c51e28103e
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
2 changed files with 11 additions and 4 deletions

View file

@ -1370,7 +1370,7 @@ class BasicSwap():
prevout_s = ' in={}:{}'.format(prev_txnid, prev_n) prevout_s = ' in={}:{}'.format(prev_txnid, prev_n)
if fee_rate is None: if fee_rate is None:
fee_rate = self.getRelayFeeRateForCoin(coin_type) fee_rate = self.getFeeRateForCoin(coin_type)
tx_vsize = self.getContractSpendTxVSize(coin_type) tx_vsize = self.getContractSpendTxVSize(coin_type)
tx_fee = (fee_rate * tx_vsize) / 1000 tx_fee = (fee_rate * tx_vsize) / 1000
@ -2262,7 +2262,10 @@ class BasicSwap():
rv = {} rv = {}
for c in Coins: for c in Coins:
if self.coin_clients[c]['connection_type'] == 'rpc': 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 return rv
def countAcceptedBids(self, offer_id=None): def countAcceptedBids(self, offer_id=None):

View file

@ -132,8 +132,12 @@ class HttpHandler(BaseHTTPRequestHandler):
content += '<form method="post">' content += '<form method="post">'
for k, w in wallets.items(): for k, w in wallets.items():
cid = str(int(k)) cid = str(int(k))
content += '<h4>' + w['name'] + '</h4>' \ content += '<h4>' + w['name'] + '</h4>'
+ '<table>' \
if 'error' in w:
content += '<p>Error: {}</p>'.format(w['error'])
content += '<table>' \
+ '<tr><td>Balance:</td><td>' + w['balance'] + '</td></tr>' \ + '<tr><td>Balance:</td><td>' + w['balance'] + '</td></tr>' \
+ '<tr><td>Blocks:</td><td>' + str(w['blocks']) + '</td></tr>' \ + '<tr><td>Blocks:</td><td>' + str(w['blocks']) + '</td></tr>' \
+ '<tr><td>Synced:</td><td>' + str(w['synced']) + '</td></tr>' \ + '<tr><td>Synced:</td><td>' + str(w['synced']) + '</td></tr>' \