LoadLastCommitTime() gets a timestamp from the most recent Quorum Block
(height uint64)
| 355 | |
| 356 | // LoadLastCommitTime() gets a timestamp from the most recent Quorum Block |
| 357 | func (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 |
| 385 | func (c *Controller) LoadLastProposers(height uint64) (*lib.Proposers, lib.ErrorI) { |
no test coverage detected