Bugfix: Wallet creation timeout, RPC error when deleting wallet and sync messages (#2250)

* higher timeout for wallet creation
* Fix raising RPC error when deleting a wallet
* remove sync notifications
This commit is contained in:
Manolis Mandrapilias 2023-02-23 18:57:17 +01:00 committed by GitHub
parent d538eb5fd7
commit 4b677bb7e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 30 deletions

View file

@ -53,11 +53,7 @@ describe('Connecting nodes', () => {
it('Check sync status of Bitcoin Core node', () => {
cy.intercept("GET", "/nodes/sync_status/", {'fullySynced': false});
cy.visit('/')
cy.contains('Your Bitcoin node is syncing.')
cy.get('[data-cy="unfinished-sync-indicator"]').should('be.visible')
// The message should only pop up once per session
cy.visit('/')
cy.contains('Your Bitcoin node is syncing.').should('not.exist');
})
})

View file

@ -355,6 +355,7 @@ class WalletManager:
self._check_duplicate_keys(keys)
wallet_alias = alias(name)
i = 2
# Ensure unique wallet alias
while (
os.path.isfile(os.path.join(self.working_folder, "%s.json" % wallet_alias))
or os.path.join(self.rpc_path, wallet_alias) in walletsindir

View file

@ -933,31 +933,23 @@ def settings_deletewallet(wallet_alias):
# deleted is a tuple: (specter_wallet_deleted, core_wallet_file_deleted)
if deleted == (True, True):
flash(_("Wallet in Specter and wallet file on node deleted successfully."))
return redirect(url_for("index"))
elif deleted == (True, False):
flash(
_(
"Wallet in Specter deleted successfully but wallet file on node could not be removed automatically."
)
)
return redirect(url_for("index"))
elif deleted == (False, True):
flash(
_("Deletion of wallet in Specter failed, but wallet on node was removed."),
"error",
)
return redirect(url_for("index"))
else:
flash(_("Deletion of wallet failed."), "error")
return redirect(url_for("index"))
scroll_to_rescan_blockchain = request.args.get("rescan_blockchain")
return render_template(
"wallet/settings/wallet_settings.jinja",
purposes=purposes,
wallet_alias=wallet_alias,
wallet=wallet,
specter=app.specter,
rand=rand,
error=error,
scroll_to_rescan_blockchain=scroll_to_rescan_blockchain,
)
return redirect(request.referrer or "/")
@wallets_endpoint.route("/wallet/<wallet_alias>/settings/clearcache", methods=["POST"])

View file

@ -32,7 +32,6 @@
{% endif %}
})
let showCoreSyncMsg = sessionStorage.getItem('showCoreSyncMsg') || true
async function checkSyncStatus() {
let url = `{{ url_for('nodes_endpoint.check_sync_status') }}`;
const response = await send_request(url, 'GET', "{{ csrf_token() }}");
@ -46,11 +45,6 @@
document.getElementById('unfinished-ibd-indicator').classList.remove('hidden')
document.getElementById('unfinished-ibd-indicator').classList.add('animate-spin')
document.getElementById('connected-icon').classList.add('hidden')
// Show message only once per session
if (showCoreSyncMsg === true) {
showNotification(`{{ _("Your Bitcoin node is syncing. Check the progress by clicking on the connection.") }}`)
}
sessionStorage.setItem('showCoreSyncMsg', false);
setTimeout(checkSyncStatus, 5*60000);
}
}

View file

@ -302,14 +302,20 @@ class Wallet:
# Use descriptor wallet
try:
rpc.createwallet(
os.path.join(rpc_path, alias), True, True, "", False, True
os.path.join(rpc_path, alias),
True,
True,
"",
False,
True,
timeout=20,
)
created = True
except Exception as e:
logger.exception(e)
# if we failed to create or didn't try - create without descriptors
if not created:
rpc.createwallet(os.path.join(rpc_path, alias), True)
rpc.createwallet(os.path.join(rpc_path, alias), True, timeout=20)
use_descriptors = False
wallet_rpc = rpc.wallet(os.path.join(rpc_path, alias))

View file

@ -27,7 +27,6 @@
{% endif %}
})
let showSpectrumSyncMsg = sessionStorage.getItem('showSyncMsg') || true
async function checkSyncStatus() {
let url = `{{ url_for('nodes_endpoint.check_sync_status') }}`;
const response = await send_request(url, 'GET', "{{ csrf_token() }}");
@ -41,11 +40,6 @@
document.getElementById('unfinished-ibd-indicator').classList.remove('hidden')
document.getElementById('unfinished-ibd-indicator').classList.add('animate-spin')
document.getElementById('connected-icon').classList.add('hidden')
// Show message only once per session
if (showSpectrumSyncMsg === true) {
showNotification(`{{ _("Spectrum is syncing. Check the progress by clicking on the connection.") }}`)
}
sessionStorage.setItem('showSpectrumSyncMsg', false);
setTimeout(checkSyncStatus, 30000);
}
}