[cli] enable compressed merkle proofs with --compressed
@@ -22,6 +22,7 @@ var getstateCmd = &cobra.Command{
var address string
var stateroot string
var proof bool
+var compressed bool
var staking bool
func init() {
@@ -29,6 +30,7 @@ func init() {
getstateCmd.MarkFlagRequired("address")
getstateCmd.Flags().StringVar(&stateroot, "root", "", "Get the state at a specified state root")
getstateCmd.Flags().BoolVar(&proof, "proof", false, "Get the proof for the state")
+ getstateCmd.Flags().BoolVar(&compressed, "compressed", false, "Get a compressed proof for the state")
getstateCmd.Flags().BoolVar(&staking, "staking", false, "Get the staking info from the address")
rootCmd.AddCommand(getstateCmd)
}
@@ -76,13 +78,13 @@ func execGetState(cmd *cobra.Command, args []string) {
// Get the state and proof at a specific root.
// If root is nil, the latest block is queried.
msg, err := client.GetStateAndProof(context.Background(),
- &types.AccountAndRoot{Account: addr, Root: root})
+ &types.AccountAndRoot{Account: addr, Root: root, Compressed: compressed})
if err != nil {
cmd.Printf("Failed: %s", err.Error())
return
}
- cmd.Printf("{account:%s, nonce:%d, balance:%d, included:%t, merkle proof length:%d}\n",
- address, msg.GetState().GetNonce(), msg.GetState().GetBalance(), msg.GetInclusion(), len(msg.GetAuditPath()))
+ cmd.Printf("{account:%s, nonce:%d, balance:%d, included:%t, merkle proof length:%d, height:%d}\n",
+ address, msg.GetState().GetNonce(), msg.GetState().GetBalance(), msg.GetInclusion(), len(msg.GetAuditPath()), msg.GetHeight())
}
}
