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

Method BlockWaiter

protocol/protocol.go:230–242  ·  view source on GitHub ↗

BlockWaiter returns a channel that waits for the block at the given height.

(height uint64)

Source from the content-addressed store, hash-verified

228// BlockWaiter returns a channel that
229// waits for the block at the given height.
230func (c *Chain) BlockWaiter(height uint64) <-chan struct{} {
231 ch := make(chan struct{}, 1)
232 go func() {
233 c.state.cond.L.Lock()
234 defer c.state.cond.L.Unlock()
235 for c.state.height < height {
236 c.state.cond.Wait()
237 }
238 ch <- struct{}{}
239 }()
240
241 return ch
242}

Callers 1

TestNewChainHeightFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestNewChainHeightFunction · 0.76