-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove unused mocks * Remove unused HeadBroadcasterRegistry * Cleanup head tracker structures * Fix lint & cleanup * Move HeadSaver under headtracker package
- Loading branch information
Showing
29 changed files
with
179 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package headtracker | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/smartcontractkit/chainlink/v2/common/types" | ||
) | ||
|
||
// HeadSaver is an chain agnostic interface for saving and loading heads | ||
// Different chains will instantiate generic HeadSaver type with their native Head and BlockHash types. | ||
type HeadSaver[H types.Head[BLOCK_HASH], BLOCK_HASH types.Hashable] interface { | ||
// Save updates the latest block number, if indeed the latest, and persists | ||
// this number in case of reboot. | ||
Save(ctx context.Context, head H) error | ||
// Load loads latest heads up to latestFinalized - historyDepth, returns the latest chain. | ||
Load(ctx context.Context, latestFinalized int64) (H, error) | ||
// LatestChain returns the block header with the highest number that has been seen, or nil. | ||
LatestChain() H | ||
// Chain returns a head for the specified hash, or nil. | ||
Chain(hash BLOCK_HASH) H | ||
// MarkFinalized - marks matching block and all it's direct ancestors as finalized | ||
MarkFinalized(ctx context.Context, latestFinalized H) error | ||
} |
Oops, something went wrong.