Fix up flag handling

This commit is contained in:
Ethan Frey 2017-07-28 15:13:31 -04:00
parent 8dd2371cc5
commit 4652779a3d
3 changed files with 8 additions and 9 deletions

View File

@ -46,7 +46,7 @@ func GetProof(node client.Client, prover lc.Prover, key []byte, height int) (pro
}
// short-circuit with no proofs
if viper.GetBool(FlagTrustNode) {
if viper.GetBool(commands.FlagTrustNode) {
return proof, err
}

View File

@ -8,7 +8,6 @@ import (
// nolint
const (
FlagHeight = "height"
FlagTrustNode = "trust-node"
)
// RootCmd represents the base command when called without any subcommands
@ -24,7 +23,7 @@ data to other peers as needed.
}
func init() {
RootCmd.Flags().Int(FlagHeight, 0, "Height to query (skip to use latest block)")
RootCmd.Flags().Bool(commands.FlagTrustNode, false,
RootCmd.PersistentFlags().Int(FlagHeight, 0, "Height to query (skip to use latest block)")
RootCmd.PersistentFlags().Bool(commands.FlagTrustNode, false,
"DANGEROUS: blindly trust all results from the server")
}

View File

@ -86,13 +86,13 @@ test02SendTxWithFee() {
# make sure this works without trust also
OLD_BC_HOME=$BC_HOME
export BC_HOME=/foo
export BCTRUST_NODE=1
export BCNODE=localhost:46657
export BC_TRUST_NODE=1
export BC_NODE=localhost:46657
checkSendFeeTx $HASH $TX_HEIGHT $SENDER "90" "10"
checkAccount $SENDER "9007199254739900"
checkAccount $RECV "1082"
unset BCTRUST_NODE
unset BCNODE
unset BC_TRUST_NODE
unset BC_NODE
export BC_HOME=$OLD_BC_HOME
}