Begin adding proof calls

This commit is contained in:
Ethan Frey
2017-01-17 15:42:54 +01:00
parent 98c4679f39
commit 58ea995032
14 changed files with 131 additions and 2 deletions
+19
View File
@@ -131,6 +131,13 @@ func main() {
return cmdQuery(c)
},
},
{
Name: "proof",
Usage: "Get proof for a key",
Action: func(c *cli.Context) error {
return cmdProof(c)
},
},
}
app.Before = before
err := app.Run(os.Args)
@@ -305,6 +312,18 @@ func cmdQuery(c *cli.Context) error {
return nil
}
// Prove application state
func cmdProof(c *cli.Context) error {
args := c.Args()
if len(args) != 1 {
return errors.New("Command proof takes 1 argument")
}
keyBytes := stringOrHexToBytes(c.Args()[0])
res := client.ProofSync(keyBytes)
printResponse(c, res, string(res.Data), true)
return nil
}
//--------------------------------------------------------------------------------
func printResponse(c *cli.Context, rsp *response) {