Documentation
¶
Overview ¶
Package stakepool holds the Stakepool struct and processes incomming commands and notifications.
Index ¶
- func DisableLog()
- func MsgTxFromHex(txhex string) (*wire.MsgTx, error)
- func UseLogger(logger slog.Logger)
- type Client
- type NewTicketsForBlock
- type SpentMissedTicketsForBlock
- type Stakepoold
- func (spd *Stakepoold) AccountSyncAddressIndex(account string, branch uint32, index int) error
- func (spd *Stakepoold) AddMissingTicket(ticketHash []byte) error
- func (spd *Stakepoold) CreateMultisig(addresses []string) (*wallettypes.CreateMultiSigResult, error)
- func (spd *Stakepoold) EvaluateStakePoolTicket(tx *wire.MsgTx, blockHeight int32) (bool, error)
- func (spd *Stakepoold) GetStakeInfo() (*wallettypes.GetStakeInfoResult, error)
- func (spd *Stakepoold) GetTickets(includeImmature bool) ([]*chainhash.Hash, error)
- func (spd *Stakepoold) ImportMissingScripts(scripts [][]byte, rescanHeight int) error
- func (spd *Stakepoold) ImportNewScript(script []byte) (int64, error)
- func (spd *Stakepoold) ListScripts() ([][]byte, error)
- func (spd *Stakepoold) NewTicketHandler(ctx context.Context, wg *sync.WaitGroup)
- func (spd *Stakepoold) ProcessWinningTickets(wt WinningTicketsForBlock)
- func (spd *Stakepoold) SpentmissedTicketHandler(ctx context.Context, wg *sync.WaitGroup)
- func (spd *Stakepoold) StakePoolUserInfo(multisigAddress string) (*wallettypes.StakePoolUserInfoResult, error)
- func (spd *Stakepoold) UpdateTicketData(newAddedLowFeeTicketsMSA map[chainhash.Hash]string)
- func (spd *Stakepoold) UpdateTicketDataFromMySQL() error
- func (spd *Stakepoold) UpdateUserData(newUserVotingConfig map[string]userdata.UserVotingConfig)
- func (spd *Stakepoold) UpdateUserDataFromMySQL() error
- func (spd *Stakepoold) ValidateAddress(address string) (*wallettypes.ValidateAddressWalletResult, error)
- func (spd *Stakepoold) WalletInfo() (*wallettypes.WalletInfoResult, error)
- func (spd *Stakepoold) WinningTicketHandler(ctx context.Context, wg *sync.WaitGroup)
- type VotingConfig
- type WinningTicketsForBlock
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 MsgTxFromHex ¶
MsgTxFromHex returns a wire.MsgTx struct built from the transaction hex string
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds the information related to an rpcclient and handles access to that client through a mutex.
It should be noted that this is a temporary fix to the problem that rpcclient does not return an error when autoreconnect is turned on but the client is disconnected. The permanent solution is to change the behaviour of rpccleint. TODO: Remove this file.
func NewClient ¶
func NewClient(ctx context.Context, wg *sync.WaitGroup, cfg *rpcclient.ConnConfig, ntfnHandlers *rpcclient.NotificationHandlers) (*Client, error)
NewClient creates a new Client and starts the automatic reconnection handler. Returns an error if unable to construct a new rpcclient.
func (*Client) Connected ¶
func (c *Client) Connected() <-chan struct{}
Connected returns a receiving copy of the current connected channel. If disconnected and the channel is not yet blocking, creates a new channel that will be closed on a successful reconnect.
func (*Client) IsConnected ¶
IsConnected checks and returns whethere the client is currently connected.
type NewTicketsForBlock ¶
type Stakepoold ¶
type Stakepoold struct { sync.RWMutex // locking required AddedLowFeeTicketsMSA map[chainhash.Hash]string // [ticket]multisigaddr IgnoredLowFeeTicketsMSA map[chainhash.Hash]string // [ticket]multisigaddr LiveTicketsMSA map[chainhash.Hash]string // [ticket]multisigaddr UserVotingConfig map[string]userdata.UserVotingConfig // [multisigaddr] // no locking required DataPath string ColdWalletExtPub string FeeAddrs map[string]struct{} PoolFees float64 NewTicketsChan chan NewTicketsForBlock NodeConnection *rpcclient.Client Params *chaincfg.Params SpentmissedTicketsChan chan SpentMissedTicketsForBlock UserData *userdata.UserData VotingConfig *VotingConfig WalletConnection *Client WinningTicketsChan chan WinningTicketsForBlock Testing bool // enabled only for testing }
func (*Stakepoold) AccountSyncAddressIndex ¶
func (spd *Stakepoold) AccountSyncAddressIndex(account string, branch uint32, index int) error
func (*Stakepoold) AddMissingTicket ¶
func (spd *Stakepoold) AddMissingTicket(ticketHash []byte) error
func (*Stakepoold) CreateMultisig ¶
func (spd *Stakepoold) CreateMultisig(addresses []string) (*wallettypes.CreateMultiSigResult, error)
CreateMultisig decodes the provided array of addresses, and then passes them to eacrwallet to create a 1-of-N multisig address.
func (*Stakepoold) EvaluateStakePoolTicket ¶
EvaluateStakePoolTicket evaluates a voting service ticket to see if it's acceptable to the voting service. The ticket must pay out to the voting service cold wallet, and must have a sufficient fee.
func (*Stakepoold) GetStakeInfo ¶
func (spd *Stakepoold) GetStakeInfo() (*wallettypes.GetStakeInfoResult, error)
GetStakeInfo performs the rpc command GetStakeInfo.
func (*Stakepoold) GetTickets ¶
func (spd *Stakepoold) GetTickets(includeImmature bool) ([]*chainhash.Hash, error)
func (*Stakepoold) ImportMissingScripts ¶
func (spd *Stakepoold) ImportMissingScripts(scripts [][]byte, rescanHeight int) error
ImportMissingScripts accepts a list of redeem scripts and a rescan height. It will import all but one of the scripts without triggering a wallet rescan, and finally trigger a rescan from the provided height after importing the last one.
func (*Stakepoold) ImportNewScript ¶
func (spd *Stakepoold) ImportNewScript(script []byte) (int64, error)
ImportNewScript will import a redeem script into eacrwallet. No rescan is performed because we are importing a brand new script, it shouldn't have any associated history. Current block height is returned to indicate which height the new user has registered.
func (*Stakepoold) ListScripts ¶
func (spd *Stakepoold) ListScripts() ([][]byte, error)
func (*Stakepoold) NewTicketHandler ¶
func (spd *Stakepoold) NewTicketHandler(ctx context.Context, wg *sync.WaitGroup)
func (*Stakepoold) ProcessWinningTickets ¶
func (spd *Stakepoold) ProcessWinningTickets(wt WinningTicketsForBlock)
ProcessWinningTickets is called every time a new block comes in to handle voting. The function requires ASAP processing for each vote and therefore it is not sequential and hard to read. This is unfortunate but a reality of speeding up code.
func (*Stakepoold) SpentmissedTicketHandler ¶
func (spd *Stakepoold) SpentmissedTicketHandler(ctx context.Context, wg *sync.WaitGroup)
func (*Stakepoold) StakePoolUserInfo ¶
func (spd *Stakepoold) StakePoolUserInfo(multisigAddress string) (*wallettypes.StakePoolUserInfoResult, error)
func (*Stakepoold) UpdateTicketData ¶
func (spd *Stakepoold) UpdateTicketData(newAddedLowFeeTicketsMSA map[chainhash.Hash]string)
func (*Stakepoold) UpdateTicketDataFromMySQL ¶
func (spd *Stakepoold) UpdateTicketDataFromMySQL() error
func (*Stakepoold) UpdateUserData ¶
func (spd *Stakepoold) UpdateUserData(newUserVotingConfig map[string]userdata.UserVotingConfig)
func (*Stakepoold) UpdateUserDataFromMySQL ¶
func (spd *Stakepoold) UpdateUserDataFromMySQL() error
func (*Stakepoold) ValidateAddress ¶
func (spd *Stakepoold) ValidateAddress(address string) (*wallettypes.ValidateAddressWalletResult, error)
func (*Stakepoold) WalletInfo ¶
func (spd *Stakepoold) WalletInfo() (*wallettypes.WalletInfoResult, error)
func (*Stakepoold) WinningTicketHandler ¶
func (spd *Stakepoold) WinningTicketHandler(ctx context.Context, wg *sync.WaitGroup)
type VotingConfig ¶
VotingConfig contains global voting defaults.