From 465f6bfe2724f3ecd211505e7ba6d3028a83c53a Mon Sep 17 00:00:00 2001 From: Jaquee Date: Fri, 24 Feb 2017 16:57:44 +0100 Subject: [PATCH 1/3] fix daemon startup with --check-updates disabled --- src/daemon/DaemonManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/daemon/DaemonManager.cpp b/src/daemon/DaemonManager.cpp index e1e89f61..0820b462 100644 --- a/src/daemon/DaemonManager.cpp +++ b/src/daemon/DaemonManager.cpp @@ -44,7 +44,7 @@ bool DaemonManager::start(const QString &flags, bool testnet) arguments << str; } - arguments << "--updates" << "disabled"; + arguments << "--check-updates" << "disabled"; qDebug() << "starting monerod " + m_monerod; qDebug() << "With command line arguments " << arguments; From 2d6ddf043e547838b584402e439d547fa76f3809 Mon Sep 17 00:00:00 2001 From: Jaquee Date: Fri, 24 Feb 2017 18:07:46 +0100 Subject: [PATCH 2/3] Improved blockchain sync status ui --- components/NetworkStatusItem.qml | 5 ++++- components/ProgressBar.qml | 7 +++++++ main.qml | 4 ++-- src/libwalletqt/Wallet.cpp | 4 ++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/components/NetworkStatusItem.qml b/components/NetworkStatusItem.qml index 6667b974..7b0187b4 100644 --- a/components/NetworkStatusItem.qml +++ b/components/NetworkStatusItem.qml @@ -48,8 +48,11 @@ Row { } function getConnectionStatusString(status) { - if (status == Wallet.ConnectionStatus_Connected) + if (status == Wallet.ConnectionStatus_Connected) { + if(!appWindow.daemonSynced) + return qsTr("Synchronizing") return qsTr("Connected") + } if (status == Wallet.ConnectionStatus_WrongVersion) return qsTr("Wrong version") if (status == Wallet.ConnectionStatus_Disconnected) diff --git a/components/ProgressBar.qml b/components/ProgressBar.qml index ec53ec61..8462bbf5 100644 --- a/components/ProgressBar.qml +++ b/components/ProgressBar.qml @@ -38,6 +38,13 @@ Item { //clip: true function updateProgress(currentBlock,targetBlock){ + if(targetBlock == 1) { + fillLevel = 0 + progressText.text = qsTr("Establishing connection..."); + progressBar.visible = true + return + } + if(targetBlock > 0) { var progressLevel = ((currentBlock/targetBlock) * 100).toFixed(0); fillLevel = progressLevel diff --git a/main.qml b/main.qml index 843c43b4..4dd72776 100644 --- a/main.qml +++ b/main.qml @@ -351,10 +351,10 @@ ApplicationWindow { // Check daemon status var dCurrentBlock = currentWallet.daemonBlockChainHeight(); var dTargetBlock = currentWallet.daemonBlockChainTargetHeight(); - // Daemon fully synced // TODO: implement onDaemonSynced or similar in wallet API and don't start refresh thread before daemon is synced - daemonSynced = dCurrentBlock >= dTargetBlock + // targetBlock = currentBlock = 1 before network connection is established. + daemonSynced = dCurrentBlock >= dTargetBlock && dTargetBlock != 1 // Update daemon sync progress leftPanel.progressBar.updateProgress(dCurrentBlock,dTargetBlock); leftPanel.progressBar.visible = !daemonSynced && currentWallet.connected() !== Wallet.ConnectionStatus_Disconnected diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index 8913d4c3..77b35d06 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -21,7 +21,7 @@ namespace { static const int DAEMON_BLOCKCHAIN_HEIGHT_CACHE_TTL_SECONDS = 5; - static const int DAEMON_BLOCKCHAIN_TARGET_HEIGHT_CACHE_TTL_SECONDS = 60; + static const int DAEMON_BLOCKCHAIN_TARGET_HEIGHT_CACHE_TTL_SECONDS = 30; static const int WALLET_CONNECTION_STATUS_CACHE_TTL_SECONDS = 5; } @@ -262,7 +262,7 @@ quint64 Wallet::daemonBlockChainHeight() const quint64 Wallet::daemonBlockChainTargetHeight() const { - if (m_daemonBlockChainTargetHeight == 0 + if (m_daemonBlockChainTargetHeight <= 1 || m_daemonBlockChainTargetHeightTime.elapsed() / 1000 > m_daemonBlockChainTargetHeightTtl) { m_daemonBlockChainTargetHeight = m_walletImpl->daemonBlockChainTargetHeight(); From 3adeab87ed15b02b9818f7dcd626a627dd6ab08b Mon Sep 17 00:00:00 2001 From: Jaquee Date: Fri, 24 Feb 2017 21:51:37 +0100 Subject: [PATCH 3/3] wallet sync: progressbar ui improvements --- components/ProgressBar.qml | 12 +++++++++--- main.qml | 8 +++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/components/ProgressBar.qml b/components/ProgressBar.qml index 8462bbf5..0c1519de 100644 --- a/components/ProgressBar.qml +++ b/components/ProgressBar.qml @@ -37,7 +37,7 @@ Item { visible: false //clip: true - function updateProgress(currentBlock,targetBlock){ + function updateProgress(currentBlock,targetBlock, blocksToSync){ if(targetBlock == 1) { fillLevel = 0 progressText.text = qsTr("Establishing connection..."); @@ -46,9 +46,15 @@ Item { } if(targetBlock > 0) { - var progressLevel = ((currentBlock/targetBlock) * 100).toFixed(0); + var remaining = targetBlock - currentBlock + // wallet sync + if(blocksToSync > 0) + var progressLevel = (100*(blocksToSync - remaining)/blocksToSync).toFixed(0); + // Daemon sync + else + var progressLevel = (100*(currentBlock/targetBlock)).toFixed(0); fillLevel = progressLevel - progressText.text = qsTr("Synchronizing blocks %1/%2").arg(currentBlock.toFixed(0)).arg(targetBlock.toFixed(0)); + progressText.text = qsTr("Blocks remaining: %1").arg(remaining.toFixed(0)); progressBar.visible = currentBlock < targetBlock } } diff --git a/main.qml b/main.qml index 4dd72776..91de9efd 100644 --- a/main.qml +++ b/main.qml @@ -66,6 +66,7 @@ ApplicationWindow { property bool foundNewBlock: false property int timeToUnlock: 0 property bool qrScannerEnabled: builtWithScanner && (QtMultimedia.availableCameras.length > 0) + property int blocksToSync: 1 // true if wallet ever synchronized property bool walletInitialized : false @@ -408,7 +409,12 @@ ApplicationWindow { function onWalletNewBlock(blockHeight, targetHeight) { // Update progress bar - leftPanel.progressBar.updateProgress(blockHeight,targetHeight); + var remaining = targetHeight - blockHeight; + if(blocksToSync < remaining) { + blocksToSync = remaining; + } + + leftPanel.progressBar.updateProgress(blockHeight,targetHeight, blocksToSync); foundNewBlock = true; }