Browse Source

Fix TMSP tutorial outputs

pull/1780/head
Jae Kwon 8 years ago
parent
commit
c5f008d60f
5 changed files with 14 additions and 13 deletions
  1. +2
    -2
      cmd/tmsp-cli/tmsp-cli.go
  2. +1
    -1
      example/counter/counter.go
  3. +1
    -1
      example/dummy/dummy.go
  4. +8
    -7
      tests/test_cli/ex1.tmsp.out
  5. +2
    -2
      tests/test_cli/ex2.tmsp.out

+ 2
- 2
cmd/tmsp-cli/tmsp-cli.go View File

@ -234,7 +234,7 @@ func cmdCheckTx(c *cli.Context) error {
// Get application Merkle root hash
func cmdCommit(c *cli.Context) error {
res := client.CommitSync()
printResponse(c, res, Fmt("%X", res.Data), false)
printResponse(c, res, Fmt("0x%X", res.Data), false)
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)
}*/
if s != "" {
fmt.Printf("-> data: {%s}\n", s)
fmt.Printf("-> data: %s\n", s)
}
if res.Log != "" {
fmt.Printf("-> log: %s\n", res.Log)


+ 1
- 1
example/counter/counter.go View File

@ -18,7 +18,7 @@ func NewCounterApplication(serial bool) *CounterApplication {
}
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) {


+ 1
- 1
example/dummy/dummy.go View File

@ -19,7 +19,7 @@ func NewDummyApplication() *DummyApplication {
}
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) {


+ 8
- 7
tests/test_cli/ex1.tmsp.out View File

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

+ 2
- 2
tests/test_cli/ex2.tmsp.out View File

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

Loading…
Cancel
Save