tracker

package
v0.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tracker is the host's chain tracker: overlay-bridge's header store, read over the bridge's header API (default :9178) through the bridge's own Go client, with the two questions every admission asks answered from memory for a moment.

The engine, the SPV verifier and the root reconciler all read this one tracker (ruling #55: the tracker is injected everywhere and asserted non-nil at startup).

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownHeight = errors.New("tracker: height not in the header store")

ErrUnknownHeight means the header store does not hold that height yet.

Functions

This section is empty.

Types

type Bridge

type Bridge struct {
	// contains filtered or unexported fields
}

Bridge is a chain tracker backed by an overlay-bridge header API.

func NewBridge

func NewBridge(base string) *Bridge

NewBridge reads the header API at base (an origin such as http://127.0.0.1:9178). A tip is reused for a second and a root that verified for thirty seconds, as on the TypeScript host; a root the store did not know is never cached, because it may be known a moment later.

func (*Bridge) CurrentHeight

func (b *Bridge) CurrentHeight(ctx context.Context) (uint32, error)

CurrentHeight implements chaintracker.ChainTracker.

func (*Bridge) FreshHeight

func (b *Bridge) FreshHeight(ctx context.Context) (uint32, error)

FreshHeight asks the store for its tip, never from the cache.

func (*Bridge) IsValidRootForHeight

func (b *Bridge) IsValidRootForHeight(ctx context.Context, root *chainhash.Hash, height uint32) (bool, error)

IsValidRootForHeight implements chaintracker.ChainTracker.

func (*Bridge) RootAt

func (b *Bridge) RootAt(ctx context.Context, height uint32) (*chainhash.Hash, error)

RootAt returns the merkle root the store holds at height, never from the cache. A height the store does not hold is ErrUnknownHeight: a reconciler must skip it, never read it as "every root here is wrong" (the trap the bridge client's own doc comment warns of).

type Timed

type Timed struct {
	Inner chaintracker.ChainTracker
	// contains filtered or unexported fields
}

Timed wraps a tracker and adds the time spent in it to a running total, so a verification's merkle/root share can be told apart from its scripts.

func (*Timed) CurrentHeight

func (t *Timed) CurrentHeight(ctx context.Context) (uint32, error)

CurrentHeight implements chaintracker.ChainTracker.

func (*Timed) IsValidRootForHeight

func (t *Timed) IsValidRootForHeight(ctx context.Context, root *chainhash.Hash, height uint32) (bool, error)

IsValidRootForHeight implements chaintracker.ChainTracker.

func (*Timed) Spent

func (t *Timed) Spent() time.Duration

Spent is the total time spent in the inner tracker so far.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL