Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ type Storage interface {
Index(ctx context.Context, block VerifiedBlock, certificate Finalization) error
}

type FullStorage interface {
FullBlockRetriever
NumBlocks() uint64
Index(ctx context.Context, block FullBlock, certificate Finalization) error
}

type FullBlockRetriever interface {
// Retrieve returns the block and finalization at [seq].
// If [seq] the block cannot be found, returns ErrBlockNotFound.
Retrieve(seq uint64) (FullBlock, Finalization, error)
}

type Communication interface {
// Nodes returns all nodes that participate in the epoch.
Nodes() Nodes
Expand Down Expand Up @@ -92,6 +104,12 @@ type Block interface {
Verify(ctx context.Context) (VerifiedBlock, error)
}

// Created temporarily to avoid the massive circular
type SealingBlockInfo struct {
Epoch uint64
PChainHeight uint64
}

type VerifiedBlock interface {
// BlockHeader encodes a succinct and collision-free representation of a block.
BlockHeader() BlockHeader
Expand All @@ -100,6 +118,14 @@ type VerifiedBlock interface {

// Bytes returns a byte encoding of the block
Bytes() ([]byte, error)

SealingBlockInfo() *SealingBlockInfo
}

// Contains all functions on the block
type FullBlock interface {
VerifiedBlock
Block
}

// BlockDeserializer deserializes blocks according to formatting
Expand Down
Loading
Loading