Documentation ¶
Overview ¶
Package config manages persistent configuration data for Chain Core.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadGenerator = errors.New("generator returned an unsuccessful response") ErrBadSignerURL = errors.New("block signer URL is invalid") ErrBadSignerPubkey = errors.New("block signer pubkey is invalid") ErrBadQuorum = errors.New("quorum must be greater than 0 if there are signers") )
Functions ¶
func Configure ¶
Configure configures the core by writing to the database. If running in a cored process, the caller must ensure that the new configuration is properly reloaded, for example by restarting the process.
If c.IsSigner is true, Configure generates a new mockhsm keypair for signing blocks, and assigns it to c.BlockPub.
If c.IsGenerator is true, Configure creates an initial block, saves it, and assigns its hash to c.BlockchainID. Otherwise, c.IsGenerator is false, and Configure makes a test request to GeneratorURL to detect simple configuration mistakes.
Types ¶
type BlockSigner ¶
type Config ¶
type Config struct { ID string `json:"id"` IsSigner bool `json:"is_signer"` IsGenerator bool `json:"is_generator"` BlockchainID bc.Hash `json:"blockchain_id"` GeneratorURL string `json:"generator_url"` GeneratorAccessToken string `json:"generator_access_token"` ConfiguredAt time.Time BlockPub string `json:"block_pub"` Signers []BlockSigner `json:"block_signer_urls"` Quorum int MaxIssuanceWindow time.Duration }
Config encapsulates Core-level, persistent configuration options.