Skip to content

Commit

Permalink
Print output addr on failed tx to help debug #147
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Jun 29, 2017
1 parent d3b6649 commit d36486a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion tests/cli/basictx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test01SendTx() {
assertFalse "missing dest" "${CLIENT_EXE} tx send --amount=992mycoin --sequence=1"
assertFalse "bad password" "echo foo | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH"
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH)
txSucceeded $? "$TX"
txSucceeded $? "$TX" "$RECV"
HASH=$(echo $TX | jq .hash | tr -d \")
TX_HEIGHT=$(echo $TX | jq .height)

Expand Down
8 changes: 4 additions & 4 deletions tests/cli/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ checkAccount() {
return $?
}

# XXX Ex Usage: txSucceeded $? "$TX"
# XXX Ex Usage: txSucceeded $? "$TX" "$RECIEVER"
# Desc: Must be called right after the `tx` command, makes sure it got a success response
txSucceeded() {
if (assertTrue "sent tx: $2" $1); then
if (assertTrue "sent tx ($3): $2" $1); then
TX=$2
assertEquals "good check: $TX" "0" $(echo $TX | jq .check_tx.code)
assertEquals "good deliver: $TX" "0" $(echo $TX | jq .deliver_tx.code)
assertEquals "good check ($3): $TX" "0" $(echo $TX | jq .check_tx.code)
assertEquals "good deliver ($3): $TX" "0" $(echo $TX | jq .deliver_tx.code)
else
return 1
fi
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/counter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test01SendTx() {
assertFalse "missing dest" "${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 2>/dev/null"
assertFalse "bad password" "echo foo | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH 2>/dev/null"
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH 2>/dev/null)
txSucceeded $? "$TX"
txSucceeded $? "$TX" "$RECV"
HASH=$(echo $TX | jq .hash | tr -d \")
TX_HEIGHT=$(echo $TX | jq .height)

Expand Down Expand Up @@ -65,7 +65,7 @@ test03AddCount() {
assertFalse "bad password" "echo hi | ${CLIENT_EXE} tx counter --amount=1000mycoin --sequence=2 --name=${RICH} 2>/dev/null"

TX=$(echo qwertyuiop | ${CLIENT_EXE} tx counter --amount=10mycoin --sequence=2 --name=${RICH} --valid --countfee=5mycoin)
txSucceeded $? "$TX"
txSucceeded $? "$TX" "counter"
HASH=$(echo $TX | jq .hash | tr -d \")
TX_HEIGHT=$(echo $TX | jq .height)

Expand Down
6 changes: 3 additions & 3 deletions tests/cli/ibc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ test01SendIBCTx() {
export BC_HOME=${CLIENT_1}
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20002mycoin \
--sequence=1 --to=${CHAIN_ID_2}/${RECV} --name=$RICH)
txSucceeded $? "$TX"
txSucceeded $? "$TX" "${CHAIN_ID_2}/${RECV}"
# an example to quit early if there is no point in more tests
if [ $? != 0 ]; then echo "aborting!"; return 1; fi

Expand Down Expand Up @@ -141,15 +141,15 @@ startRelay() {
SENDER=$(getAddr $RICH)
RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=100000mycoin \
--sequence=$1 --to=$RELAY_ADDR --name=$RICH)
txSucceeded $? "$RES"
txSucceeded $? "$RES" "$RELAY_ADDR"
if [ $? != 0 ]; then echo "can't pay chain1!"; return 1; fi

# Get paid on chain2
export BC_HOME=${CLIENT_2}
SENDER=$(getAddr $RICH)
RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=100000mycoin \
--sequence=$2 --to=$RELAY_ADDR --name=$RICH)
txSucceeded $? "$RES"
txSucceeded $? "$RES" "$RELAY_ADDR"
if [ $? != 0 ]; then echo "can't pay chain2!"; return 1; fi

# Initialize the relay (register both chains)
Expand Down
6 changes: 3 additions & 3 deletions tests/cli/restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test00PreRestart() {
RECV=$(getAddr $POOR)

TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH)
txSucceeded $? "$TX"
txSucceeded $? "$TX" "$RECV"
HASH=$(echo $TX | jq .hash | tr -d \")
TX_HEIGHT=$(echo $TX | jq .height)

Expand All @@ -37,7 +37,7 @@ test01OnRestart() {
RECV=$(getAddr $POOR)

TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=10000mycoin --sequence=2 --to=$RECV --name=$RICH)
txSucceeded $? "$TX"
txSucceeded $? "$TX" "$RECV"
if [ $? != 0 ]; then echo "can't make tx!"; return 1; fi

HASH=$(echo $TX | jq .hash | tr -d \")
Expand All @@ -51,7 +51,7 @@ test01OnRestart() {

# last minute tx just at the block cut-off...
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20000mycoin --sequence=3 --to=$RECV --name=$RICH)
txSucceeded $? "$TX"
txSucceeded $? "$TX" "$RECV"
if [ $? != 0 ]; then echo "can't make second tx!"; return 1; fi

# now we do a restart...
Expand Down

0 comments on commit d36486a

Please sign in to comment.