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

Method queueSnapshot

protocol/block.go:124–135  ·  view source on GitHub ↗
(ctx context.Context, s *state.Snapshot)

Source from the content-addressed store, hash-verified

122}
123
124func (c *Chain) queueSnapshot(ctx context.Context, s *state.Snapshot) {
125 // Non-blockingly queue the snapshot for storage.
126 select {
127 case c.pendingSnapshots <- s:
128 atomic.StoreUint64(&c.lastQueuedSnapshotHeight, s.Height())
129 default:
130 // Skip it; saving snapshots is taking longer than the snapshotting period.
131 lastQueuedHeight := atomic.LoadUint64(&c.lastQueuedSnapshotHeight)
132 log.Printf(ctx, "snapshot storage is taking too long; %d blocks since last snapshot queued",
133 s.Height()-lastQueuedHeight)
134 }
135}
136
137// NewInitialBlock produces the first block for a new blockchain,
138// using the given pubkeys and quorum for its NextPredicate.

Callers 1

finalizeCommitStateMethod · 0.95

Calls 2

HeightMethod · 0.95
PrintfFunction · 0.92

Tested by

no test coverage detected