chain

package
v0.0.0-...-96115ed Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: ISC Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using slog.

Types

type Callbacks

type Callbacks struct {
	Synced                       func(synced bool)
	FetchMissingCFiltersStarted  func()
	FetchMissingCFiltersProgress func(startCFiltersHeight, endCFiltersHeight int32)
	FetchMissingCFiltersFinished func()
	FetchHeadersStarted          func()
	FetchHeadersProgress         func(lastHeaderHeight int32, lastHeaderTime int64)
	FetchHeadersFinished         func()
	DiscoverAddressesStarted     func()
	DiscoverAddressesFinished    func()
	RescanStarted                func()
	RescanProgress               func(rescannedThrough int32)
	RescanFinished               func()
}

Callbacks contains optional callback functions to notify events during the syncing process. All callbacks are called synchronously and block the syncer from continuing.

type RPCOptions

type RPCOptions struct {
	Address     string
	DefaultPort string
	User        string
	Pass        string
	Dial        func(ctx context.Context, network, address string) (net.Conn, error)
	CA          []byte
	Insecure    bool
}

RPCOptions specifies the network and security settings for establishing a websocket connection to a hdfd JSON-RPC server.

type Syncer

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

Syncer implements wallet synchronization services by processing notifications from a hdfd JSON-RPC server.

func NewSyncer

func NewSyncer(w *wallet.Wallet, r *RPCOptions) *Syncer

NewSyncer creates a Syncer that will sync the wallet using hdfd JSON-RPC.

func (*Syncer) Run

func (s *Syncer) Run(ctx context.Context) (err error)

Run synchronizes the wallet, returning when synchronization fails or the context is cancelled. If startupSync is true, all synchronization tasks needed to fully register the wallet for notifications and synchronize it with the hdfd server are performed. Otherwise, it will listen for notifications but not register for any updates.

func (*Syncer) SetCallbacks

func (s *Syncer) SetCallbacks(cb *Callbacks)

SetCallbacks sets the possible various callbacks that are used to notify interested parties to the syncing progress.

Jump to

Keyboard shortcuts

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