blocksigner

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: 9 Imported by: 0

Documentation

Overview

Package blocksigner implements remote block signing.

Index

Constants

This section is empty.

Variables

View Source
var ErrConsensusChange = errors.New("consensus program has changed")

ErrConsensusChange is returned from ValidateAndSignBlock when a new consensus program is detected.

View Source
var ErrInvalidKey = errors.New("misconfigured signer public key")

ErrInvalidKey is returned from SignBlock when the key specified on the Signer is invalid. It may be not found by the mock HSM or not paired to a valid private key.

Functions

This section is empty.

Types

type Signer

type Signer struct {
	Pub ed25519.PublicKey
	// contains filtered or unexported fields
}

Signer validates and signs blocks.

func New

func New(pub ed25519.PublicKey, hsm *mockhsm.HSM, db pg.DB, c *protocol.Chain) *Signer

New returns a new Signer that validates blocks with c and signs them with k.

func (*Signer) SignBlock

func (s *Signer) SignBlock(ctx context.Context, b *bc.Block) ([]byte, error)

SignBlock computes the signature for the block using the private key in s. It does not validate the block.

func (*Signer) String

func (s *Signer) String() string

func (*Signer) ValidateAndSignBlock

func (s *Signer) ValidateAndSignBlock(ctx context.Context, b *bc.Block) ([]byte, error)

ValidateAndSignBlock validates the given block against the current blockchain and, if valid, computes and returns a signature for the block. It is used as the httpjson handler for /rpc/signer/sign-block.

This function fails if this node has ever signed a different block at the same height as b.

Jump to

Keyboard shortcuts

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