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

Method setState

protocol/protocol.go:195–210  ·  view source on GitHub ↗
(s *state.Snapshot)

Source from the content-addressed store, hash-verified

193}
194
195func (c *Chain) setState(s *state.Snapshot) {
196 c.state.cond.L.Lock()
197 defer c.state.cond.L.Unlock()
198
199 // Multiple goroutines may attempt to set the state at the
200 // same time. If b is an older block than c.state, ignore it.
201 if s.Height() <= c.state.snapshot.Height() {
202 return
203 }
204
205 c.state.snapshot = s
206 if s.Height() > c.state.height {
207 c.state.height = s.Height()
208 c.state.cond.Broadcast()
209 }
210}
211
212func (c *Chain) setHeight(h uint64) {
213 // We update c.state.height from multiple places:

Callers 2

finalizeCommitStateMethod · 0.95

Calls 2

HeightMethod · 0.95
HeightMethod · 0.65

Tested by 1