Documentation ¶
Index ¶
- func UseLogger(logger slog.Logger)
- type Notifications
- type Syncer
- func (s *Syncer) Blocks(ctx context.Context, blockHashes []*chainhash.Hash) ([]*wire.MsgBlock, error)
- func (s *Syncer) CFiltersV2(ctx context.Context, blockHashes []*chainhash.Hash) ([]filterProof, error)
- func (s *Syncer) DisableDiscoverAccounts()
- func (s *Syncer) Done() <-chan struct{}
- func (s *Syncer) Err() error
- func (s *Syncer) GetInitState(ctx context.Context, rp *p2p.RemotePeer) error
- func (s *Syncer) GetRemotePeers() map[string]*p2p.RemotePeer
- func (s *Syncer) LoadTxFilter(ctx context.Context, reload bool, addrs []stdaddr.Address, ...) error
- func (s *Syncer) PublishMixMessages(ctx context.Context, msgs ...mixing.Message) error
- func (s *Syncer) PublishTransactions(ctx context.Context, txs ...*wire.MsgTx) error
- func (s *Syncer) Rescan(ctx context.Context, blockHashes []chainhash.Hash, ...) error
- func (s *Syncer) Run(ctx context.Context) (err error)
- func (s *Syncer) SetNotifications(ntfns *Notifications)
- func (s *Syncer) SetPersistentPeers(peers []string)
- func (s *Syncer) StakeDifficulty(ctx context.Context) (dcrutil.Amount, error)
- func (s *Syncer) String() string
- func (s *Syncer) Synced(ctx context.Context) (bool, int32)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Notifications ¶
type Notifications struct { Synced func(sync bool) PeerConnected func(peerCount int32, addr string) PeerDisconnected func(peerCount int32, addr string) 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() // MempoolTxs is called whenever new relevant unmined transactions are // observed and saved. MempoolTxs func(txs []*wire.MsgTx) // TipChanged is called when the main chain tip block changes. // When reorgDepth is zero, the new block is a direct child of the previous tip. // If non-zero, one or more blocks described by the parameter were removed from // the previous main chain. // txs contains all relevant transactions mined in each attached block in // unspecified order. // reorgDepth is guaranteed to be non-negative. TipChanged func(tip *wire.BlockHeader, reorgDepth int32, txs []*wire.MsgTx) }
Notifications struct to contain all of the upcoming callbacks that will be used to update the rpc streams for syncing.
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
Syncer implements wallet synchronization services by over the Decred wire protocol using Simplified Payment Verification (SPV) with compact filters.
func (*Syncer) Blocks ¶
func (s *Syncer) Blocks(ctx context.Context, blockHashes []*chainhash.Hash) ([]*wire.MsgBlock, error)
Blocks implements the Blocks method of the wallet.Peer interface.
func (*Syncer) CFiltersV2 ¶
func (s *Syncer) CFiltersV2(ctx context.Context, blockHashes []*chainhash.Hash) ([]filterProof, error)
CFiltersV2 implements the CFiltersV2 method of the wallet.Peer interface. This function blocks until a valid peer in the syncer returns the appropriate CFilters.
func (*Syncer) DisableDiscoverAccounts ¶
func (s *Syncer) DisableDiscoverAccounts()
DisableDiscoverAccounts disables account discovery. This has an effect only if called before the main Run() executes the account discovery process.
func (*Syncer) GetInitState ¶
GetInitState requests the init state, then using the tspend hashes requests all unseen tspend txs, validates them, and adds them to the tspends cache.
func (*Syncer) GetRemotePeers ¶
func (s *Syncer) GetRemotePeers() map[string]*p2p.RemotePeer
GetRemotePeers returns a map of connected remote peers.
func (*Syncer) LoadTxFilter ¶
func (s *Syncer) LoadTxFilter(ctx context.Context, reload bool, addrs []stdaddr.Address, outpoints []wire.OutPoint) error
LoadTxFilter implements the LoadTxFilter method of the wallet.NetworkBackend interface.
NOTE: due to blockcf2 *not* including the spent outpoints in the block, the addrs[] slice MUST include the addresses corresponding to the respective outpoints, otherwise they will not be returned during the rescan.
func (*Syncer) PublishMixMessages ¶
PublishMixMessages implements the PublishMixMessages method of the wallet.NetworkBackend interface.
func (*Syncer) PublishTransactions ¶
PublishTransactions implements the PublishTransaction method of the wallet.Peer interface.
func (*Syncer) Rescan ¶
func (s *Syncer) Rescan(ctx context.Context, blockHashes []chainhash.Hash, save func(*chainhash.Hash, []*wire.MsgTx) error) error
Rescan implements the Rescan method of the wallet.NetworkBackend interface.
func (*Syncer) Run ¶
Run synchronizes the wallet, returning when synchronization fails or the context is cancelled.
func (*Syncer) SetNotifications ¶
func (s *Syncer) SetNotifications(ntfns *Notifications)
SetNotifications sets the possible various callbacks that are used to notify interested parties to the syncing progress.
func (*Syncer) SetPersistentPeers ¶
SetPersistentPeers sets each peer as a persistent peer and disables DNS seeding and peer discovery.
func (*Syncer) StakeDifficulty ¶
StakeDifficulty implements the StakeDifficulty method of the wallet.NetworkBackend interface.
This implementation of the method will always error as the stake difficulty is not queryable over wire protocol, and when the next stake difficulty is available in a header commitment, the wallet will be able to determine this itself without requiring the NetworkBackend.