Skip to content

Commit 98ecd9f

Browse files
committed
fix: move native asset test before restart, remove redundant block_wait, add mint send error handling
1 parent 809983d commit 98ecd9f

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

plugin/dapp/rgbx/cmd/ci/docker-compose.sh

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -720,15 +720,30 @@ function scenario_native_asset_mint() {
720720
# genesis_out format for mint: hash:index:pkScript
721721
local genesis_out="${utxo_txid}:${utxo_vout}:${utxo_pkscript}"
722722

723+
# Verify chain33 is producing blocks before mint
724+
local pre_height
725+
pre_height=$(${MAIN_CLI} block last_header | jq '.height')
726+
log_step "chain33 height before mint: ${pre_height}"
727+
723728
# 2. Mint a native asset on chain33 with the genesis UTXO
724729
local mint_hash
725-
mint_hash=$(${MAIN_CLI} send rgbx mint -s NATIVE1 -a 10000 -o "${genesis_out}" -m "6e6174697665316d657461" -k "${GENESIS_KEY}" 2>/dev/null)
726-
if [ -z "${mint_hash}" ] || [ ${#mint_hash} -lt 64 ]; then
727-
fail "native mint send failed, hash=${mint_hash}"
730+
local mint_rc
731+
local mint_stdout
732+
mint_stdout=$(${MAIN_CLI} send rgbx mint -s NATIVE1 -a 10000 -o "${genesis_out}" -m "6e6174697665316d657461" -k "${GENESIS_KEY}" 2>/tmp/mint_stderr.$$)
733+
mint_rc=$?
734+
mint_hash="${mint_stdout}"
735+
if [ ${mint_rc} -ne 0 ] || [ -z "${mint_hash}" ] || [ ${#mint_hash} -lt 64 ]; then
736+
log_step "mint send stderr: $(head -5 /tmp/mint_stderr.$$ 2>/dev/null)"
737+
rm -f /tmp/mint_stderr.$$
738+
fail "native mint send failed, rc=${mint_rc}, hash=${mint_hash}"
728739
fi
740+
rm -f /tmp/mint_stderr.$$
729741

730742
# Wait for mint tx to be confirmed on chain33
731-
block_wait "${MAIN_CLI}" 1
743+
# send command already waits for the tx to be committed in a block
744+
local post_height
745+
post_height=$(${MAIN_CLI} block last_header | jq '.height')
746+
log_step "mint tx hash: ${mint_hash}, height after mint: ${post_height}"
732747

733748
# 3. Get the full mint tx hash from chain33 for OP_RETURN commitment
734749
# The send output gives us the chain33 tx hash hex (may contain 0x prefix)
@@ -804,8 +819,9 @@ function run_tests() {
804819
scenario_user_deposit_via_btc_tx
805820
scenario_user_transfer_crosschain_asset
806821
scenario_user_withdraw_auto_confirm
807-
scenario_restart_recovery
822+
# Run native asset test before restart so chain33 consensus is stable
808823
scenario_native_asset_mint
824+
scenario_restart_recovery
809825
}
810826

811827
function run_native_tests() {

0 commit comments

Comments
 (0)