CurrentBlock retrieves the current head block of the canonical chain. The block is retrieved from the blockchain's internal cache.
()
| 472 | // CurrentBlock retrieves the current head block of the canonical chain. The |
| 473 | // block is retrieved from the blockchain's internal cache. |
| 474 | func (bc *BlockChain) CurrentBlock() *types.Block { |
| 475 | bc.syncModeMutex.Lock() |
| 476 | defer bc.syncModeMutex.Unlock() |
| 477 | if bc.syncMode == syncer.FullSync { |
| 478 | return bc.currentBlock.Load().(*types.Block) |
| 479 | } |
| 480 | return bc.CurrentFastBlock() |
| 481 | } |
| 482 | |
| 483 | // CurrentFastBlock retrieves the current fast-sync head block of the canonical |
| 484 | // chain. The block is retrieved from the blockchain's internal cache. |