Versions in this module Expand all Collapse all v0 v0.2.0 Mar 13, 2019 v0.1.0 Jul 23, 2018 Changes in this version + var ErrFaultyEngine = errors.New("unknown error: engine must be faulty") + var ErrProcessingFailed = errors.New("processing failed") + var ErrRejected = errors.New("rejected") + func NewDummyGossip(t *testing.T) gossip.Gossip + func NewDummyP2P(t *testing.T) p2p.P2P + func NewSimpleState(t *testing.T, opts ...state.Opt) state.State + type DummyEngine struct + func (e *DummyEngine) Finalize(ctx context.Context, chain chain.Reader, header *pb.Header, state state.Reader, ...) (*pb.Block, error) + func (e *DummyEngine) Prepare(chain chain.Reader, header *pb.Header) error + func (e *DummyEngine) VerifyHeader(chain chain.Reader, header *pb.Header) error + type DummyPoW struct + func NewDummyPoW(e engine.Engine, difficulty, reward uint64) *DummyPoW + func (e *DummyPoW) Difficulty() uint64 + func (e *DummyPoW) DifficultyCount() uint32 + func (e *DummyPoW) Reward() uint64 + type DummyProcessor struct + func (p *DummyProcessor) Process(ctx context.Context, block *pb.Block, state state.State, chain chain.Chain) error + type DummyProofOfWait struct + func NewDummyProofOfWait(e engine.Engine, min, max int) *DummyProofOfWait + func (e *DummyProofOfWait) Interval() (int, int) + func (e *DummyProofOfWait) IntervalCount() uint32 + type DummyValidator struct + func (v *DummyValidator) MaxTxPerBlock() uint32 + func (v *DummyValidator) ValidateBlock(block *pb.Block, _ state.Reader) error + func (v *DummyValidator) ValidateTransactions(transactions []*pb.Transaction, _ state.Reader) error + func (v *DummyValidator) ValidateTx(tx *pb.Transaction, state state.Reader) error + type FaultyEngine struct + func (e *FaultyEngine) Finalize(ctx context.Context, chain chain.Reader, header *pb.Header, state state.Reader, ...) (*pb.Block, error) + func (e *FaultyEngine) Prepare(chain chain.Reader, header *pb.Header) error + func (e *FaultyEngine) VerifyHeader(chain chain.Reader, header *pb.Header) error + type FaultyProcessor struct + func (p *FaultyProcessor) Process(ctx context.Context, block *pb.Block, state state.State, chain chain.Chain) error + type HeaderMatcher struct + func NewHeaderMatcher(expectedHeader *pb.Header) HeaderMatcher + func (m HeaderMatcher) Matches(x interface{}) bool + func (m HeaderMatcher) String() string + type InMemoryTxPool struct + func (m *InMemoryTxPool) AddTransaction(tx *pb.Transaction) error + func (m *InMemoryTxPool) Contains(tx *pb.Transaction) bool + func (m *InMemoryTxPool) Peek(n uint32) []*pb.Transaction + func (m *InMemoryTxPool) Pending() uint64 + func (m *InMemoryTxPool) PopCount() uint32 + func (m *InMemoryTxPool) PopTransaction() *pb.Transaction + func (m *InMemoryTxPool) TxCount() int + type InstrumentedEngine struct + func NewInstrumentedEngine(e engine.Engine) *InstrumentedEngine + func (e *InstrumentedEngine) Finalize(ctx context.Context, chain chain.Reader, header *pb.Header, state state.Reader, ...) (*pb.Block, error) + func (e *InstrumentedEngine) FinalizeCount() uint32 + func (e *InstrumentedEngine) Prepare(chain chain.Reader, header *pb.Header) error + func (e *InstrumentedEngine) PrepareCount() uint32 + func (e *InstrumentedEngine) VerifiedHeader(header *pb.Header) bool + func (e *InstrumentedEngine) VerifyCount() uint32 + func (e *InstrumentedEngine) VerifyHeader(chain chain.Reader, header *pb.Header) error + type InstrumentedProcessor struct + func NewInstrumentedProcessor(p processor.Processor) *InstrumentedProcessor + func (p *InstrumentedProcessor) Process(ctx context.Context, block *pb.Block, state state.State, chain chain.Chain) error + func (p *InstrumentedProcessor) ProcessedCount() uint32 + type InstrumentedValidator struct + func NewInstrumentedValidator(validator validator.Validator) *InstrumentedValidator + func (r *InstrumentedValidator) MaxTxPerBlock() uint32 + func (r *InstrumentedValidator) ValidateBlock(block *pb.Block, state state.Reader) error + func (r *InstrumentedValidator) ValidateTransactions(transactions []*pb.Transaction, state state.Reader) error + func (r *InstrumentedValidator) ValidateTx(tx *pb.Transaction, state state.Reader) error + func (r *InstrumentedValidator) ValidatedBlock(block *pb.Block) bool + func (r *InstrumentedValidator) ValidatedTx(tx *pb.Transaction) bool + type Rejector struct + func (r *Rejector) MaxTxPerBlock() uint32 + func (r *Rejector) ValidateBlock(block *pb.Block, _ state.Reader) error + func (r *Rejector) ValidateTransactions(transactions []*pb.Transaction, _ state.Reader) error + func (r *Rejector) ValidateTx(tx *pb.Transaction, state state.Reader) error + type SimpleChain struct + func (c *SimpleChain) AddBlock(block *pb.Block) error + func (c *SimpleChain) Config() *chain.Config + func (c *SimpleChain) CurrentBlock() (*pb.Block, error) + func (c *SimpleChain) CurrentHeader() (*pb.Header, error) + func (c *SimpleChain) GetBlock(hash []byte, _ uint64) (*pb.Block, error) + func (c *SimpleChain) GetBlockByHash(hash []byte) (*pb.Block, error) + func (c *SimpleChain) GetBlockByNumber(number uint64) (*pb.Block, error) + func (c *SimpleChain) GetHeaderByHash(hash []byte) (*pb.Header, error) + func (c *SimpleChain) GetHeaderByNumber(number uint64) (*pb.Header, error) + func (c *SimpleChain) GetHeadersByNumber(number uint64) ([]*pb.Header, error) + func (c *SimpleChain) GetParentBlock(header *pb.Header) (*pb.Block, error) + func (c *SimpleChain) SetHead(block *pb.Block) error + type TxMatcher struct + func NewTxMatcher(expectedTx *pb.Transaction) TxMatcher + func (m TxMatcher) Matches(x interface{}) bool + func (m TxMatcher) String() string