chain

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: ISC Imports: 19 Imported by: 1

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 added in v1.6.0

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 added in v1.6.0

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 dcrd JSON-RPC server.

type Syncer added in v1.6.0

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

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

func NewSyncer added in v1.6.0

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

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

func (*Syncer) Run added in v1.6.0

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 dcrd server are performed. Otherwise, it will listen for notifications but not register for any updates.

func (*Syncer) SetCallbacks added in v1.6.0

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