MCPcopy Create free account
hub / github.com/CPChain/chain / SetKnownHead

Method SetKnownHead

core/headerchain.go:126–133  ·  view source on GitHub ↗

SetKnownHead sets the known head block hash and number

(hash common.Hash, number uint64)

Source from the content-addressed store, hash-verified

124
125// SetKnownHead sets the known head block hash and number
126func (hc *HeaderChain) SetKnownHead(hash common.Hash, number uint64) {
127 hc.knownHeadLock.Lock()
128 defer hc.knownHeadLock.Unlock()
129
130 if number > hc.knownHeadNumber {
131 hc.knownHeadHash, hc.knownHeadNumber = hash, number
132 }
133}
134
135// GetBlockNumber retrieves the block number belonging to the given hash
136// from the cache or database

Callers 1

NewHeaderChainFunction · 0.95

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected