Show height on legacy REST endpoints (#7997)

* Fix showing height in rest endpoints

* Fix query height

* Manually inject req.Height

* Small tweaks

* Use withHeight

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Amaury
2020-11-24 10:28:12 +00:00
committed by GitHub
co-authored by Aleksandr Bezobchuk mergify[bot]
parent 251a27d104
commit 74435137e9
4 changed files with 41 additions and 39 deletions
-22
View File
@@ -1,22 +0,0 @@
package client
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// ErrInvalidAccount returns a standardized error reflecting that a given
// account address does not exist.
func ErrInvalidAccount(addr sdk.AccAddress) error {
return fmt.Errorf(`no account with address %s was found in the state.
Are you sure there has been a transaction involving it?`, addr)
}
// ErrVerifyCommit returns a common error reflecting that the blockchain commit at a given
// height can't be verified. The reason is that the base checkpoint of the certifier is
// newer than the given height
func ErrVerifyCommit(height int64) error {
return fmt.Errorf(`the height of base truststore in the light client is higher than height %d.
Can't verify blockchain proof at this height. Please set --trust-node to true and try again`, height)
}
+1 -2
View File
@@ -11,7 +11,6 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/types/rest"
)
@@ -68,7 +67,7 @@ func getBlock(clientCtx client.Context, height *int64) ([]byte, error) {
return nil, err
}
return legacy.Cdc.MarshalJSON(res)
return clientCtx.LegacyAmino.MarshalJSON(res)
}
// get the current blockchain height