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: 0

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