Documentation ¶
Overview ¶
Package generator implements the Chain Core generator.
A Chain Core configured as a generator produces new blocks on an interval.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
func Generate( ctx context.Context, c *protocol.Chain, s []BlockSigner, db pg.DB, period time.Duration, health func(error), )
Generate runs in a loop, making one new block every block period. It returns when its context is canceled. After each attempt to make a block, it calls health to report either an error or nil to indicate success.
Types ¶
type BlockSigner ¶
type BlockSigner interface { // SignBlock returns an ed25519 signature over the block's sighash. // See also the Chain Protocol spec for the complete required behavior // of a block signer. SignBlock(context.Context, *bc.Block) (signature []byte, err error) }
A BlockSigner signs blocks.
Click to show internal directories.
Click to hide internal directories.