You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1035 lines
27 KiB
1035 lines
27 KiB
8 years ago
|
#!/bin/bash
|
||
|
clear
|
||
|
printf "\n"
|
||
|
echo " ***************************************"
|
||
|
echo " * IGUANA *"
|
||
|
echo " * Automated RPC REGRESSION Testing *"
|
||
|
echo " * Script *"
|
||
|
echo " ***************************************"
|
||
|
printf "\n"
|
||
|
printf "\t\t\tTest started at %s\n\n\n" "$(date)"
|
||
|
|
||
|
|
||
|
# declaring global integer variables
|
||
|
declare -ix failed=0
|
||
|
declare -ix passed=0
|
||
|
declare -ix addr_match=0
|
||
|
declare -ix addr_unmatch=0
|
||
|
declare -ix addr_match_sa=0
|
||
|
declare -ix addr_unmatch_sa=0
|
||
|
|
||
|
startCoin="BTCD"
|
||
|
|
||
|
|
||
|
# RPC START BTCD COIN
|
||
|
printf "Executing [RPC: startBTCD]\n"
|
||
|
printf "==============================\n"
|
||
|
~/tests/./startBTCD_p2p > /tmp/startBTCD_p2p.txt
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC result value
|
||
|
result=$(~/tests/./json_extract /tmp/startBTCD_p2p.txt result)
|
||
|
error=$(~/tests/./json_extract /tmp/startBTCD_p2p.txt error)
|
||
|
|
||
|
if [ "$result" != "coin added" ]
|
||
|
then
|
||
|
printf "RESULT_STARTBTCD_ERROR MISMATCH(result -> %s)\n" "$result"
|
||
|
printf "info: BTCD coin should have been added successfully!\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$result" == "coin added" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC START BTCD\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/startBTCD_p2p.txt
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED:RPC START BTCD (%s)\n\n" "$error"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
# ACTIVE HANDLE RPC before WALLETPASSPHRASE
|
||
|
printf "\n"
|
||
|
sleep 3
|
||
|
|
||
|
printf "Executing [RPC: ACTIVEHANDLE]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
~/tests/./activehandle > /tmp/activehandle.txt
|
||
|
printf "\n
|
||
|
"
|
||
|
# call json_extract script to get the RPC status value
|
||
|
Wstatus=$(~/tests/./json_extract /tmp/activehandle.txt status)
|
||
|
err_ah=$(~/tests/./json_extract /tmp/activehandle.txt error)
|
||
|
|
||
|
if [ "$Wstatus" != "locked" ]
|
||
|
then
|
||
|
printf "RESULT_ACTIVEHANDLE_ERROR MISMATCH(STATUS -> %s)\n" "$Wstatus"
|
||
|
printf "info: wallet should be <locked!>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$Wstatus" == "locked" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC ACTIVEHANDLE\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/activehandle.txt
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC ACTIVEHANDLE (%s)\n\n" "$err_ah"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
# GETINFO RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: GETINFO]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
~/tests/./getinfo > /tmp/getinfo.txt
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC status value
|
||
|
r_getinfo=$(~/tests/./json_extract /tmp/getinfo.txt result)
|
||
|
err_getinfo=$(~/tests/./json_extract /tmp/getinfo.txt error)
|
||
|
|
||
|
if [ "$r_getinfo" == "success" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC GET INFO\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/getinfo.txt
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC GET INFO(%s)\n\n" "$err_getinfo"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
# ENCRYPTWALLET RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: ENCRYPTWALLET]\n"
|
||
|
printf "==================================\n"
|
||
|
|
||
|
~/tests/./encryptwallet_SP > /tmp/encryptwallet_SP
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC status & result values
|
||
|
r_ew=$(~/tests/./json_extract /tmp/encryptwallet_SP result)
|
||
|
s_ew=$(~/tests/./json_extract /tmp/encryptwallet_SP status)
|
||
|
err_ew=$(~/tests/./json_extract /tmp/encryptwallet_SP error)
|
||
|
|
||
|
if [ "$s_ew" != "unlocked" ]
|
||
|
then
|
||
|
printf "RESULT_ENCRYPTWALLET_ERROR MISMATCH(STATUS -> %s)\n" "$s_ew"
|
||
|
printf "info: wallet should have <locked!>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$r_ew" == "success" ] && [ "$s_ew" == "unlocked" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC ENCRYPTWALLET\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/encryptwallet_SP
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC ENCRYPTWALLET (%s)\n\n" "$err_ew"
|
||
|
let failed+=1
|
||
|
|
||
|
fi
|
||
|
|
||
|
# WALLETPASSPHRASE RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: WALLETPASSPHRASE]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
~/tests/./walletpassphrase_WVP > /tmp/walletpassphrase_WVP
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC status & result values
|
||
|
r_wpp=$(~/tests/./json_extract /tmp/walletpassphrase_WVP result)
|
||
|
s_wpp=$(~/tests/./json_extract /tmp/walletpassphrase_WVP status)
|
||
|
err_wpp=$(~/tests/./json_extract /tmp/walletpassphrase_WVP error)
|
||
|
|
||
|
if [ "$s_wpp" != "unlocked" ]
|
||
|
then
|
||
|
printf "RESULT_WALLETPASSPHRASE_ERROR MISMATCH(STATUS -> %s)\n" "$s_wpp"
|
||
|
printf "info: wallet should be <unlocked!>\n"
|
||
|
fi
|
||
|
|
||
|
|
||
|
if [ "$r_wpp" == "success" ] && [ "$s_wpp" == "unlocked" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC WALLETPASSPHRASE\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/walletpassphrase_WVP
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC WALLETPASSPHRASE (%s)\n\n" "$err_wpp"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
# WALLETLOCK
|
||
|
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: WALLETLOCK]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
result=$(~/tests/./walletlock)
|
||
|
printf "\n"
|
||
|
|
||
|
|
||
|
if [ "$result" != "success" ]
|
||
|
then
|
||
|
printf "RESULT_WALLETLOCK_ERROR MISMATCH(STATUS -> %s)\n" "$result"
|
||
|
printf "info: wallet should be <locked!>\n\n"
|
||
|
fi
|
||
|
|
||
|
|
||
|
if [ "$result" == "success" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC WALLETLOCK\n\n"
|
||
|
let passed+=1
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC WALLETLOCK (%s)\n\n" "$result"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
|
||
|
# WALLETPASSPHRASE RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: WALLETPASSPHRASE]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
~/tests/./walletpassphrase_WVP > /tmp/walletpassphrase_WVP
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC status & result values
|
||
|
r_wpp=$(~/tests/./json_extract /tmp/walletpassphrase_WVP result)
|
||
|
s_wpp=$(~/tests/./json_extract /tmp/walletpassphrase_WVP status)
|
||
|
err_wpp=$(~/tests/./json_extract /tmp/walletpassphrase_WVP error)
|
||
|
|
||
|
if [ "$s_wpp" != "unlocked" ]
|
||
|
then
|
||
|
printf "RESULT_WALLETPASSPHRASE_ERROR: MISMATCH(STATUS -> %s)\n" "$s_wpp"
|
||
|
printf "info: wallet should be <unlocked!>\n\n"
|
||
|
fi
|
||
|
|
||
|
|
||
|
if [ "$r_wpp" == "success" ] && [ "$s_wpp" == "unlocked" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC WALLETPASSPHRASE\n\n"
|
||
|
rm -f /tmp/walletpassphrase_WVP
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC WALLETPASSPHRASE (%s)\n\n" "$err_wpp"
|
||
|
fi
|
||
|
|
||
|
|
||
|
|
||
|
# CHECKWALLET RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: CEHCKWALLET]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
~/tests/./checkwallet > /tmp/checkwallet
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC status & result values
|
||
|
b_cw=$(~/tests/./json_extracti /tmp/checkwallet bad)
|
||
|
err_cw=$(~/tests/./json_extracti /tmp/checkwallet error)
|
||
|
|
||
|
if [ "$b_cw" -ne 0 ]
|
||
|
then
|
||
|
printf "RESULT_CHECKWALLET_ERROR MISMATCH(BAD -> %d)\n" "$b_cw"
|
||
|
printf "info: bad should be <0>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$b_cw" -eq 0 ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC CHECKWALLET\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/checkwallet
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: ERROR: %s\n\n"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
|
||
|
# ACTIVE HANDLE RPC after WALLETPASSPHRASE
|
||
|
printf "\n"
|
||
|
sleep 3
|
||
|
|
||
|
printf "Executing [RPC: ACTIVEHANDLE]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
~/tests/./activehandle > /tmp/activehandle.txt
|
||
|
printf "\n
|
||
|
"
|
||
|
# call json_extract script to get the RPC status value
|
||
|
Wstatus=$(~/tests/./json_extract /tmp/activehandle.txt status)
|
||
|
err_ah=$(~/tests/./json_extract /tmp/activehandle.txt error)
|
||
|
|
||
|
if [ "$Wstatus" != "unlocked" ]
|
||
|
then
|
||
|
printf "RESULT_ACTIVEHANDLE_ERROR MISMATCH(STATUS -> %s)\n" "$Wstatus"
|
||
|
printf "info: Wallet should have <unlocked>\n\n"
|
||
|
fi
|
||
|
|
||
|
|
||
|
if [ "$Wstatus" == "unlocked" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC ACTIVEHANDLE\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/activehandle.txt
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC ACTIVEHANDLE(%s)\n\n" "$err_ah"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
|
||
|
|
||
|
# WALLETPASSPHRASE RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: WALLETPASSPHRASE]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
~/tests/./walletpassphrase_WVP > /tmp/walletpassphrase_WVP
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC status & result values
|
||
|
r_wpp=$(~/tests/./json_extract /tmp/walletpassphrase_WVP result)
|
||
|
s_wpp=$(~/tests/./json_extract /tmp/walletpassphrase_WVP status)
|
||
|
err_wpp=$(~/tests/./json_extract /tmp/walletpassphrase_WVP error)
|
||
|
|
||
|
if [ "$s_wpp" != "unlocked" ]
|
||
|
then
|
||
|
printf "RESULT_WALLETPASSPHRASE_ERROR (STATUS -> %s)\n" "$s_wpp"
|
||
|
printf "info: wallet should be <unlocked!>\n\n"
|
||
|
fi
|
||
|
|
||
|
|
||
|
if [ "$r_wpp" == "success" ] && [ "$s_wpp" == "unlocked" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC WALLETPASSPHRASE\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/walletpassphrase_WVP
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC WALLETPASSPHRASE (%s)\n\n" "$err_wpp"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
|
||
|
# BACKUPWALLET RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: BACKUPWALLET]\n"
|
||
|
printf "=================================\n"
|
||
|
|
||
|
~/tests/./backupwallet > /tmp/backupwallet
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC status value
|
||
|
r_bw=$(~/tests/./json_extract /tmp/backupwallet result)
|
||
|
err_bw=$(~/tests/./json_extract /tmp/backupwallet error)
|
||
|
|
||
|
|
||
|
if [ "$r_bw" != "wallet backup saved" ]
|
||
|
then
|
||
|
printf "RESULT_BACKUPWALLET_ERROR MISMATCH (RESULT -> %s)\n" "$r_bw"
|
||
|
printf "info: wallet backup should be <saved>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$r_bw" == "wallet backup saved" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC BACKUPWALLET\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/walletpassphrase_WVP
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC BACKUPWALLET (%s)\n" "$err_bw"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
|
||
|
#GETACCOUNTADDRESS RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: GETACCOUNTADDRESS]\n"
|
||
|
printf "=====================================\n"
|
||
|
|
||
|
~/tests/./getaccountaddress_WVA > /tmp/getaccountaddress_WVA
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC status value
|
||
|
addr_gaa=$(~/tests/./json_extract /tmp/getaccountaddress_WVA address)
|
||
|
acc_gaa=$(~/tests/./json_extract /tmp/getaccountaddress_WVA account)
|
||
|
pkey_gaa=$(~/tests/./json_extract /tmp/getaccountaddress_WVA pubkey)
|
||
|
r_gaa=$(~/tests/./json_extract /tmp/getaccountaddress_WVA result)
|
||
|
err_gaa=$(~/tests/./json_extract /tmp/getaccountaddress_WVA error)
|
||
|
|
||
|
|
||
|
if [ "$acc_gaa" != "IGUANA" ]
|
||
|
then
|
||
|
printf "RESULT_GETACCOUNTADDRESS_ERROR MISMATCH (ACCOUNT -> %s)\n" "$acc_gaa"
|
||
|
printf "info: Account <IGUANA> should be created!\n\n"
|
||
|
fi
|
||
|
|
||
|
|
||
|
if [ "$acc_gaa" == "IGUANA" ] && [ "$r_gaa" == "success" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC GETACCOUNTADDRESS\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/getaccountaddress_WVA
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC GETACCOUNTADDRESS (ERROR:%s\n)" "$err_gaa"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
|
||
|
#GETACCOUNT RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: GETACCOUNT]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaccount\",\"address\":\"$addr_gaa\"}" > /tmp/getaccount
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC status value
|
||
|
acc_ga=$(~/tests/./json_extract /tmp/getaccount account)
|
||
|
r_ga=$(~/tests/./json_extract /tmp/getaccount result)
|
||
|
err_ga=$(~/tests/./json_extract /tmp/getaccount error)
|
||
|
|
||
|
if [ "$acc_ga" != "$acc_gaa" ]
|
||
|
then
|
||
|
printf "RESULT_GETACCOUNT_ERROR MISMATCH(ACCOUNT -> %s)\n" "$acc_ga"
|
||
|
printf "info: account name should be <IGUANA>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$acc_ga" == "$acc_gaa" ] && [ "$r_ga" == "success" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC GETACCOUNT\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/getaccount
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC GETACCOUNT ERROR(%s)\n" "$err_ga"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
#DUMPPRIVKEY RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: DUMPPRIVKEY]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"method\":\"dumpprivkey\",\"params\":[\"$addr_gaa\"]}"> /tmp/dumprivkeyI
|
||
|
prvkey=$(cat /tmp/dumprivkeyI)
|
||
|
printf "\n"
|
||
|
|
||
|
if [ "$prvkey" != "" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC DUMPRIVKEY\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/dumprivkeyI
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC DUMPPRIVKEY\n\n"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
|
||
|
#WIF2PRV
|
||
|
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: WIF2PRV]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"SuperNET\",\"method\":\"wif2priv\",\"wif\":\"$prvkey\"}" > /tmp/wif2prv
|
||
|
privkey=$(~/tests/./json_extract /tmp/wif2prv privkey)
|
||
|
res=$(~/tests/./json_extract /tmp/wif2prv result)
|
||
|
err=$(~/tests/./json_extract /tmp/wif2prv error)
|
||
|
|
||
|
|
||
|
printf "\n"
|
||
|
|
||
|
if [ "$privkey" != "" ] && [ "$res" == "success" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC WIF2PRV\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/wif2prv
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC WIF2PRV\n\n"
|
||
|
printf "ERROR: %s\n" "$err"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
#PRV2PUB
|
||
|
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: PRV2PUB]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"SuperNET\",\"method\":\"priv2pub\",\"privkey\":\"$privkey\",\"addrtype\":\"\"}"> /tmp/prv2pub
|
||
|
|
||
|
secp256k1=$(~/tests/./json_extract /tmp/prv2pub secp256k1)
|
||
|
addr=$(~/tests/./json_extract /tmp/prv2pub result)
|
||
|
err1=$(~/tests/./json_extract /tmp/prv2pub error)
|
||
|
|
||
|
printf "\n"
|
||
|
|
||
|
if [ "$secp256k1" == "$pkey_gaa" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: PUBKEY/PRVKEY PAIRS MATCHES\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/prv2pub
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: PUBKEY/PRIVKEY PAIRS MISMATCH\n"
|
||
|
printf "SECP256K1\n" "$secp256k1"
|
||
|
printf "PUBKEY:\n" "$pkey_gaa"
|
||
|
printf "ERROR: %s\n" "$err1"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
#VALIDATEPUBKEY
|
||
|
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: VALIDATEPUBKEY]\n"
|
||
|
printf "==============================\n"
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"validatepubkey\",\"pubkey\":\"$secp256k1\"}"> /tmp/validatepubkey
|
||
|
|
||
|
pubkey=$(~/tests/./json_extract /tmp/validatepubkey pubkey)
|
||
|
result=$(~/tests/./json_extract /tmp/validatepubkey result)
|
||
|
coin=$(~/tests/./json_extract /tmp/validatepubkey coin)
|
||
|
address=$(~/tests/./json_extract /tmp/validatepubkey address)
|
||
|
err1=$(~/tests/./json_extract /tmp/validatepubkey error)
|
||
|
|
||
|
if [ "$pubkey" != "$secp256k1" ]
|
||
|
then
|
||
|
printf "RESULT_VALIDATEPUBKEY_ERROR MISMATCH(pubkey-> <%s>)\n" "$pubkey"
|
||
|
printf "info: PUBKEY should be <%s>\n\n" "$secp256k1"
|
||
|
fi
|
||
|
|
||
|
if [ "$result" != "success" ]
|
||
|
then
|
||
|
printf "RESULT_VALIDATEPUBKEY_ERROR MISMATCH(result-> %s)\n" "$result"
|
||
|
printf "info: Result should be <success>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$coin" != "$startCoin" ]
|
||
|
then
|
||
|
printf "RESULT_VALIDATEPUBKEY_ERROR MISMATCH(result-> %s)\n" "$coin"
|
||
|
printf "info: COIN should be <%s>\n" "$startCoin"
|
||
|
fi
|
||
|
|
||
|
printf "\n"
|
||
|
|
||
|
if [ "$secp256k1" == "$pkey_gaa" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: PUBKEY/PRVKEY PAIRS MATCHES\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/prv2pub
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: PUBKEY/PRIVKEY PAIRS MISMATCH\n\n"
|
||
|
printf "ERROR: %s\n" "$err1"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
#GETADDRESSBYACCOUNT RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: GETADDRESSBYACCOUNT]\n"
|
||
|
printf "========================================\n"
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaddressesbyaccount\",\"account\":\"$acc_ga\"}" > /tmp/getaddressbyaccount
|
||
|
|
||
|
# call json_extract script to get the RPC status value
|
||
|
addr_gaba=$(~/tests/./json_extracta /tmp/getaddressbyaccount result)
|
||
|
err_gaba=$(~/tests/./json_extracta /tmp/getaddressbyaccount error)
|
||
|
|
||
|
|
||
|
#split the string based on delims[,] and get the array of addresses returned in addr_gaba
|
||
|
|
||
|
addrs=$(echo $addr_gaba | tr "[,]" "\n")
|
||
|
|
||
|
if [ -z "$addrs" ]
|
||
|
then
|
||
|
printf "RESULT_GETADDRESSBYACCOUNT_ERROR\n"
|
||
|
printf "info: <Empty> address list returned by GETADDRESSBYACCOUNT RPC!\n\n"
|
||
|
let addr_unmatch+=1
|
||
|
|
||
|
else
|
||
|
|
||
|
|
||
|
for iguana_addrs in $addrs
|
||
|
do
|
||
|
|
||
|
# split the address string again based on delim "" from iguana_addrs
|
||
|
actual_addrs=($(echo $iguana_addrs | tr -d '""'))
|
||
|
|
||
|
# call GETACCOUNT RPC to get the account name associated with that address and match it with account created with RPC GETACCOUNTADDRESS
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaccount\",\"address\":\"$actual_addrs\"}"> /tmp/getaccount
|
||
|
|
||
|
# call json_extract script to get the RPC status value
|
||
|
acc_name=$(~/tests/./json_extract /tmp/getaccount account)
|
||
|
|
||
|
if [ "$acc_name" != "$acc_gaa" ]
|
||
|
then
|
||
|
printf "RESULT_GETACCOUNTBYADDRESS_ERROR MISMATCH(ACCOUNT -> %s\n)" "$acc_name"
|
||
|
printf "info: ACCOUNT name should be iguana becuase all addresses associated with IGUANA account\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$acc_name" == "$acc_gaa" ]
|
||
|
then
|
||
|
let addr_match+=1
|
||
|
IGUANA_ADDR=$actual_addrs
|
||
|
|
||
|
else
|
||
|
let addr_unmatch+=1
|
||
|
printf "RESULT_MISMATCH_addr:%s\n" "$actual_addrs"
|
||
|
fi
|
||
|
|
||
|
done
|
||
|
fi
|
||
|
|
||
|
if [ "$addr_unmatch" -eq 0 ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC GETADDRESSBYACCOUNT\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/getaddressbyaccount
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC GETADDRESSBYACCOUNT\n\n"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
#SETTX RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: SETTX]\n"
|
||
|
printf "=====================================\n"
|
||
|
|
||
|
~/tests/./settx > /tmp/settx
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC results value
|
||
|
r_st=$(~/tests/./json_extracti /tmp/settx result)
|
||
|
err_st=$(~/tests/./json_extracti /tmp/settx error)
|
||
|
|
||
|
if [ "$r_st" != "true" ]
|
||
|
then
|
||
|
printf "RESULT_SETTX_ERROR MISMATCH(result -> %s)\n" "$r_st"
|
||
|
printf "info: settx should <true>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$r_st" == "true" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC SETTX\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/settx
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC SETTX\n"
|
||
|
printf "ERROR: %s \n\n" "$err_st"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
#GETBESTBLOCKHASH RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: GETBESTBLOCKHASH]\n"
|
||
|
printf "=====================================\n"
|
||
|
|
||
|
~/tests/./getbestblockhash > /tmp/getbestblockhash
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC results value
|
||
|
r_gbbh=$(~/tests/./json_extract /tmp/getbestblockhash result)
|
||
|
err_gbbh=$(~/tests/./json_extract /tmp/getbestblockhash error)
|
||
|
|
||
|
if [ "$r_gbbh" == "" ]
|
||
|
then
|
||
|
printf "RESULT_GETBESTBLOCKHASH_ERROR\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$r_gbbh" != "0000000000000000000000000000000000000000000000000000000000000000" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC GETBESTBLOCKHASH\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/getbestblockhash
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC GETBESTBLOCKHASH\n\n"
|
||
|
printf "ERROR: %s \n\n" "$err_gbbh"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
|
||
|
#GETBLOCKHASH RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: GETBLOCKHASH]\n"
|
||
|
printf "=====================================\n"
|
||
|
|
||
|
~/tests/./getblockhash > /tmp/getblockhash
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC results value
|
||
|
r_gbh=$(~/tests/./json_extract /tmp/getblockhash result)
|
||
|
err_gbh=$(~/tests/./json_extract /tmp/getblockhash error)
|
||
|
|
||
|
if [ "$r_gbh" != "50a4f738d4319ad1f437df56ec90fdfb2592b95f5508db379c41227b2cc992c0" ]
|
||
|
then
|
||
|
printf "RESULT_GETBLOCKHASH_ERROR MISMATCH (hash -> %s)\n\n" "$r_gbh"
|
||
|
printf "info: Hash should be <50a4f738d4319ad1f437df56ec90fdfb2592b95f5508db379c41227b2cc992c0>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$r_gbh" == "50a4f738d4319ad1f437df56ec90fdfb2592b95f5508db379c41227b2cc992c0" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC GETBLOCKHASH\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/getblockhash
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC GETBLOCKHASH\n\n"
|
||
|
printf "ERROR: %s\n\n" "$err_gaa"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
|
||
|
#GETBLOCK RPC
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: GETBLOCK]\n"
|
||
|
printf "============================\n"
|
||
|
|
||
|
~/tests/./getblock > /tmp/getblock
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC results value
|
||
|
r_gb=$(~/tests/./json_extract /tmp/getblock result)
|
||
|
bh_gb=$(~/tests/./json_extract /tmp/getblock hash)
|
||
|
h_gb=$(~/tests/./json_extracti /tmp/getblock height)
|
||
|
ver_gb=$(~/tests/./json_extracti /tmp/getblock version)
|
||
|
prvblock_gb=$(~/tests/./json_extract /tmp/getblock previousblockhash)
|
||
|
nxtblock_gb=$(~/tests/./json_extract /tmp/getblock nextblockhash)
|
||
|
err_gb=$(~/tests/./json_extract /tmp/getblock error)
|
||
|
|
||
|
# get previous block header hash
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getblockhash\",\"height\":\"345323\"}" > /tmp/prvblockheader
|
||
|
|
||
|
prvbh=$(./json_extract /tmp/prvblockheader result)
|
||
|
|
||
|
# get nex block header hash
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getblockhash\",\"height\":\"345325\"}" > /tmp/nxtblockheader
|
||
|
|
||
|
nxtbh=$(./json_extract /tmp/nxtblockheader result)
|
||
|
|
||
|
if [ "$r_gb" != "success" ]
|
||
|
then
|
||
|
printf "RESULT_GETBLOCK_ERROR MISMATCH ( RESULT -> %s)\n" "$r_gb"
|
||
|
printf "info: RESULT should be <success>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$bh_gb" != "$r_gbh" ]
|
||
|
then
|
||
|
printf "RESULT_GETBLOCK_ERROR MISMATCH ( HASH -> %s)\n" "$bh_gb"
|
||
|
printf "info: HASH should be <%s>\n\n" "$r_gbh"
|
||
|
fi
|
||
|
|
||
|
if [ "$h_gb" -ne 345324 ]
|
||
|
then
|
||
|
printf "RESULT_GETBLOCK_ERROR MISMATCH ( HEIGHT -> %d)\n" "$h_gb"
|
||
|
printf "info: Height should be <345324>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$ver_gb" -ne 1 ]
|
||
|
then
|
||
|
printf "RESULT_GETBLOCK_ERROR MISMATCH (VERSION -> %d)\n" "$ver_gb"
|
||
|
printf "info: Version should be <1>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$prvblock_gb" != "$prvbh" ]
|
||
|
then
|
||
|
printf "RESULT_GETBLOCK_ERROR MISMATCH(PRVIOUS_BLOCK -> %s)\n" "$prvblock_gb"
|
||
|
printf "info: Previous block should be <%s>\n\n" "$prvbh"
|
||
|
fi
|
||
|
|
||
|
if [ "$nxtblock_gb" != "$nxtbh" ]
|
||
|
then
|
||
|
printf "RESULT_GETBLOCK_ERROR MISMATCH (NEXT_BLOCK -> %s)\n" "$nxtblock_gb"
|
||
|
printf "info: Next Block should be <%s>\n\n" "$nxtbh"
|
||
|
fi
|
||
|
|
||
|
if [ "$r_gb" == "success" ] && [ "$bh_gb" == "$r_gbh" ] && [ "$h_gb" -eq 345324 ] && [ "$ver_gb" -eq 1 ] && [ "$prvblock_gb" == "$prvbh" ] && [ "$nxtblock_gb" == "$nxtbh" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC GETBLOCK\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/getblock
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC GETBLOCK\n"
|
||
|
printf "ERROR: %s : %s\n\n" "$err_gb"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
#GETNEWADDRESS RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: GETNEWADDRESS]\n"
|
||
|
printf "=====================================\n"
|
||
|
|
||
|
~/tests/./getnewaddress > /tmp/getnewaddress
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC results value
|
||
|
r_gna=$(~/tests/./json_extract /tmp/getnewaddress result)
|
||
|
c_gna=$(~/tests/./json_extract /tmp/getnewaddress coin)
|
||
|
acc_gna=$(~/tests/./json_extract /tmp/getnewaddress account)
|
||
|
addr_gna=$(~/tests/./json_extract /tmp/getnewaddress address)
|
||
|
err_gna=$(~/tests/./json_extract /tmp/getnewaddress error)
|
||
|
|
||
|
if [ "$addr_gna" == "" ]
|
||
|
then
|
||
|
printf "RESULT_GETNEWADDRESS_ERROR MISMATCH(ADDRESS -> %s)\n" "$addr_gna"
|
||
|
printf "info: <EMPTY> ADDRESS was generated!\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$acc_gna" != "IGUANA" ]
|
||
|
then
|
||
|
printf "RESULT_GETNEWADDRESS_ERROR MISMATCH (ACCOUNT -> %s)\n" "$acc_gna"
|
||
|
printf "info: Account name should be <IGUANA>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$r_gna" != "success" ]
|
||
|
then
|
||
|
printf "RESULT_GETNEWADDRESS_ERROR MISMATCH (RESULT -> %s)\n" "$r_gna"
|
||
|
printf "info: Result should be <success>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$c_gna" != "$startCoin" ]
|
||
|
then
|
||
|
printf "RESULT_GETNEWADDRESS_ERROR MISMATCH (COIN -> %s)\n" "$c_gna"
|
||
|
printf "info: Coin should be <%s>!\n\n" "$startCoin"
|
||
|
fi
|
||
|
|
||
|
|
||
|
if [ "$r_gna" == "success" ] && [ "$c_gna" == "$startCoin" ] && [ "$acc_gna" == "IGUANA" ] && [ "$addr_gna" != "" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC GETNEWADDRESS\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/getnewaddress
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC GETNEWADDRESS\n"
|
||
|
printf "ERROR: %s:\n\n" "$err_gna"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
#SIGNMESSAGE RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: SIGNMESSAGE]\n"
|
||
|
printf "=====================================\n"
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"signmessage\",\"address\":\"$addr_gna\",\"message\":\"testMessage\"}" > /tmp/signmessage
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC results value
|
||
|
r_sm=$(~/tests/./json_extract /tmp/signmessage result)
|
||
|
err_sm=$(~/tests/./json_extract /tmp/signmessage error)
|
||
|
|
||
|
if [ "$r_sm" == "" ]
|
||
|
then
|
||
|
printf "RESULT_SIGNMESSAGE_ERROR MISMATCH(result -> %s)\n" "$r_sm"
|
||
|
printf "info: <EMPTY> SIGNMESSAGE was generated!\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$r_sm" != "" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC SIGNMESSAGE\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/signmessage
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC SIGNMESSAGE\n"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
#VERIFYMESSAGE RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: VERIFYMESSAGE]\n"
|
||
|
printf "=====================================\n"
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"verifymessage\",\"address\":\"$addr_gna\",\"sig\":\"$r_sm\",\"message\":\"testMessage\"}" > /tmp/verifymessage
|
||
|
printf "\n"
|
||
|
|
||
|
# call json_extract script to get the RPC results value
|
||
|
r_vm=$(~/tests/./json_extract /tmp/verifymessage result)
|
||
|
addr_vm=$(~/tests/./json_extract /tmp/verifymessage address)
|
||
|
m_vm=$(~/tests/./json_extract /tmp/verifymessage message)
|
||
|
err_vm=$(~/tests/./json_extract /tmp/verifymessage error)
|
||
|
|
||
|
if [ "$r_vm" != "true" ]
|
||
|
then
|
||
|
printf "RESULT_VERIFYMESSAGE_ERROR MISMATCH(result -> %s)\n" "$r_vm"
|
||
|
printf "info: Result should have been <true>\n\n"
|
||
|
fi
|
||
|
|
||
|
if [ "$addr_vm" != "$addr_gna" ]
|
||
|
then
|
||
|
printf "RESULT_VERIFYMESSAGE_ERROR MISMATCH(addr -> %s)\n" "$addr_vm"
|
||
|
printf "info: Address should have been <%s>\n\n" "$addr_vm"
|
||
|
fi
|
||
|
|
||
|
if [ "$m_vm" != "testMessage" ]
|
||
|
then
|
||
|
printf "RESULT_VERIFYMESSAGE_ERROR MISMATCH(Message -> %s)\n" "$m_vm"
|
||
|
printf "info: Message should have been <testMessage>\n\n"
|
||
|
fi
|
||
|
|
||
|
|
||
|
|
||
|
if [ "$r_vm" == "true" ] && [ "$addr_vm" == "$addr_gna" ] && [ "$m_vm" == "testMessage" ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC VERIFYMESSAGE\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/verifymessage
|
||
|
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC VERIFYMESSAGE\n"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
|
||
|
#SETACCOUNT RPC
|
||
|
sleep 3
|
||
|
printf "\n"
|
||
|
|
||
|
printf "Executing [RPC: SETACCOUNT]\n"
|
||
|
printf "=====================================\n"
|
||
|
|
||
|
result=$(curl -s --url "http://127.0.0.1:7778" --data "{\"method\":\"setaccount\",\"params\":[\"$addr_gna\", \"iguana_change\"]}")
|
||
|
printf "\n"
|
||
|
|
||
|
# Executing getaddressbyaccount rpc to verify that setaccout rpc has successfully associate the particular address to particular account
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaddressesbyaccount\",\"account\":\"iguana_change\"}" >/tmp/iguana_change
|
||
|
|
||
|
|
||
|
# call json_extract script to get the RPC status value
|
||
|
addr_sa=$(~/tests/./json_extracta /tmp/iguana_change result)
|
||
|
err_sa=$(~/tests/./json_extracta /tmp/iguana_change error)
|
||
|
|
||
|
|
||
|
#split the string based on delims[,] and get the array of addresses returned in addr_gaba
|
||
|
|
||
|
addrs_sa=$(echo $addr_sa | tr "[,]" "\n")
|
||
|
|
||
|
if [ -z "$addrs_sa" ]
|
||
|
then
|
||
|
printf "RESULT_SETACCOUNT_ERROR\n"
|
||
|
printf "info: <Empty> address list returned by SETACCOUNT RPC!\n\n"
|
||
|
let addr_unmatch_sa+=1
|
||
|
|
||
|
else
|
||
|
|
||
|
for iguana_addr in $addrs_sa
|
||
|
do
|
||
|
|
||
|
# split the address string again based on delim "" from iguana_addrs
|
||
|
actual_addr_sa=($(echo $iguana_addr | tr -d '""'))
|
||
|
|
||
|
# call GETACCOUNT RPC to get the account name associated with that address and match it with account created with RPC GETNEWADDRESS
|
||
|
|
||
|
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaccount\",\"address\":\"$actual_addr_sa\"}"> /tmp/getaccount
|
||
|
|
||
|
# call json_extract script to get the RPC status value
|
||
|
acc_name_sa=$(~/tests/./json_extract /tmp/getaccount account)
|
||
|
|
||
|
if [ "$acc_name_sa" != "iguana_change" ]
|
||
|
then
|
||
|
printf "RESULT_SETACCOUNT_ERROR MISMATCH(ACCOUNT -> %s\n)" "$acc_name_sa"
|
||
|
printf "info: ACCOUNT name should be iguana_change\n\n"
|
||
|
let addr_unmatch_sa+=1
|
||
|
|
||
|
fi
|
||
|
|
||
|
if [ "$addr_gna" != "$actual_addr_sa" ]
|
||
|
then
|
||
|
printf "RESULT_SETACCOUNT_ERROR MISMATCH(ADDRESS -> %s\n)" "$actual_addr_sa"
|
||
|
printf "info: ADDRESS should be <%s>\n\n" "$addr_gna"
|
||
|
let addr_unmatch_sa+=1
|
||
|
|
||
|
|
||
|
fi
|
||
|
|
||
|
if [ "$addr_unmatch_sa" -eq 0 ]
|
||
|
then
|
||
|
let addr_match_sa+=1
|
||
|
|
||
|
else
|
||
|
let addr_unmatch_sa+=1
|
||
|
fi
|
||
|
|
||
|
done
|
||
|
fi
|
||
|
|
||
|
if [ "$addr_unmatch_sa" -eq 0 ]
|
||
|
then
|
||
|
printf "RESULT_PASSED: RPC SETACCOUNT\n\n"
|
||
|
let passed+=1
|
||
|
rm -f /tmp/getaddressbyaccount
|
||
|
else
|
||
|
printf "RESULT_FAILED: RPC SETACCOUNT\n\n"
|
||
|
let failed+=1
|
||
|
fi
|
||
|
|
||
|
printf "\n\n"
|
||
|
printf "Regression Test FINISHED: PASSED=%i FAILED=%i\n" "$passed" "$failed"
|
||
|
printf "\n"
|
||
|
|
||
|
|