http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != null)'"$FUNCNAME"".result"
http_req "$req"${MAIN_HTTP}"$resok""$FUNCNAME"
GAME_ADDR=$RAW_RESP
# local exector=$1
# local req='"method":"Chain33.ConvertExectoAddr","params":[{"execname":"'"${exector}"'"}]'
# echo "#request: $req"
# resp=$(curl -ksd "{$req}" "${MAIN_HTTP}")
# echo "#response: $resp"
# GAME_ADDR=$(echo "${res}" | jq -r ".result")
# echo_rst "$FUNCNAME" "$?"
}
}
function CreateGameTx(){
function CreateGameTx(){
local amount=$1
local amount=$1
local hash_value=$2
local hash_value=$2
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"createGame", "payload":{"amount": '"${amount}"',"hashType":"sha256","hashValue":"'"${hash_value}"'"}}]}'
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"createGame", "payload":{"amount": '"${amount}"',"hashType":"sha256","hashValue":"'"${hash_value}"'"}}]}'
http_req "$req"${MAIN_HTTP}"$resok""$FUNCNAME"
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != null)'"$FUNCNAME"".result"
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"matchGame", "payload":{"gameId": "'"${gameId}"'","guess":2}}]}'
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"matchGame", "payload":{"gameId": "'"${gameId}"'","guess":2}}]}'
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != null)'"MatchGame createRawTx"".result"
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != "")'"MatchGame createRawTx"
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"closeGame", "payload":{"gameId": "'"${gameId}"'","secret":"'"${secret}"'","result":1}}]}'
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"closeGame", "payload":{"gameId": "'"${gameId}"'","secret":"'"${secret}"'","result":1}}]}'
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != "")'"CloseGame createRawTx"
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != null)'"CloseGame createRawTx"".result"
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"cancelGame", "payload":{"gameId": "'"${gameId}"'"}}]}'
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"cancelGame", "payload":{"gameId": "'"${gameId}"'"}}]}'
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != "")'"CancleGame createRawTx"
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != null)'"CancleGame createRawTx"".result"
local req='{"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"QueryGameListByStatusAndAddr","payload":{"status":'"${status}"',"address":""}}]}'
local req='{"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"QueryGameListByStatusAndAddr","payload":{"status":'"${status}"',"address":""}}]}'
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result.games != "")'"$FUNCNAME"
# ok=$(jq '(.error|not) and (.result| [has("key","value"),true])' <<<"$resp")
# [ "$ok" == true ]
# local rst=$?
# echo_rst "$FUNCNAME" "$rst"
http_req '{"method":"paracross.GetNodeGroupAddrs","params":[{"title":"user.p.para."}]}'${UNIT_HTTP}'(.error|not) and (.result| [has("key","value"),true])'"$FUNCNAME"
http_req '{"method":"paracross.GetNodeGroupAddrs","params":[{"title":"user.p.para."}]}'${UNIT_HTTP}'(.error|not) and (.result| [has("key","value"),true])'"$FUNCNAME"
# ok=$(jq '(.error|not) and (.result| [has("status"),true])' <<<"$resp")
# [ "$ok" == true ]
# local rst=$?
# echo_rst "$FUNCNAME" "$rst"
http_req '{"method":"paracross.GetNodeGroupStatus","params":[{"title":"user.p.para."}]}'${UNIT_HTTP}'(.error|not) and (.result| [has("status"),true])'"$FUNCNAME"
http_req '{"method":"paracross.GetNodeGroupStatus","params":[{"title":"user.p.para."}]}'${UNIT_HTTP}'(.error|not) and (.result| [has("status"),true])'"$FUNCNAME"
# ok=$(jq '(.error|not) and (.result| [has("status"),true])' <<<"$resp")
# [ "$ok" == true ]
# local rst=$?
# echo_rst "$FUNCNAME" "$rst"
http_req '{"method":"paracross.ListNodeGroupStatus","params":[{"title":"user.p.para.","status":2}]}'${UNIT_HTTP}'(.error|not) and (.result| [has("status"),true])'"$FUNCNAME"
http_req '{"method":"paracross.ListNodeGroupStatus","params":[{"title":"user.p.para.","status":2}]}'${UNIT_HTTP}'(.error|not) and (.result| [has("status"),true])'"$FUNCNAME"
# ok=$(jq '(.error|not) and (.result| [has("status"),true])' <<<"$resp")
# [ "$ok" == true ]
# local rst=$?
# echo_rst "$FUNCNAME" "$rst"
http_req '{"method":"paracross.ListNodeStatus","params":[{"title":"user.p.para.","status":4}]}'${UNIT_HTTP}'(.error|not) and (.result| [has("status"),true])'"$FUNCNAME"
http_req '{"method":"paracross.ListNodeStatus","params":[{"title":"user.p.para.","status":4}]}'${UNIT_HTTP}'(.error|not) and (.result| [has("status"),true])'"$FUNCNAME"
}
}
...
@@ -360,7 +289,7 @@ function paracross_txgroupex() {
...
@@ -360,7 +289,7 @@ function paracross_txgroupex() {
}
}
//测试平行链交易组跨链失败,主链自动恢复原值
#测试平行链交易组跨链失败,主链自动恢复原值
function paracross_testTxGroupFail(){
function paracross_testTxGroupFail(){
local para_ip=$1
local para_ip=$1
...
@@ -375,7 +304,7 @@ function paracross_testTxGroupFail() {
...
@@ -375,7 +304,7 @@ function paracross_testTxGroupFail() {
#execer
#execer
local trade_exec_addr="12bihjzbaYWjcpDiiy9SuAWeqNksQdiN13"
local trade_exec_addr="12bihjzbaYWjcpDiiy9SuAWeqNksQdiN13"
local req='{"method":"relay.CreateRawRelaySaveBTCHeadTx","params":[{"hash":"5e7d9c599cd040ec2ba53f4dee28028710be8c135e779f65c56feadaae34c3f2","height":10,"version":536870912,"merkleRoot":"ab91cd4160e1379c337eee6b7a4bdbb7399d70268d86045aba150743c00c90b6","time":1530862108,"nonce":0,"bits":545259519,"previousHash":"604efe53975ab06cad8748fd703ad5bc960e8b752b2aae98f0f871a4a05abfc7","isReset":true}]}'
local req='{"method":"relay.CreateRawRelaySaveBTCHeadTx","params":[{"hash":"5e7d9c599cd040ec2ba53f4dee28028710be8c135e779f65c56feadaae34c3f2","height":10,"version":536870912,"merkleRoot":"ab91cd4160e1379c337eee6b7a4bdbb7399d70268d86045aba150743c00c90b6","time":1530862108,"nonce":0,"bits":545259519,"previousHash":"604efe53975ab06cad8748fd703ad5bc960e8b752b2aae98f0f871a4a05abfc7","isReset":true}]}'
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != "")'"$FUNCNAME"".result"
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != null)'"$FUNCNAME"".result"
local req='{"method":"relay.CreateRawRelaySaveBTCHeadTx","params":[{"hash":"7b7a4a9b49db5a1162be515d380cd186e98c2bf0bb90f1145485d7c43343fc7c","height":11,"version":536870912,"merkleRoot":"cfa9b66696aea63b7266ffaa1cb4b96c8dd6959eaabf2eb14173f4adaa551f6f","time":1530862108,"nonce":1,"bits":545259519,"previousHash":"5e7d9c599cd040ec2ba53f4dee28028710be8c135e779f65c56feadaae34c3f2","isReset":false}]}'
local req='{"method":"relay.CreateRawRelaySaveBTCHeadTx","params":[{"hash":"7b7a4a9b49db5a1162be515d380cd186e98c2bf0bb90f1145485d7c43343fc7c","height":11,"version":536870912,"merkleRoot":"cfa9b66696aea63b7266ffaa1cb4b96c8dd6959eaabf2eb14173f4adaa551f6f","time":1530862108,"nonce":1,"bits":545259519,"previousHash":"5e7d9c599cd040ec2ba53f4dee28028710be8c135e779f65c56feadaae34c3f2","isReset":false}]}'
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != "")'"$FUNCNAME"".result"
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != null)'"$FUNCNAME"".result"
local req='{"method":"relay.CreateRawRelayOrderTx","params":[{"operation":0,"coin":"BTC","amount":299000000,"addr":"1Am9UTGfdnxabvcywYG2hvzr6qK8T3oUZT","btyAmount":1000000000,"coinWaits":6}]}'
local req='{"method":"relay.CreateRawRelayOrderTx","params":[{"operation":0,"coin":"BTC","amount":299000000,"addr":"1Am9UTGfdnxabvcywYG2hvzr6qK8T3oUZT","btyAmount":1000000000,"coinWaits":6}]}'
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != "")'"$FUNCNAME"".result"
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != null)'"$FUNCNAME"".result"
local req='{"method":"relay.CreateRawRelayConfirmTx","params":[{"orderId":"'"$id"'","rawTx":"6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4"}]}'
local req='{"method":"relay.CreateRawRelayConfirmTx","params":[{"orderId":"'"$id"'","rawTx":"6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4"}]}'
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != "")'"$FUNCNAME"".result"
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result != null)'"$FUNCNAME"".result"
local req='{"method":"Chain33.Query", "params":[{"execer":"relay","funcName":"GetRelayOrderByStatus","payload":{"addr":"","status":"'"$status"'","coins":["BTC"],"pageNumber":0,"pageSize":0}}]}'
local req='{"method":"Chain33.Query", "params":[{"execer":"relay","funcName":"GetRelayOrderByStatus","payload":{"addr":"","status":"'"$status"'","coins":["BTC"],"pageNumber":0,"pageSize":0}}]}'
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result.relayorders[0].id != "")'"$FUNCNAME"
http_req "$req"${MAIN_HTTP}'(.error|not) and (.result.relayorders[0].id != null)'"$FUNCNAME"
}
}
query_GetSellRelayOrder(){
query_GetSellRelayOrder(){
local req='{"method":"Chain33.Query", "params":[{"execer":"relay","funcName":"GetSellRelayOrder","payload":{"addr":"1G5Cjy8LuQex2fuYv3gzb7B8MxAnxLEqt3","status":"pending","coins":["BTC"],"pageNumber":0,"pageSize":0}}]}'
local req='{"method":"Chain33.Query", "params":[{"execer":"relay","funcName":"GetSellRelayOrder","payload":{"addr":"1G5Cjy8LuQex2fuYv3gzb7B8MxAnxLEqt3","status":"pending","coins":["BTC"],"pageNumber":0,"pageSize":0}}]}'
resok='(.error|not) and (.result.relayorders[0].status == "pending") and (.result.relayorders[0].coinOperation == 0) and (.result.relayorders[0].id != "")'
resok='(.error|not) and (.result.relayorders[0].status == "pending") and (.result.relayorders[0].coinOperation == 0) and (.result.relayorders[0].id != null)'
echo"========== # retrieve perform end =========="
chain33_BlockWait 1 "${MAIN_HTTP}"
}
}
retrieve_Perform_Token(){
retrieve_Perform_Token(){
echo"========== # retrieve perform begin =========="
local req='{"method":"retrieve.CreateRawRetrievePerformTx","params":[{"backupAddr":"'$retrieve1'","defaultAddr":"'$retrieve2'","assets": [{"exec":"token","symbol":"'"$symbol"'"}] }]}'
local req='{"method":"retrieve.CreateRawRetrievePerformTx","params":[{"backupAddr":"'$retrieve1'","defaultAddr":"'$retrieve2'","assets": [{"exec":"token","symbol":"'"$symbol"'"}] }]}'
echo"========== # retrieve query result begin =========="
local status=$1
local status=$1
local req='{"method":"Chain33.Query","params":[{"execer":"retrieve","funcName":"GetRetrieveInfo","payload":{"backupAddress":"'$retrieve1'", "defaultAddress":"'$retrieve2'"}}]}'
local req='{"method":"Chain33.Query","params":[{"execer":"retrieve","funcName":"GetRetrieveInfo","payload":{"backupAddress":"'$retrieve1'", "defaultAddress":"'$retrieve2'"}}]}'
echo"========== # retrieve query result end =========="
}
}
retrieve_QueryAssetResult(){
retrieve_QueryAssetResult(){
echo"========== # retrieve query result begin =========="
local status=$1
local status=$1
local req='{"method":"Chain33.Query","params":[{"execer":"retrieve","funcName":"GetRetrieveInfo","payload":{"backupAddress":"'$retrieve1'", "defaultAddress":"'$retrieve2'","assetExec":"token", "assetSymbol":"'"$symbol"'"}}]}'
local req='{"method":"Chain33.Query","params":[{"execer":"retrieve","funcName":"GetRetrieveInfo","payload":{"backupAddress":"'$retrieve1'", "defaultAddress":"'$retrieve2'","assetExec":"token", "assetSymbol":"'"$symbol"'"}}]}'
resok='(.error|not) and (.result.tickets | length > 0) and (.result.tickets[0].minerAddress == "'"$minerAddr"'") and (.result.tickets[0].returnAddress == "'"$returnAddr"'")'
resok='(.error|not) and (.result.tickets | length > 0) and (.result.tickets[0].minerAddress == "'"$minerAddr"'") and (.result.tickets[0].returnAddress == "'"$returnAddr"'")'
resok='(.error|not) and (.result.tickets | length > 0) and (.result.tickets[0].minerAddress == "'"$minerAddr"'") and (.result.tickets[0].returnAddress == "'"$returnAddr"'") and (.result.tickets[0].status == '"$status"')'
resok='(.error|not) and (.result.tickets | length > 0) and (.result.tickets[0].minerAddress == "'"$minerAddr"'") and (.result.tickets[0].returnAddress == "'"$returnAddr"'") and (.result.tickets[0].status == '"$status"')'