Update go-crypto with keys seedphrase, better testable password prompts
This commit is contained in:
@@ -31,11 +31,10 @@ test01SendTx() {
|
||||
SENDER=$(getAddr $RICH)
|
||||
RECV=$(getAddr $POOR)
|
||||
|
||||
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"
|
||||
RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH 2>/dev/null)
|
||||
txSucceeded $? "$RES"
|
||||
TX=`echo $RES | cut -d: -f2-`
|
||||
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"
|
||||
HASH=$(echo $TX | jq .hash | tr -d \")
|
||||
TX_HEIGHT=$(echo $TX | jq .height)
|
||||
|
||||
|
||||
+2
-2
@@ -137,11 +137,11 @@ checkAccount() {
|
||||
return $?
|
||||
}
|
||||
|
||||
# XXX Ex Usage: txSucceeded $? "$RES"
|
||||
# XXX Ex Usage: txSucceeded $? "$TX"
|
||||
# Desc: Must be called right after the `tx` command, makes sure it got a success response
|
||||
txSucceeded() {
|
||||
if (assertTrue "sent tx: $2" $1); then
|
||||
TX=`echo $2 | cut -d: -f2-` # strip off first line asking for password
|
||||
TX=$2
|
||||
assertEquals "good check: $TX" "0" $(echo $TX | jq .check_tx.code)
|
||||
assertEquals "good deliver: $TX" "0" $(echo $TX | jq .deliver_tx.code)
|
||||
else
|
||||
|
||||
@@ -33,9 +33,8 @@ 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"
|
||||
RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH 2>/dev/null)
|
||||
txSucceeded $? "$RES"
|
||||
TX=`echo $RES | cut -d: -f2-`
|
||||
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH 2>/dev/null)
|
||||
txSucceeded $? "$TX"
|
||||
HASH=$(echo $TX | jq .hash | tr -d \")
|
||||
TX_HEIGHT=$(echo $TX | jq .height)
|
||||
|
||||
@@ -65,9 +64,8 @@ test03AddCount() {
|
||||
SENDER=$(getAddr $RICH)
|
||||
assertFalse "bad password" "echo hi | ${CLIENT_EXE} tx counter --amount=1000mycoin --sequence=2 --name=${RICH} 2>/dev/null"
|
||||
|
||||
RES=$(echo qwertyuiop | ${CLIENT_EXE} tx counter --amount=10mycoin --sequence=2 --name=${RICH} --valid --countfee=5mycoin 2>/dev/null)
|
||||
txSucceeded $? "$RES"
|
||||
TX=`echo $RES | cut -d: -f2-`
|
||||
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx counter --amount=10mycoin --sequence=2 --name=${RICH} --valid --countfee=5mycoin)
|
||||
txSucceeded $? "$TX"
|
||||
HASH=$(echo $TX | jq .hash | tr -d \")
|
||||
TX_HEIGHT=$(echo $TX | jq .height)
|
||||
|
||||
|
||||
+5
-7
@@ -89,15 +89,13 @@ test01SendIBCTx() {
|
||||
SENDER=$(BC_HOME=${CLIENT_1} getAddr $RICH)
|
||||
RECV=$(BC_HOME=${CLIENT_2} getAddr $POOR)
|
||||
|
||||
# we have to remove the password request from stdout, to just get the json
|
||||
export BC_HOME=${CLIENT_1}
|
||||
RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20002mycoin \
|
||||
--sequence=1 --to=${CHAIN_ID_2}/${RECV} --name=$RICH 2>/dev/null)
|
||||
txSucceeded $? "$RES"
|
||||
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20002mycoin \
|
||||
--sequence=1 --to=${CHAIN_ID_2}/${RECV} --name=$RICH)
|
||||
txSucceeded $? "$TX"
|
||||
# an example to quit early if there is no point in more tests
|
||||
if [ $? != 0 ]; then echo "aborting!"; return 1; fi
|
||||
|
||||
TX=`echo $RES | cut -d: -f2-`
|
||||
HASH=$(echo $TX | jq .hash | tr -d \")
|
||||
TX_HEIGHT=$(echo $TX | jq .height)
|
||||
|
||||
@@ -142,7 +140,7 @@ startRelay() {
|
||||
export BC_HOME=${CLIENT_1}
|
||||
SENDER=$(getAddr $RICH)
|
||||
RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=100000mycoin \
|
||||
--sequence=$1 --to=$RELAY_ADDR --name=$RICH 2>/dev/null)
|
||||
--sequence=$1 --to=$RELAY_ADDR --name=$RICH)
|
||||
txSucceeded $? "$RES"
|
||||
if [ $? != 0 ]; then echo "can't pay chain1!"; return 1; fi
|
||||
|
||||
@@ -150,7 +148,7 @@ startRelay() {
|
||||
export BC_HOME=${CLIENT_2}
|
||||
SENDER=$(getAddr $RICH)
|
||||
RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=100000mycoin \
|
||||
--sequence=$2 --to=$RELAY_ADDR --name=$RICH 2>/dev/null)
|
||||
--sequence=$2 --to=$RELAY_ADDR --name=$RICH)
|
||||
txSucceeded $? "$RES"
|
||||
if [ $? != 0 ]; then echo "can't pay chain2!"; return 1; fi
|
||||
|
||||
|
||||
@@ -19,9 +19,8 @@ test00PreRestart() {
|
||||
SENDER=$(getAddr $RICH)
|
||||
RECV=$(getAddr $POOR)
|
||||
|
||||
RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH 2>/dev/null)
|
||||
txSucceeded $? "$RES"
|
||||
TX=`echo $RES | cut -d: -f2-`
|
||||
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH)
|
||||
txSucceeded $? "$TX"
|
||||
HASH=$(echo $TX | jq .hash | tr -d \")
|
||||
TX_HEIGHT=$(echo $TX | jq .height)
|
||||
|
||||
@@ -37,11 +36,10 @@ test01OnRestart() {
|
||||
SENDER=$(getAddr $RICH)
|
||||
RECV=$(getAddr $POOR)
|
||||
|
||||
RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=10000mycoin --sequence=2 --to=$RECV --name=$RICH 2>/dev/null)
|
||||
txSucceeded $? "$RES"
|
||||
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=10000mycoin --sequence=2 --to=$RECV --name=$RICH)
|
||||
txSucceeded $? "$TX"
|
||||
if [ $? != 0 ]; then echo "can't make tx!"; return 1; fi
|
||||
|
||||
TX=`echo $RES | cut -d: -f2-`
|
||||
HASH=$(echo $TX | jq .hash | tr -d \")
|
||||
TX_HEIGHT=$(echo $TX | jq .height)
|
||||
|
||||
@@ -52,8 +50,8 @@ test01OnRestart() {
|
||||
echo "done waiting!"
|
||||
|
||||
# last minute tx just at the block cut-off...
|
||||
RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20000mycoin --sequence=3 --to=$RECV --name=$RICH 2>/dev/null)
|
||||
txSucceeded $? "$RES"
|
||||
TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20000mycoin --sequence=3 --to=$RECV --name=$RICH)
|
||||
txSucceeded $? "$TX"
|
||||
if [ $? != 0 ]; then echo "can't make second tx!"; return 1; fi
|
||||
|
||||
# now we do a restart...
|
||||
|
||||
Reference in New Issue
Block a user