Skip to content

Commit

Permalink
rescan: add IsCurrent to the ChainSource interface
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ellemouton committed Jul 25, 2023
1 parent e1a71d4 commit a5e6452
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rescan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions rescan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a5e6452

Please sign in to comment.