daemon

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2019 License: ISC Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrHelpRequested is the error returned when the help option was requested
	// on the command line
	ErrHelpRequested = fmt.Errorf("help requested")

	// ErrVersionRequested is the error returned when the version command line
	// option was requested
	ErrVersionRequested = fmt.Errorf("version requested")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	ConfigFile string `short:"C" long:"configfile" description:"Path to config file"`

	Port                  int    `long:"port" description:"Port to run the service on"`
	WaitingListWSBindAddr string `` /* 129-byte string literal not displayed */
	LogLevel              slog.Level
	LogLevelName          string `long:"loglevel" description:"Log Level (CRITICAL, ERROR, WARNING, INFO, DEBUG, TRACE)"`
	LogDir                string `long:"logdir" description:"Location to save log files."`
	KeyFile               string `long:"keyfile" description:"Location of the rpc.key file (private key for the TLS certificate)."`
	CertFile              string `long:"certfile" description:"Location of the rpc.cert file (TLS certificate)."`
	SplitPoolSignKey      string `long:"splitpoolsignkey" description:"WIF private key for signing the split -> ticket intermediate pool fee txo"`
	DataDir               string `long:"datadir" description:"Dir where session and other data will be saved"`
	ShowVersion           bool   `long:"version" description:"Show version and quit"`

	TestNet  bool   `long:"testnet" description:"Whether this is connecting to a testnet wallet/matcher service"`
	SimNet   bool   `long:"simnet" description:"Whether this is connecting to a simnet wallet"`
	DcrdHost string `long:"dcrdhost" description:"Address of the dcrd daemon"`
	DcrdUser string `long:"dcrduser" description:"Username of the rpc connection to dcrd"`
	DcrdPass string `long:"dcrdpass" description:"Password of the rpc connection to dcrd"`
	DcrdCert string `long:"dcrdcert" description:"Location of the rpc.cert file of dcrd"`

	DcrwHost string `long:"dcrwhost" description:"Address of the dcrwallet daemon"`
	DcrwUser string `long:"dcrwuser" description:"Username of the rpc connection to dcrwallet"`
	DcrwPass string `long:"dcrwpass" description:"Password of the rpc connection to dcrwallet"`
	DcrwCert string `long:"dcrwcert" description:"Location of the rpc.cert file of dcrwallet"`

	MinAmount                   float64       `long:"minamount" description:"Minimum amount to participate on a split ticket (in DCR)"`
	MaxSessionDuration          time.Duration `long:"maxsessionduration" description:"Maximum number of seconds a session may take before being automatically closed"`
	StakeDiffChangeStopWindow   int32         `` /* 135-byte string literal not displayed */
	PublishTransactions         bool          `long:"publishtransactions" description:"Whether to actually publish transactions of successful sessions"`
	ValidateVoteAddressOnWallet bool          `long:"validatevoteaddressonwallet" description:"Whether to validate the vote addresses of participants on the wallet"`
	PoolSubsidyWalletMasterPub  string        `` /* 246-byte string literal not displayed */
	PoolFee                     float64       `long:"poolfee" description:"Pool fee as a percentage (eg: 5.0 = 5%)"`

	StakepooldIntegratorHost string `long:"stakepooldintegratorhost" description:"Host to connect to for stakepoold validation"`
	StakepooldIntegratorCert string `long:"stakepooldintegratorcert" description:"Certificate to use when connecting the stakepool integrator host"`

	AllowPublicSession bool `long:"allowpublicsession" description:"Whether to allow sessions with an empty name (public sessions) in the matcher."`

	KeepAliveTime    time.Duration `` /* 133-byte string literal not displayed */
	KeepAliveTimeout time.Duration `long:"keepalivetimeout" description:"Time duration to wait for a reply after a keepalive ping has been sent"`

	SuccessfulSessionCmd string `` /* 162-byte string literal not displayed */
	// contains filtered or unexported fields
}

Config stores the config needed to run an instance of the dcr split ticket matcher daemon

func LoadConfig added in v0.1.2

func LoadConfig() (*Config, error)

LoadConfig loads the daemon config from the local config file.

type Daemon

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

Daemon is the main instance of a running dcr split ticket matcher daemon

func NewDaemon

func NewDaemon(cfg *Config) (*Daemon, error)

NewDaemon returns a new daemon instance and prepares it to listen to requests.

func (*Daemon) Run added in v0.6.0

func (daemon *Daemon) Run(serverCtx context.Context) error

Run the grpc server matcher and all associated connections as goroutines. Returns immediately with a nil error in case of success.

type SplitTicketMatcherService

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

SplitTicketMatcherService implements the methods required to accept split ticket session commands from a grpc service.

func NewSplitTicketMatcherService

func NewSplitTicketMatcherService(matcher *matcher.Matcher,
	networkProvider matcher.NetworkProvider, allowPublicSession bool,
	log slog.Logger) *SplitTicketMatcherService

NewSplitTicketMatcherService creates a new instance of a service, given all required options.

func (*SplitTicketMatcherService) BuyerError added in v0.7.0

BuyerError fulfills SplitTicketMatcherServiceServer

func (*SplitTicketMatcherService) FindMatches

FindMatches fulfills SplitTicketMatcherServiceServer

func (*SplitTicketMatcherService) FundSplitTx

FundSplitTx fulfills SplitTicketMatcherServiceServer

func (*SplitTicketMatcherService) FundTicket

FundTicket fulfills SplitTicketMatcherServiceServer

func (*SplitTicketMatcherService) GenerateTicket

GenerateTicket fulfills SplitTicketMatcherServiceServer

func (*SplitTicketMatcherService) Status

Status fulfills SplitTicketMatcherServiceServer

func (*SplitTicketMatcherService) WatchWaitingList

WatchWaitingList fulfills SplitTicketMatcherServiceServer

type WalletClient

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

WalletClient is responsible for the interactions between the matcher service and the wallet it requires.

func ConnectToDcrWallet added in v0.1.2

func ConnectToDcrWallet(cfg *WalletConfig) (
	*WalletClient, error)

ConnectToDcrWallet tries to connect to the given wallet.

func (*WalletClient) PoolFeeAddress

func (wallet *WalletClient) PoolFeeAddress() dcrutil.Address

PoolFeeAddress returns the address to use when moving funds into the utxo of the split tx that will be used to fund the pool fee input of the ticket.

func (*WalletClient) Run added in v0.6.0

func (wallet *WalletClient) Run(serverCtx context.Context)

Run runs until serverCtx.Done is emited, then shuts down the wallet

func (*WalletClient) SignPoolSplitOutput

func (wallet *WalletClient) SignPoolSplitOutput(split, ticket *wire.MsgTx) ([]byte, error)

SignPoolSplitOutput signs the pool fee input of the ticket with the key associated with PoolFeeAddress().

func (*WalletClient) ValidateVoteAddress added in v0.5.0

func (wallet *WalletClient) ValidateVoteAddress(voteAddr dcrutil.Address) error

ValidateVoteAddress checks whether the connected wallet can sign transactions with the provided addresses

type WalletConfig added in v0.1.2

type WalletConfig struct {
	Host     string
	User     string
	Pass     string
	CertFile string

	Log slog.Logger
}

WalletConfig is the required config options to connect to a dcrwallet that the service needs.

Jump to

Keyboard shortcuts

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