MCPcopy Index your code
hub / github.com/chain/Core / BlockWaiter

Method BlockWaiter

protocol/protocol.go:209–221  ·  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

207// BlockWaiter returns a channel that
208// waits for the block at the given height.
209func (c *Chain) BlockWaiter(height uint64) <-chan struct{} {
210 ch := make(chan struct{}, 1)
211 go func() {
212 c.state.cond.L.Lock()
213 defer c.state.cond.L.Unlock()
214 for c.state.height < height {
215 c.state.cond.Wait()
216 }
217 ch <- struct{}{}
218 }()
219
220 return ch
221}

Callers 6

BlockSoonWaiterMethod · 0.95
TestGeneratorRecoveryFunction · 0.95
waitForTxInBlockMethod · 0.80
ProcessBlocksMethod · 0.80
FinalizeTxFunction · 0.80

Calls 1

WaitMethod · 0.80

Tested by 2

TestGeneratorRecoveryFunction · 0.76