From 441160860e1da414517be529603eccc45f0d3e38 Mon Sep 17 00:00:00 2001 From: Wisdom Arerosuoghene Date: Thu, 10 Nov 2022 21:02:50 +0100 Subject: [PATCH] client/asset/dcr: determine sync status with SpvSyncer.Synced() method --- client/asset/dcr/spv.go | 3 ++- client/asset/dcr/spv_test.go | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/client/asset/dcr/spv.go b/client/asset/dcr/spv.go index 1eb718e17a..937c31619d 100644 --- a/client/asset/dcr/spv.go +++ b/client/asset/dcr/spv.go @@ -88,6 +88,7 @@ type dcrWallet interface { // Interface for *spv.Syncer so that we can test with a stub. type spvSyncer interface { wallet.NetworkBackend + Synced() bool GetRemotePeers() map[string]*p2p.RemotePeer } @@ -773,7 +774,7 @@ func (w *spvWallet) SyncStatus(ctx context.Context) (bool, float32, error) { return false, 0, nil } - return bestHeight == height, float32(height) / float32(bestHeight), nil + return w.spv.Synced(), float32(height) / float32(bestHeight), nil } // bestPeerInitialHeight is the highest InitialHeight recorded from our peers. diff --git a/client/asset/dcr/spv_test.go b/client/asset/dcr/spv_test.go index 1ee03dbc78..a738af9cee 100644 --- a/client/asset/dcr/spv_test.go +++ b/client/asset/dcr/spv_test.go @@ -174,6 +174,10 @@ func (w *tDcrWallet) TxDetails(ctx context.Context, txHash *chainhash.Hash) (*ud return w.txDetails, w.txDetailsErr } +func (w *tDcrWallet) Synced() bool { + return true +} + func (w *tDcrWallet) GetRemotePeers() map[string]*p2p.RemotePeer { return w.remotePeers }