preparescript: Add WALLET_ENCRYPTION_PWD env var.
Removed unnecessary START_DAEMONS env var. Remove all cached addresses from the basicswap db for a wallet after reseeding. Check that addresses retreived from the db are owned by teh wallet before they're used/displayed
This commit is contained in:
12 files changed
+189
-57
No files matched your search
@@ -9,6 +9,7 @@ import traceback
|
||||
from .util import (
|
||||
get_data_entry,
|
||||
have_data_entry,
|
||||
checkAddressesOwned,
|
||||
)
|
||||
from basicswap.util import (
|
||||
ensure,
|
||||
@@ -31,6 +32,8 @@ def format_wallet_data(ci, w):
|
||||
'blocks': w.get('blocks', '?'),
|
||||
'synced': w.get('synced', '?'),
|
||||
'expected_seed': w.get('expected_seed', '?'),
|
||||
'encrypted': w.get('encrypted', '?'),
|
||||
'locked': w.get('locked', '?'),
|
||||
'updating': w.get('updating', '?'),
|
||||
'havedata': True,
|
||||
}
|
||||
@@ -55,6 +58,8 @@ def format_wallet_data(ci, w):
|
||||
wf['anon_balance'] = w.get('anon_balance', '?')
|
||||
if 'anon_pending' in w and float(w['anon_pending']) > 0.0:
|
||||
wf['anon_pending'] = w['anon_pending']
|
||||
|
||||
checkAddressesOwned(ci, wf)
|
||||
return wf
|
||||
|
||||
|
||||
@@ -297,7 +302,6 @@ def page_wallet(self, url_split, post_string):
|
||||
|
||||
if show_utxo_groups:
|
||||
utxo_groups = ''
|
||||
|
||||
unspent_by_addr = ci.getUnspentsByAddr()
|
||||
|
||||
sorted_unspent_by_addr = sorted(unspent_by_addr.items(), key=lambda x: x[1], reverse=True)
|
||||
@@ -307,6 +311,8 @@ def page_wallet(self, url_split, post_string):
|
||||
wallet_data['show_utxo_groups'] = True
|
||||
wallet_data['utxo_groups'] = utxo_groups
|
||||
|
||||
checkAddressesOwned(ci, wallet_data)
|
||||
|
||||
template = server.env.get_template('wallet.html')
|
||||
return self.render_template(template, {
|
||||
'messages': messages,
|
||||
|
||||
@@ -423,3 +423,17 @@ def listAvailableCoins(swap_client, with_variants=True, split_from=False):
|
||||
if split_from:
|
||||
return coins_from, coins
|
||||
return coins
|
||||
|
||||
|
||||
def checkAddressesOwned(ci, wallet_info):
|
||||
if 'stealth_address' in wallet_info:
|
||||
if wallet_info['stealth_address'] != '?' and \
|
||||
not ci.isAddressMine(wallet_info['stealth_address']):
|
||||
ci._log.error('Unowned stealth address: {}'.format(wallet_info['stealth_address']))
|
||||
wallet_info['stealth_address'] = 'Error: unowned address'
|
||||
|
||||
if 'deposit_address' in wallet_info:
|
||||
if wallet_info['deposit_address'] != 'Refresh necessary' and \
|
||||
not ci.isAddressMine(wallet_info['deposit_address']):
|
||||
ci._log.error('Unowned deposit address: {}'.format(wallet_info['deposit_address']))
|
||||
wallet_info['deposit_address'] = 'Error: unowned address'
|
||||
Reference in new issue
Block a user