From c1a847c3b6f8d501b00142690c995f7ca5f5ac6e Mon Sep 17 00:00:00 2001 From: Silas Davis <silas@erisindustries.com> Date: Sun, 21 Aug 2016 16:36:48 +0100 Subject: [PATCH] Change implementation of BlockchainInfo to avoid nil pointer --- manager/eris-mint/pipe.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manager/eris-mint/pipe.go b/manager/eris-mint/pipe.go index 00d955de..1c01c75b 100644 --- a/manager/eris-mint/pipe.go +++ b/manager/eris-mint/pipe.go @@ -547,12 +547,12 @@ func (pipe *erisMintPipe) BroadcastTxSync(tx txs.Tx) (*rpc_tm_types.ResultBroadc func (pipe *erisMintPipe) BlockchainInfo(minHeight, maxHeight, maxBlockLookback int) (*rpc_tm_types.ResultBlockchainInfo, error) { - blockStore := pipe.blockchain.blockStore + height := pipe.consensusEngine.Height() if maxHeight < 1 { - maxHeight = blockStore.Height() + maxHeight = height } else { - maxHeight = imath.MinInt(blockStore.Height(), maxHeight) + maxHeight = imath.MinInt(height, maxHeight) } if minHeight < 1 { minHeight = imath.MaxInt(1, maxHeight-maxBlockLookback) @@ -560,9 +560,9 @@ func (pipe *erisMintPipe) BlockchainInfo(minHeight, maxHeight, blockMetas := []*tm_types.BlockMeta{} for height := maxHeight; height >= minHeight; height-- { - blockMeta := blockStore.LoadBlockMeta(height) + blockMeta := pipe.consensusEngine.LoadBlockMeta(height) blockMetas = append(blockMetas, blockMeta) } - return &rpc_tm_types.ResultBlockchainInfo{blockStore.Height(), blockMetas}, nil + return &rpc_tm_types.ResultBlockchainInfo{height, blockMetas}, nil } -- GitLab