(ctx context.Context, s *state.Snapshot)
| 122 | } |
| 123 | |
| 124 | func (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. |
no test coverage detected