MCPcopy Create free account
hub / github.com/chain/txvm / Chain

Struct Chain

protocol/protocol.go:113–127  ·  view source on GitHub ↗

Chain provides a complete, minimal blockchain database. It delegates the underlying storage to other objects, and uses validation logic from package validation to decide what objects can be safely stored.

Source from the content-addressed store, hash-verified

111// validation logic from package validation to decide what
112// objects can be safely stored.
113type Chain struct {
114 InitialBlockHash bc.Hash
115 bb *BlockBuilder
116
117 state struct {
118 cond sync.Cond // protects height, block, snapshot
119 height uint64
120 snapshot *state.Snapshot // current only if leader
121 }
122 store Store
123
124 lastQueuedSnapshotHeight uint64 // atomic access only
125 blocksPerSnapshot uint64
126 pendingSnapshots chan *state.Snapshot
127}
128
129// NewChain returns a new Chain using store as the underlying storage.
130func NewChain(ctx context.Context, initialBlock *bc.Block, store Store, heights <-chan uint64) (*Chain, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected