Skip to content
Snippets Groups Projects
Commit 0c9f56a1 authored by Benjamin Bollen's avatar Benjamin Bollen Committed by GitHub
Browse files

Merge pull request #231 from silasdavis/blockchain-info

Tweak BlockchainInfo to use stuff we have actually initialised
parents db45785b c1a847c3
No related branches found
No related tags found
No related merge requests found
...@@ -547,12 +547,12 @@ func (pipe *erisMintPipe) BroadcastTxSync(tx txs.Tx) (*rpc_tm_types.ResultBroadc ...@@ -547,12 +547,12 @@ func (pipe *erisMintPipe) BroadcastTxSync(tx txs.Tx) (*rpc_tm_types.ResultBroadc
func (pipe *erisMintPipe) BlockchainInfo(minHeight, maxHeight, func (pipe *erisMintPipe) BlockchainInfo(minHeight, maxHeight,
maxBlockLookback int) (*rpc_tm_types.ResultBlockchainInfo, error) { maxBlockLookback int) (*rpc_tm_types.ResultBlockchainInfo, error) {
blockStore := pipe.blockchain.blockStore height := pipe.consensusEngine.Height()
if maxHeight < 1 { if maxHeight < 1 {
maxHeight = blockStore.Height() maxHeight = height
} else { } else {
maxHeight = imath.MinInt(blockStore.Height(), maxHeight) maxHeight = imath.MinInt(height, maxHeight)
} }
if minHeight < 1 { if minHeight < 1 {
minHeight = imath.MaxInt(1, maxHeight-maxBlockLookback) minHeight = imath.MaxInt(1, maxHeight-maxBlockLookback)
...@@ -560,9 +560,9 @@ func (pipe *erisMintPipe) BlockchainInfo(minHeight, maxHeight, ...@@ -560,9 +560,9 @@ func (pipe *erisMintPipe) BlockchainInfo(minHeight, maxHeight,
blockMetas := []*tm_types.BlockMeta{} blockMetas := []*tm_types.BlockMeta{}
for height := maxHeight; height >= minHeight; height-- { for height := maxHeight; height >= minHeight; height-- {
blockMeta := blockStore.LoadBlockMeta(height) blockMeta := pipe.consensusEngine.LoadBlockMeta(height)
blockMetas = append(blockMetas, blockMeta) blockMetas = append(blockMetas, blockMeta)
} }
return &rpc_tm_types.ResultBlockchainInfo{blockStore.Height(), blockMetas}, nil return &rpc_tm_types.ResultBlockchainInfo{height, blockMetas}, nil
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment