From 4f83da0f264cb29db3a65e3e7c8da649a45a2ccb Mon Sep 17 00:00:00 2001 From: tecnovert Date: Wed, 31 Jul 2019 14:25:54 +0200 Subject: [PATCH] Show unconfirmed coin on wallets page, disable staking for particl. --- basicswap/basicswap.py | 6 +++++- basicswap/http_server.py | 2 ++ basicswap/templates/wallets.html | 2 +- bin/basicswap_prepare.py | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index 508591b..ecb30d1 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -404,14 +404,17 @@ class BasicSwap(): if connection_type == 'rpc': if 'rpcauth' in chain_client_settings: rpcauth = chain_client_settings['rpcauth'] + self.log.debug('Read %s rpc credentials from json settings', coin) elif 'rpcpassword' in chain_client_settings: rpcauth = chain_client_settings['rpcuser'] + ':' + chain_client_settings['rpcpassword'] + self.log.debug('Read %s rpc credentials from json settings', coin) if rpcauth is None: if self.chain == 'mainnet': testnet_name = '' else: testnet_name = chainparams[coin][self.chain].get('name', self.chain) authcookiepath = os.path.join(datadir, testnet_name, '.cookie') + self.log.debug('Reading %s rpc credentials from auth cookie %s', coin, authcookiepath) # Wait for daemon to start for i in range(10): if not os.path.exists(authcookiepath): @@ -2244,7 +2247,8 @@ class BasicSwap(): 'deposit_address': self.getCachedAddressForCoin(coin), 'name': chainparams[coin]['name'].capitalize(), 'blocks': blockchaininfo['blocks'], - 'balance': format8(walletinfo.get('total_balance', walletinfo['balance']) * COIN), + 'balance': format8(makeInt(walletinfo['balance'])), + 'unconfirmed': format8(makeInt(walletinfo.get('unconfirmed_balance'))), 'synced': '{0:.2f}'.format(round(blockchaininfo['verificationprogress'], 2)), } return rv diff --git a/basicswap/http_server.py b/basicswap/http_server.py index 96953aa..67066dd 100644 --- a/basicswap/http_server.py +++ b/basicswap/http_server.py @@ -228,6 +228,8 @@ class HttpHandler(BaseHTTPRequestHandler): 'synced': w['synced'], 'deposit_address': w['deposit_address'], }) + if float(w['unconfirmed']) > 0.0: + wallets_formatted[-1]['unconfirmed'] = w['unconfirmed'] template = env.get_template('wallets.html') return bytes(template.render( diff --git a/basicswap/templates/wallets.html b/basicswap/templates/wallets.html index 69b0768..9840fa7 100644 --- a/basicswap/templates/wallets.html +++ b/basicswap/templates/wallets.html @@ -18,7 +18,7 @@

Error: {{ w.error }}

{% else %} - +{% if w.unconfirmed %}{% endif %} diff --git a/bin/basicswap_prepare.py b/bin/basicswap_prepare.py index 5481e26..62a034d 100644 --- a/bin/basicswap_prepare.py +++ b/bin/basicswap_prepare.py @@ -219,6 +219,7 @@ def prepareDataDir(coin, settings, data_dir, chain, particl_mnemonic): fp.write('zmqpubsmsg=tcp://127.0.0.1:{}\n'.format(settings['zmqport'])) fp.write('spentindex=1') fp.write('txindex=1') + fp.write('staking=0') if particl_mnemonic == 'none': fp.write('createdefaultmasterkey=1')
Balance:{{ w.balance }}
Balance:{{ w.balance }}Unconfirmed:{{ w.unconfirmed }}
Blocks:{{ w.blocks }}
Synced:{{ w.synced }}
{{ w.deposit_address }}