diff --git a/cmd/commands/utils.go b/cmd/commands/utils.go index 6e594b7fc6..13d57bd50e 100644 --- a/cmd/commands/utils.go +++ b/cmd/commands/utils.go @@ -85,9 +85,10 @@ func getHeaderAndCommit(c *cli.Context, height int) (*tmtypes.Header, *tmtypes.C tmAddr := c.String("node") clientURI := client.NewClientURI(tmAddr) - _, err := clientURI.Call("commit", map[string]interface{}{"height": height}, tmResult) + method := "commit" + _, err := clientURI.Call(method, map[string]interface{}{"height": height}, tmResult) if err != nil { - return nil, nil, errors.New(cmn.Fmt("Error on broadcast tx: %v", err)) + return nil, nil, errors.New(cmn.Fmt("Error on %s: %v", method, err)) } resCommit := (*tmResult).(*ctypes.ResultCommit) header := resCommit.Header diff --git a/demo/start.sh b/demo/start.sh index 2ab83166c6..f2b85a5812 100644 --- a/demo/start.sh +++ b/demo/start.sh @@ -27,7 +27,7 @@ function waitForBlock() { addr=$1 b1=`curl -s $addr/status | jq .result[1].latest_block_height` b2=$b1 - while [ "$b2" != "$b1" ]; do + while [ "$b2" == "$b1" ]; do echo "Waiting for node $addr to commit a block ..." sleep 1 b2=`curl -s $addr/status | jq .result[1].latest_block_height` @@ -94,10 +94,11 @@ echo "PACKET: $PACKET" echo "PROOF: $PROOF" +# the query returns the height of the next block, which contains the app hash +# but which may not be committed yet, so we have to wait for it to query the commit echo "" -echo "... waiting for some blocks to be mined" +echo "... waiting for a block to be committed" echo "" -sleep 5 waitForBlock localhost:46657 waitForBlock localhost:36657