(h uint64)
| 204 | } |
| 205 | |
| 206 | func (c *Chain) setHeight(h uint64) { |
| 207 | // We call setHeight from two places independently: |
| 208 | // CommitBlock and the Postgres LISTEN goroutine. |
| 209 | // This means we can get here twice for each block, |
| 210 | // and any of them might be arbitrarily delayed, |
| 211 | // which means h might be from the past. |
| 212 | // Detect and discard these duplicate calls. |
| 213 | |
| 214 | c.state.cond.L.Lock() |
| 215 | defer c.state.cond.L.Unlock() |
| 216 | |
| 217 | if h <= c.state.height { |
| 218 | return |
| 219 | } |
| 220 | c.state.height = h |
| 221 | c.state.cond.Broadcast() |
| 222 | } |
| 223 | |
| 224 | // ValidateBlockForSig performs validation on an incoming _unsigned_ |
| 225 | // block in preparation for signing it. By definition it does not |
no outgoing calls