Commit 6ae42d0a authored by pengjun's avatar pengjun

add block wait

parent e8e52a49
...@@ -66,7 +66,6 @@ function query_tx() { ...@@ -66,7 +66,6 @@ function query_tx() {
pokerbull_PlayRawTx() { pokerbull_PlayRawTx() {
echo "========== # pokerbull play tx begin ==========" echo "========== # pokerbull play tx begin =========="
tx=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Play","payload":{"gameId":"pokerbull-abc", "value":"1000000000", "round":1}}]}' ${MAIN_HTTP} | jq -r ".result") tx=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Play","payload":{"gameId":"pokerbull-abc", "value":"1000000000", "round":1}}]}' ${MAIN_HTTP} | jq -r ".result")
PLAY_TX=$tx
data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]") data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer == "pokerbull")' <<<"$data") ok=$(jq '(.execer == "pokerbull")' <<<"$data")
...@@ -76,12 +75,13 @@ pokerbull_PlayRawTx() { ...@@ -76,12 +75,13 @@ pokerbull_PlayRawTx() {
signrawtx "$tx" "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" "play" signrawtx "$tx" "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" "play"
echo "========== # pokerbull play tx end ==========" echo "========== # pokerbull play tx end =========="
block_wait 1
} }
pokerbull_QuitRawTx() { pokerbull_QuitRawTx() {
echo "========== # pokerbull quit tx begin ==========" echo "========== # pokerbull quit tx begin =========="
tx=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Quit","payload":{"gameId":"'$GAME_ID'"}}]}' ${MAIN_HTTP} | jq -r ".result") tx=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Quit","payload":{"gameId":"'$GAME_ID'"}}]}' ${MAIN_HTTP} | jq -r ".result")
QUIT_TX=$tx
data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]") data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer == "pokerbull")' <<<"$data") ok=$(jq '(.execer == "pokerbull")' <<<"$data")
...@@ -91,12 +91,13 @@ pokerbull_QuitRawTx() { ...@@ -91,12 +91,13 @@ pokerbull_QuitRawTx() {
signrawtx "$tx" "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" "quit" signrawtx "$tx" "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" "quit"
echo "========== # pokerbull quit tx end ==========" echo "========== # pokerbull quit tx end =========="
block_wait 1
} }
pokerbull_ContinueRawTx() { pokerbull_ContinueRawTx() {
echo "========== # pokerbull continue tx begin ==========" echo "========== # pokerbull continue tx begin =========="
tx=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Continue","payload":{"gameId":"'$GAME_ID'"}}]}' ${MAIN_HTTP} | jq -r ".result") tx=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Continue","payload":{"gameId":"'$GAME_ID'"}}]}' ${MAIN_HTTP} | jq -r ".result")
CONTINUE_TX=$tx
data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]") data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer == "pokerbull")' <<<"$data") ok=$(jq '(.execer == "pokerbull")' <<<"$data")
...@@ -106,6 +107,8 @@ pokerbull_ContinueRawTx() { ...@@ -106,6 +107,8 @@ pokerbull_ContinueRawTx() {
signrawtx "$tx" "0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588" "continue" signrawtx "$tx" "0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588" "continue"
echo "========== # pokerbull continue tx end ==========" echo "========== # pokerbull continue tx end =========="
block_wait 1
} }
pokerbull_StartRawTx() { pokerbull_StartRawTx() {
...@@ -120,6 +123,8 @@ pokerbull_StartRawTx() { ...@@ -120,6 +123,8 @@ pokerbull_StartRawTx() {
signrawtx "$tx" "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" "start" signrawtx "$tx" "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" "start"
echo "========== # pokerbull start tx end ==========" echo "========== # pokerbull start tx end =========="
block_wait 1
} }
pokerbull_QueryResult() { pokerbull_QueryResult() {
......
...@@ -64,7 +64,12 @@ function query_tx() { ...@@ -64,7 +64,12 @@ function query_tx() {
retrieve_Backup() { retrieve_Backup() {
echo "========== # retrieve backup begin ==========" echo "========== # retrieve backup begin =========="
tx=$(curl -ksd '{"method":"retrieve.CreateRawRetrieveBackupTx","params":[{"backupAddr":"'$1'","defaultAddr":"'$2'","delayPeriod":'$3'}]}' ${MAIN_HTTP} | jq -r ".result")
local backupaddr=$1
local defaultaddr=$2
local delayPeriod=$3
tx=$(curl -ksd '{"method":"retrieve.CreateRawRetrieveBackupTx","params":[{"backupAddr":"$backupaddr","defaultAddr":"$defaultaddr","delayPeriod": $delayPeriod}]}' ${MAIN_HTTP} | jq -r ".result")
data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]") data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer == "retrieve")' <<<"$data") ok=$(jq '(.execer == "retrieve")' <<<"$data")
...@@ -74,11 +79,17 @@ retrieve_Backup() { ...@@ -74,11 +79,17 @@ retrieve_Backup() {
signrawtx "$tx" "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" signrawtx "$tx" "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
echo "========== # retrieve backup end ==========" echo "========== # retrieve backup end =========="
block_wait 1
} }
retrieve_Prepare() { retrieve_Prepare() {
echo "========== # retrieve prepare begin ==========" echo "========== # retrieve prepare begin =========="
tx=$(curl -ksd '{"method":"retrieve.CreateRawRetrievePrepareTx","params":[{"backupAddr":"'$1'","defaultAddr":"'$2'"}]}' ${MAIN_HTTP} | jq -r ".result")
local backupaddr=$1
local defaultaddr=$2
tx=$(curl -ksd '{"method":"retrieve.CreateRawRetrievePrepareTx","params":[{"backupAddr":"$backupaddr","defaultAddr":"$defaultaddr"}]}' ${MAIN_HTTP} | jq -r ".result")
data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]") data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer == "retrieve")' <<<"$data") ok=$(jq '(.execer == "retrieve")' <<<"$data")
...@@ -88,11 +99,17 @@ retrieve_Prepare() { ...@@ -88,11 +99,17 @@ retrieve_Prepare() {
signrawtx "$tx" "0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588" signrawtx "$tx" "0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588"
echo "========== # retrieve prepare end ==========" echo "========== # retrieve prepare end =========="
block_wait 1
} }
retrieve_Perform() { retrieve_Perform() {
echo "========== # retrieve perform begin ==========" echo "========== # retrieve perform begin =========="
tx=$(curl -ksd '{"method":"retrieve.CreateRawRetrievePerformTx","params":[{"backupAddr":"'$1'","defaultAddr":"'$2'"}]}' ${MAIN_HTTP} | jq -r ".result")
local backupaddr=$1
local defaultaddr=$2
tx=$(curl -ksd '{"method":"retrieve.CreateRawRetrievePerformTx","params":[{"backupAddr":"$backupaddr","defaultAddr":"$defaultaddr"}]}' ${MAIN_HTTP} | jq -r ".result")
data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]") data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer == "retrieve")' <<<"$data") ok=$(jq '(.execer == "retrieve")' <<<"$data")
...@@ -102,11 +119,17 @@ retrieve_Perform() { ...@@ -102,11 +119,17 @@ retrieve_Perform() {
signrawtx "$tx" "0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588" signrawtx "$tx" "0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588"
echo "========== # retrieve perform end ==========" echo "========== # retrieve perform end =========="
block_wait 1
} }
retrieve_Cancel() { retrieve_Cancel() {
echo "========== # retrieve cancel begin ==========" echo "========== # retrieve cancel begin =========="
tx=$(curl -ksd '{"method":"retrieve.CreateRawRetrieveCancelTx","params":[{"backupAddr":"'$1'","defaultAddr":"'$2'"}]}' ${MAIN_HTTP} | jq -r ".result")
local backupaddr=$1
local defaultaddr=$2
tx=$(curl -ksd '{"method":"retrieve.CreateRawRetrieveCancelTx","params":[{"backupAddr":"$backupaddr","defaultAddr":"$defaultaddr"}]}' ${MAIN_HTTP} | jq -r ".result")
data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]") data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer == "retrieve")' <<<"$data") ok=$(jq '(.execer == "retrieve")' <<<"$data")
...@@ -116,12 +139,19 @@ retrieve_Cancel() { ...@@ -116,12 +139,19 @@ retrieve_Cancel() {
signrawtx "$tx" "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944" signrawtx "$tx" "CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
echo "========== # retrieve cancel end ==========" echo "========== # retrieve cancel end =========="
block_wait 1
} }
retrieve_QueryResult() { retrieve_QueryResult() {
echo "========== # retrieve query result begin ==========" echo "========== # retrieve query result begin =========="
data=$(curl -ksd '{"method":"Chain33.Query","params":[{"execer":"retrieve","funcName":"GetRetrieveInfo","payload":{"backupAddress":"'$1'", "defaultAddress":"'$2'"}}]}' ${MAIN_HTTP} | jq -r ".result")
ok=$(jq '(.status == '$3')' <<<"$data") local backupaddr=$1
local defaultaddr=$2
local status=$3
data=$(curl -ksd '{"method":"Chain33.Query","params":[{"execer":"retrieve","funcName":"GetRetrieveInfo","payload":{"backupAddress":"$backupaddr", "defaultAddress":"defaultaddr"}}]}' ${MAIN_HTTP} | jq -r ".result")
ok=$(jq '(.status == $3)' <<<"$data")
[ "$ok" == true ] [ "$ok" == true ]
echo_rst "$FUNCNAME" "$?" echo_rst "$FUNCNAME" "$?"
...@@ -144,7 +174,6 @@ chain33_ImportPrivkey() { ...@@ -144,7 +174,6 @@ chain33_ImportPrivkey() {
signrawtx() { signrawtx() {
txHex="$1" txHex="$1"
priKey="$2" priKey="$2"
type="$3"
local req='"method":"Chain33.SignRawTx","params":[{"privkey":"'"$priKey"'","txHex":"'"$txHex"'","expire":"120s"}]' local req='"method":"Chain33.SignRawTx","params":[{"privkey":"'"$priKey"'","txHex":"'"$txHex"'","expire":"120s"}]'
echo "#request SignRawTx: $req" echo "#request SignRawTx: $req"
signedTx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result") signedTx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment