demo: fix waitForBlocks
This commit is contained in:
parent
35c221b496
commit
33cafd1b86
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue