BlockWaiter returns a channel that waits for the block at the given height.
(height uint64)
| 228 | // BlockWaiter returns a channel that |
| 229 | // waits for the block at the given height. |
| 230 | func (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 | } |
no outgoing calls