BestSnapshot returns information about the current best chain block and related state as of the current point in time. The returned instance must be treated as immutable since it is shared by all callers.
This function is safe for concurrent access.
// block and is able to skip connecting the block for the indexes that // don't need it. bestHeight := chain.BestSnapshot().Height lowestHeight := bestHeight indexerHeights := make(int32, len(m.enabledIndexes))
// Get the latest block hash and height from the database and report // status. best := chain.BestSnapshot() fmt.Printf("Block database loaded with block height %d\n", best.Height)
} best := b.chain.BestSnapshot() var bestPeer *serverPeer var enext *list.Element