Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1475 from irisnet/develop
Browse files Browse the repository at this point in the history
R4R: merge develop to master
  • Loading branch information
zhangjinbiao746 authored Jul 17, 2020
2 parents da68dc5 + 80b957a commit b91ae6a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
12 changes: 0 additions & 12 deletions backend/lcd/tendermint.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,10 @@ func Block(height int64) (result BlockVo) {
url := fmt.Sprintf(UrlBlock, conf.Get().Hub.LcdUrl, height)
resBytes, err := utils.Get(url)
if err != nil {
logger.Error("Block error", logger.Int64("height", height))
return result
}

if err := json.Unmarshal(resBytes, &result); err != nil {
logger.Error("Block error", logger.String("err", err.Error()))
return result
}
return result
Expand All @@ -359,12 +357,10 @@ func BlockLatest() (result BlockVo) {
url := fmt.Sprintf(UrlBlockLatest, conf.Get().Hub.LcdUrl)
resBytes, err := utils.Get(url)
if err != nil {
logger.Error("BlockLatest error", logger.String("err", err.Error()))
return result
}

if err := json.Unmarshal(resBytes, &result); err != nil {
logger.Error("BlockLatest error", logger.String("err", err.Error()))
return result
}
return result
Expand All @@ -374,12 +370,10 @@ func ValidatorSet(height int64) (result ValidatorSetVo) {
url := fmt.Sprintf(UrlValidatorSet, conf.Get().Hub.LcdUrl, height)
resBytes, err := utils.Get(url)
if err != nil {
logger.Error("BlockLatest error", logger.String("err", err.Error()))
return result
}

if err := json.Unmarshal(resBytes, &result); err != nil {
logger.Error("BlockLatest error", logger.String("err", err.Error()))
return result
}
return result
Expand All @@ -389,12 +383,10 @@ func LatestValidatorSet() (result ValidatorSetVo) {
url := fmt.Sprintf(UrlValidatorSetLatest, conf.Get().Hub.LcdUrl)
resBytes, err := utils.Get(url)
if err != nil {
logger.Error("BlockLatest error", logger.String("err", err.Error()))
return result
}

if err := json.Unmarshal(resBytes, &result); err != nil {
logger.Error("BlockLatest error", logger.String("err", err.Error()))
return result
}
return result
Expand All @@ -405,12 +397,10 @@ func BlockResult(height int64) (result BlockResultVo) {
url := fmt.Sprintf(UrlBlocksResult, conf.Get().Hub.LcdUrl, height)
resBytes, err := utils.Get(url)
if err != nil {
logger.Error("BlockResult error", logger.String("err", err.Error()))
return result
}

if err := json.Unmarshal(resBytes, &result); err != nil {
logger.Error("BlockResult error", logger.String("err", err.Error()))
return result
}
return result
Expand All @@ -421,12 +411,10 @@ func BlockCoinFlow(txhash string) (result BlockCoinFlowVo) {
url := fmt.Sprintf(UrlTxsTxHash, conf.Get().Hub.LcdUrl, txhash)
resBytes, err := utils.Get(url)
if err != nil {
logger.Error("BlockCoinFlow error", logger.String("err", err.Error()))
return result
}

if err := json.Unmarshal(resBytes, &result); err != nil {
logger.Error("BlockCoinFlow Unmarshal error", logger.String("err", err.Error()))
return result
}
return result
Expand Down
3 changes: 3 additions & 0 deletions backend/rest/controller/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ func RegisterHome(r *mux.Router) error {
func registerNavigationBar(r *mux.Router) error {
doApi(r, types.UrlRegisterNavigationBar, "GET", func(request vo.IrisReq) interface{} {
var block = lcd.BlockLatest()
if block.BlockMeta.Header.Height == "" {
return nil
}
var height, ok = utils.ParseInt(block.BlockMeta.Header.Height)
if !ok {
panic(types.CodeNotFound)
Expand Down

0 comments on commit b91ae6a

Please sign in to comment.