aboutsummaryrefslogtreecommitdiff
path: root/main.qml
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2019-06-13 12:19:52 +0000
committerxiphon <xiphon@protonmail.com>2019-06-13 12:33:05 +0000
commit2524cc179e985cd6abfb7cb4b4c7e6a064188cef (patch)
tree9699c1bbe10ec138d85c7907a87a7aa122ce0f3b /main.qml
parent68c7cf7276b8192ef800e3ab8fcc51815fb9c1cc (diff)
downloadmonzero-gui-2524cc179e985cd6abfb7cb4b4c7e6a064188cef.tar.gz
monzero-gui-2524cc179e985cd6abfb7cb4b4c7e6a064188cef.tar.xz
monzero-gui-2524cc179e985cd6abfb7cb4b4c7e6a064188cef.zip
Wallet: async fetching wallet, daemon and target height
Diffstat (limited to 'main.qml')
-rw-r--r--main.qml24
1 files changed, 12 insertions, 12 deletions
diff --git a/main.qml b/main.qml
index 3299c629..d4bb6838 100644
--- a/main.qml
+++ b/main.qml
@@ -293,6 +293,7 @@ ApplicationWindow {
// Disconnect all listeners
if (typeof currentWallet !== "undefined" && currentWallet !== null) {
+ currentWallet.heightRefreshed.disconnect(onHeightRefreshed);
currentWallet.refreshed.disconnect(onWalletRefresh)
currentWallet.updated.disconnect(onWalletUpdate)
currentWallet.newBlock.disconnect(onWalletNewBlock)
@@ -351,6 +352,7 @@ ApplicationWindow {
}
// connect handlers
+ currentWallet.heightRefreshed.connect(onHeightRefreshed);
currentWallet.refreshed.connect(onWalletRefresh)
currentWallet.updated.connect(onWalletUpdate)
currentWallet.newBlock.connect(onWalletNewBlock)
@@ -621,18 +623,7 @@ ApplicationWindow {
remoteNodeConnected = false;
}
- function onWalletRefresh() {
- console.log(">>> wallet refreshed")
-
- // Daemon connected
- leftPanel.networkStatus.connected = currentWallet.connected()
-
- // Wallet height
- var bcHeight = currentWallet.blockChainHeight();
-
- // Check daemon status
- var dCurrentBlock = currentWallet.daemonBlockChainHeight();
- var dTargetBlock = currentWallet.daemonBlockChainTargetHeight();
+ function onHeightRefreshed(bcHeight, dCurrentBlock, dTargetBlock) {
// Daemon fully synced
// TODO: implement onDaemonSynced or similar in wallet API and don't start refresh thread before daemon is synced
// targetBlock = currentBlock = 1 before network connection is established.
@@ -683,6 +674,15 @@ ApplicationWindow {
onWalletUpdate();
}
+ function onWalletRefresh() {
+ console.log(">>> wallet refreshed")
+
+ // Daemon connected
+ leftPanel.networkStatus.connected = currentWallet.connected()
+
+ currentWallet.refreshHeightAsync();
+ }
+
function startDaemon(flags){
// Pause refresh while starting daemon
currentWallet.pauseRefresh();