generator

package
v0.0.0-...-4e0ae02 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2016 License: AGPL-3.0 Imports: 15 Imported by: 0

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.

Jump to

Keyboard shortcuts

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