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

Method setHeight

protocol/block.go:206–222  ·  view source on GitHub ↗
(h uint64)

Source from the content-addressed store, hash-verified

204}
205
206func (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

Callers 2

NewChainFunction · 0.95
TestNoTimeTravelFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestNoTimeTravelFunction · 0.76