Documentation
¶
Overview ¶
Package rewards pkg/deployment/rewards/config.go c4-app-rewards handler. It can be used standalone (via the CLI) or embedded in the visor's port 80 router for integrated DMSG/skynet access.
Package rewards pkg/deployment/rewards/server.go c4-app-rewards
Index ¶
Constants ¶
const XpubIndexFile = "xpub_index.json"
XpubIndexFile sits in the reward system's working directory, outside the served hist dir.
Variables ¶
This section is empty.
Functions ¶
func IsWhitelisted ¶
IsWhitelisted checks if the current request is from a whitelisted PK without blocking. Used for UI rendering (show/hide links).
func NodeAddressUsed ¶
NodeAddressUsed reports whether an address has ever received coins, using a skycoin node API.
func RemotePK ¶
RemotePK returns the DMSG-authenticated source public key of the current request (from RemoteAddr), or a null key if it can't be parsed. Exported for handlers that must attribute a request to its sender — e.g. the survey-push endpoint stores a pushed survey under the sender's own PK so a visor can only write its own.
Types ¶
type Config ¶
type Config struct {
// StartTime is when the server started (for /health uptime).
StartTime time.Time
// PK and SK for DMSG client (only needed for standalone mode).
PK cipher.PubKey
SK cipher.SecKey
// DmsgDisc is the DMSG discovery URL (standalone mode).
DmsgDisc string
// DmsgPort is the DMSG port to serve on (standalone mode).
DmsgPort uint16
// DmsgSessions is the number of DMSG sessions (standalone mode).
DmsgSessions int
// WebPort is the HTTP port (standalone mode).
WebPort uint
// WhitelistPKs is the list of PKs allowed to POST reward
// transactions and access protected endpoints.
WhitelistPKs []cipher.PubKey
// WorkDir is the directory containing log_collection and reward
// hist directories.
WorkDir string
// CanonicalDomain is the public domain name for SEO/sitemap
// (e.g., "theskywirenetwork.net").
CanonicalDomain string
// HealthOnly disables all endpoints except /health.
HealthOnly bool
// EnsureOnlineURL is the URL to check for internet connectivity.
EnsureOnlineURL string
// LoginNode is the address of the login chain node.
LoginNode string
// SkycoinNode is the address of the skycoin node for tx broadcast.
SkycoinNode string
// LoginChainFlags is additional flags for login chain.
LoginChainFlags string
// Logger for the reward system.
Log *logging.Logger
}
Config holds all the configuration needed to run the reward system UI.
type XpubIndex ¶
type XpubIndex struct {
// contains filtered or unexported fields
}
XpubIndex records the external chain index paid to each xpub for each reward date, so no address is paid twice. Keys are SHA-256 hashes, so the xpubs are not stored.
func LoadXpubIndex ¶
LoadXpubIndex reads the record at path. A missing file is an empty record.