aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockchain.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/blockchain.go')
-rw-r--r--core/blockchain.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index 72837e324..d6e116008 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -395,12 +395,13 @@ func (bc *BlockChain) GetCostInConfirmedBlocks(chainID uint32, address common.Ad
return cost, exist
}
-func (bc *BlockChain) GetChainLastConfirmedHeight(chainID uint32) uint64 {
- val, ok := bc.chainLastHeight.Load(chainID)
- if !ok {
- panic(fmt.Errorf("failed to get chain last height, chainID = %d", chainID))
+func (bc *BlockChain) GetChainLastConfirmedHeight(chainID uint32) (uint64, bool) {
+ val := uint64(0)
+ v, ok := bc.chainLastHeight.Load(chainID)
+ if ok {
+ val = v.(uint64)
}
- return val.(uint64)
+ return val, ok
}
func (bc *BlockChain) GetAddressInfo(chainID uint32, address common.Address) (