Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

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 BackendStatus

type BackendStatus struct {
	Host      string
	RPCStatus string
	*WalletStatus
}

BackendStatus provides a summary of a single back-end server

type StakepooldManager

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

StakepooldManager coordinates the communication between dcrstakepool and multiple instances of stakepoold. All interaction with stakepoold should be through StakepooldManager.

func ConnectStakepooldGRPC

func ConnectStakepooldGRPC(stakepooldHosts []string, stakepooldCerts []string) (*StakepooldManager, error)

ConnectStakepooldGRPC establishes a gRPC connection with all provided stakepoold hosts. Returns an error if any host cannot be contacted, has the wrong RPC version, or is otherwise mis-configured.

func (*StakepooldManager) BackendStatus

func (s *StakepooldManager) BackendStatus() []BackendStatus

BackendStatus uses the state of each RPC connection and the WalletInfo RPC to return a summary of the state of each connected back-end server.

func (*StakepooldManager) CreateMultisig

func (s *StakepooldManager) CreateMultisig(address []string) (*pb.CreateMultisigResponse, error)

CreateMultisig performs gRPC CreateMultisig on all servers. It stops executing and returns an error if any RPC call fails. It will also return an error if any of the responses are different. This should be considered fatal, as it indicates that a voting wallet is misconfigured

func (*StakepooldManager) CrossCheckColdWalletExtPubs

func (s *StakepooldManager) CrossCheckColdWalletExtPubs(dcrstakepoolColdWalletExtPub string) error

CrossCheckColdWalletExtPubs calls GetColdWalletExtPub RPC on all stakepoold instances and compares the returned `coldwalletextpub` value against the value set in dcrstakepool's config. Returns an error if an RPC call to any of the backend clients errors or if any returned `coldwalletextpub` value is not the same as dcrstakepool's.

func (*StakepooldManager) GetAddedLowFeeTickets

func (s *StakepooldManager) GetAddedLowFeeTickets() (map[chainhash.Hash]string, error)

GetAddedLowFeeTickets performs gRPC GetAddedLowFeeTickets requests against all stakepoold instances and returns the first result fetched without errors. Returns an error if all RPC requests fail.

func (*StakepooldManager) GetIgnoredLowFeeTickets

func (s *StakepooldManager) GetIgnoredLowFeeTickets() (map[chainhash.Hash]string, error)

GetIgnoredLowFeeTickets performs gRPC GetIgnoredLowFeeTickets requests against all stakepoold instances and returns the first result fetched without errors. Returns an error if all RPC requests fail.

func (*StakepooldManager) GetLiveTickets

func (s *StakepooldManager) GetLiveTickets() (map[chainhash.Hash]string, error)

GetLiveTickets performs gRPC GetLiveTickets requests against all stakepoold instances and returns the first result fetched without errors. Returns an error if all RPC requests fail.

func (*StakepooldManager) GetStakeInfo

func (s *StakepooldManager) GetStakeInfo() (*pb.GetStakeInfoResponse, error)

GetStakeInfo returns cached stake info if within cachedStakeInfoTimer limit from last cache. Otherwise it calls GetStakeInfo RPC on all stakepoold instances until receiving a response. The response is cached. Returns an error if all RPC calls fail.

func (*StakepooldManager) ImportNewScript

func (s *StakepooldManager) ImportNewScript(script []byte) (heightImported int64, err error)

ImportNewScript calls ImportNewScript RPC on all stakepoold instances. It stops executing and returns an error if any RPC call fails. Because this is a new script, no rescan is necessary.

func (*StakepooldManager) SetAddedLowFeeTickets

func (s *StakepooldManager) SetAddedLowFeeTickets(dbTickets []models.LowFeeTicket) error

SetAddedLowFeeTickets calls SetAddedLowFeeTickets RPC on all stakepoold instances. It stops executing and returns an error if any RPC call fails

func (*StakepooldManager) SetUserVotingPrefs

func (s *StakepooldManager) SetUserVotingPrefs(dbUsers map[int64]*models.User) error

SetUserVotingPrefs performs gRPC SetUserVotingPrefs. It stops executing and returns an error if any RPC call fails

func (*StakepooldManager) StakePoolUserInfo

func (s *StakepooldManager) StakePoolUserInfo(multiSigAddress string) (*pb.StakePoolUserInfoResponse, error)

StakePoolUserInfo performs gRPC StakePoolUserInfo. It sends requests to instances of stakepoold and returns the first successful response. Returns an error if RPC to all instances of stakepoold fail

func (*StakepooldManager) SyncAll

func (s *StakepooldManager) SyncAll(multiSigScripts []models.User, maxUsers int64) error

SyncAll ensures that the wallet servers are all in sync with each other in terms of tickets, redeem scripts and address indexes.

func (*StakepooldManager) ValidateAddress

func (s *StakepooldManager) ValidateAddress(addr dcrutil.Address) (*pb.ValidateAddressResponse, error)

ValidateAddress calls ValidateAddress RPC on all stakepoold servers. Returns an error if responses are not the same from all stakepoold instances.

func (*StakepooldManager) WalletInfo

func (s *StakepooldManager) WalletInfo() ([]*pb.WalletInfoResponse, error)

WalletInfo calls WalletInfo RPC on all stakepoold instances. It stops executing and returns an error if any RPC call fails

type WalletStatus

type WalletStatus struct {
	DaemonConnected bool
	VoteVersion     uint32
	Unlocked        bool
	Voting          bool
}