MCPcopy
hub / github.com/canopy-network/canopy / LoadLastCommitTime

Method LoadLastCommitTime

controller/controller.go:357–382  ·  view source on GitHub ↗

LoadLastCommitTime() gets a timestamp from the most recent Quorum Block

(height uint64)

Source from the content-addressed store, hash-verified

355
356// LoadLastCommitTime() gets a timestamp from the most recent Quorum Block
357func (c *Controller) LoadLastCommitTime(height uint64) time.Time {
358 // load the certificate (and block) from the indexer
359 cert, err := c.FSM.LoadCertificate(height)
360 if err != nil {
361 c.log.Error(err.Error())
362 return time.Time{}
363 }
364 // create a new object reference (to ensure a non-nil result)
365 block := new(lib.Block)
366 // populate the object reference with bytes
367 if err = lib.Unmarshal(cert.Block, block); err != nil {
368 // log the error
369 c.log.Error(err.Error())
370 // exit with empty time
371 return time.Time{}
372 }
373 // ensure the block isn't nil
374 if block.BlockHeader == nil {
375 // log the error
376 c.log.Error("Last block synced is nil")
377 // exit with empty time
378 return time.Time{}
379 }
380 // return the last block time
381 return time.UnixMicro(int64(block.BlockHeader.Time))
382}
383
384// LoadProposerKeys() gets the last root-chainId proposer keys
385func (c *Controller) LoadLastProposers(height uint64) (*lib.Proposers, lib.ErrorI) {

Callers 1

finishSyncingMethod · 0.95

Calls 3

UnmarshalFunction · 0.92
LoadCertificateMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected