header

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MIT Imports: 8 Imported by: ? 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Relay

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

Relay takes headers from the Bitcoin chain and relays them to the given host chain.

func StartRelay

func StartRelay(
	ctx context.Context,
	config config.Relay,
	btcChain btc.Handle,
	hostChain chain.Handle,
	observer RelayObserver,
) *Relay

StartRelay creates an instance of the headers relay and runs its processing loops. The lifecycle of the relay can be managed using the passed context. The relay exits automatically once an error occurs.

func (*Relay) ErrChan

func (r *Relay) ErrChan() <-chan error

ErrChan returns the error channel of the relay. Once an error appears here, all relay loops are immediately terminated.

type RelayObserver

type RelayObserver interface {
	// NotifyHeaderPulled notifies about new header pulled from the
	// Bitcoin chain.
	NotifyHeaderPulled(headerHeight int64)

	// NotifyHeadersPushed notifies about new headers pushed to the host chain.
	NotifyHeadersPushed(headersHeights []int64)
}

RelayObserver represents an observer of headers relay events.

Jump to

Keyboard shortcuts

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