Fix TMSP tutorial outputs

This commit is contained in:
Jae Kwon 2016-12-06 03:57:09 -08:00
parent b3e5d0afa1
commit c5f008d60f
5 changed files with 14 additions and 13 deletions

View File

@ -234,7 +234,7 @@ func cmdCheckTx(c *cli.Context) error {
// Get application Merkle root hash // Get application Merkle root hash
func cmdCommit(c *cli.Context) error { func cmdCommit(c *cli.Context) error {
res := client.CommitSync() res := client.CommitSync()
printResponse(c, res, Fmt("%X", res.Data), false) printResponse(c, res, Fmt("0x%X", res.Data), false)
return nil return nil
} }
@ -264,7 +264,7 @@ func printResponse(c *cli.Context, res types.Result, s string, printCode bool) {
fmt.Printf("-> error: %s\n", res.Error) fmt.Printf("-> error: %s\n", res.Error)
}*/ }*/
if s != "" { if s != "" {
fmt.Printf("-> data: {%s}\n", s) fmt.Printf("-> data: %s\n", s)
} }
if res.Log != "" { if res.Log != "" {
fmt.Printf("-> log: %s\n", res.Log) fmt.Printf("-> log: %s\n", res.Log)

View File

@ -18,7 +18,7 @@ func NewCounterApplication(serial bool) *CounterApplication {
} }
func (app *CounterApplication) Info() (string, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) { func (app *CounterApplication) Info() (string, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) {
return Fmt("hashes:%v, txs:%v", app.hashCount, app.txCount), nil, nil, nil return Fmt("{\"hashes\":%v,\"txs\":%v}", app.hashCount, app.txCount), nil, nil, nil
} }
func (app *CounterApplication) SetOption(key string, value string) (log string) { func (app *CounterApplication) SetOption(key string, value string) (log string) {

View File

@ -19,7 +19,7 @@ func NewDummyApplication() *DummyApplication {
} }
func (app *DummyApplication) Info() (string, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) { func (app *DummyApplication) Info() (string, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) {
return Fmt("size:%v", app.state.Size()), nil, nil, nil return Fmt("{\"size\":%v}", app.state.Size()), nil, nil, nil
} }
func (app *DummyApplication) SetOption(key string, value string) (log string) { func (app *DummyApplication) SetOption(key string, value string) (log string) {

View File

@ -1,31 +1,32 @@
> echo hello > echo hello
-> data: {hello} -> data: hello
> info > info
-> data: {size:0} -> data: {"size":0}
> commit > commit
-> data: 0x
> append_tx abc > append_tx abc
-> code: OK -> code: OK
> info > info
-> data: {size:1} -> data: {"size":1}
> commit > commit
-> data: {750502FC7E84BBD788ED589624F06CFA871845D1} -> data: 0x750502FC7E84BBD788ED589624F06CFA871845D1
> query abc > query abc
-> code: OK -> code: OK
-> data: {Index=0 value=abc exists=true} -> data: {"index":0,"value":"abc","exists":true}
> append_tx def=xyz > append_tx def=xyz
-> code: OK -> code: OK
> commit > commit
-> data: {76393B8A182E450286B0694C629ECB51B286EFD5} -> data: 0x76393B8A182E450286B0694C629ECB51B286EFD5
> query def > query def
-> code: OK -> code: OK
-> data: {Index=1 value=xyz exists=true} -> data: {"index":1,"value":"xyz","exists":true}

View File

@ -1,5 +1,5 @@
> set_option serial on > set_option serial on
-> data: {serial=on} -> data: serial=on
> check_tx 0x00 > check_tx 0x00
-> code: OK -> code: OK
@ -22,5 +22,5 @@
-> log: Invalid nonce. Expected 2, got 4 -> log: Invalid nonce. Expected 2, got 4
> info > info
-> data: {hashes:0, txs:2} -> data: {"hashes":0,"txs":2}