FetchBlock fetches the block at specified height from local cache.
(height int32)
| 880 | |
| 881 | // FetchBlock fetches the block at specified height from local cache. |
| 882 | func (c *Chain) FetchBlock(height int32) (b *types.Block, err error) { |
| 883 | if n := c.rt.getHead().node.ancestor(height); n != nil { |
| 884 | return c.fetchBlockByIndexKey(n.indexKey()) |
| 885 | } |
| 886 | return |
| 887 | } |
| 888 | |
| 889 | // FetchBlockByCount fetches the block at specified count from local cache. |
| 890 | func (c *Chain) FetchBlockByCount(count int32) (b *types.Block, realCount int32, height int32, err error) { |