From 184fa16d0d2ebb85a962883e9e30e0a8ff1424f2 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Wed, 31 May 2023 16:53:03 +0200 Subject: [PATCH] rescan: add IsCurrent to the ChainSource interface This is required for the follow up commit where access to the IsCurrent method is required in the rescanState.rescan method which only has access to the ChainSource interface. --- rescan.go | 4 ++++ rescan_test.go | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/rescan.go b/rescan.go index 185c5f96..ebf32f07 100644 --- a/rescan.go +++ b/rescan.go @@ -74,6 +74,10 @@ type ChainSource interface { // // TODO(wilmer): extend with best hash as well. Subscribe(bestHeight uint32) (*blockntfns.Subscription, error) + + // IsCurrent returns true if the backend chain thinks that its view of + // the network is current. + IsCurrent() bool } // ScanProgressHandler is used in rescanOptions to update the caller with the diff --git a/rescan_test.go b/rescan_test.go index e611eb90..8720c33c 100644 --- a/rescan_test.go +++ b/rescan_test.go @@ -272,6 +272,12 @@ func (c *mockChainSource) setFailGetFilter(b bool) { c.failGetFilter = b } +// IsCurrent returns true if the backend chain thinks that its view of +// the network is current. +func (c *mockChainSource) IsCurrent() bool { + return true +} + // GetCFilter returns the filter of the given type for the block with the given // hash. func (c *mockChainSource) GetCFilter(hash chainhash.Hash,