From f0fc83619cdd6e0b0a453f97292a08fe477b29ed Mon Sep 17 00:00:00 2001 From: Devin Bileck <603793+devinbileck@users.noreply.github.com> Date: Wed, 15 May 2019 23:14:55 -0700 Subject: [PATCH] Fix DAO synchronization text after restore from seed After restoring from seed, the text shown under DAO / BSQ Wallet / Transactions displays an incorrect progress - the numbers are swapped. For example: "Awaiting blocks... Verified 575,868 blocks out of 554,857" Normally we get the latest block height from BitcoinJ as the target height, and we request BSQ blocks from seed nodes up to latest block. But when restoring from seed, we receive the latest block height from the seed nodes while BitcoinJ has not received all blocks yet and is still syncing. Fixes https://github.com/bisq-network/bisq/issues/2825 --- .../desktop/main/dao/wallet/tx/BsqTxView.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.java b/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.java index 2cd6f06e2c9..803c54900b3 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.java @@ -270,13 +270,23 @@ private void onUpdateAnyChainHeight() { chainSyncIndicator.setManaged(!synced); if (synced) { chainHeightLabel.setText(Res.get("dao.wallet.chainHeightSynced", - currentBlockHeight, - walletChainHeight)); + currentBlockHeight)); } else { chainSyncIndicator.setProgress(progress); - chainHeightLabel.setText(Res.get("dao.wallet.chainHeightSyncing", - currentBlockHeight, - walletChainHeight)); + if (walletChainHeight > currentBlockHeight) { + // Normally we get the latest block height from BitcoinJ as the target height, + // and we request BSQ blocks from seed nodes up to latest block + chainHeightLabel.setText(Res.get("dao.wallet.chainHeightSyncing", + currentBlockHeight, + walletChainHeight)); + } else { + // But when restoring from seed, we receive the latest block height + // from the seed nodes while BitcoinJ has not received all blocks yet and + // is still syncing + chainHeightLabel.setText(Res.get("dao.wallet.chainHeightSyncing", + walletChainHeight, + currentBlockHeight)); + } } } else { chainHeightLabel.setText(Res.get("dao.wallet.chainHeightSyncing",