Skip to content

Commit

Permalink
client/asset/dcr: determine sync status with SpvSyncer.Synced() method
Browse files Browse the repository at this point in the history
  • Loading branch information
itswisdomagain authored and chappjc committed Nov 15, 2022
1 parent f35cd1b commit 4411608
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/asset/dcr/spv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions client/asset/dcr/spv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 4411608

Please sign in to comment.