diff --git a/bats/core/api/onchain-receive.bats b/bats/core/api/onchain-receive.bats index f5a4648284c..2275229789b 100644 --- a/bats/core/api/onchain-receive.bats +++ b/bats/core/api/onchain-receive.bats @@ -67,7 +67,7 @@ setup_file() { [[ "${on_chain_address_created_1}" != "null" ]] || exit 1 bitcoin_cli sendtoaddress "$on_chain_address_created_1" "$amount" - retry 15 1 check_for_broadcast 'alice' "$on_chain_address_created_1" + retry 15 1 check_for_incoming_broadcast 'alice' "$on_chain_address_created_1" # Create address and broadcast transaction 2 exec_graphql 'alice' 'on-chain-address-create' "$variables" @@ -75,7 +75,7 @@ setup_file() { [[ "${on_chain_address_created_2}" != "null" ]] || exit 1 bitcoin_cli sendtoaddress "$on_chain_address_created_2" "$amount" - retry 15 1 check_for_broadcast 'alice' "$on_chain_address_created_2" + retry 15 1 check_for_incoming_broadcast 'alice' "$on_chain_address_created_2" # Check pending transactions for address 1 address_1_pending_txns_variables=$( @@ -224,7 +224,7 @@ setup_file() { # Execute onchain send and check for transaction bitcoin_cli sendtoaddress "$on_chain_address_created" "$amount" - retry 15 1 check_for_broadcast 'alice' "$on_chain_address_created" + retry 15 1 check_for_incoming_broadcast 'alice' "$on_chain_address_created" # Check pending transactions for address address_pending_txns_variables=$( @@ -315,9 +315,9 @@ setup_file() { tx_hex=$(bitcoin_cli finalizepsbt "$signed_psbt" | jq -r '.hex') txid=$(bitcoin_cli sendrawtransaction "$tx_hex") - retry 15 1 check_for_broadcast 'alice' "$alice_address_1" - retry 3 1 check_for_broadcast 'alice' "$alice_address_2" - retry 3 1 check_for_broadcast 'bob' "$bob_address_1" + retry 15 1 check_for_incoming_broadcast 'alice' "$alice_address_1" + retry 3 1 check_for_incoming_broadcast 'alice' "$alice_address_2" + retry 3 1 check_for_incoming_broadcast 'bob' "$bob_address_1" # Check 'pendingIncomingBalance' query exec_graphql 'alice' 'wallets-for-account' @@ -406,9 +406,9 @@ setup_file() { tx_hex=$(bitcoin_cli finalizepsbt "$signed_psbt" | jq -r '.hex') txid=$(bitcoin_cli sendrawtransaction "$tx_hex") - retry 45 1 check_for_broadcast 'alice' "$alice_btc_address" - retry 3 1 check_for_broadcast 'alice' "$alice_usd_address" - retry 3 1 check_for_broadcast 'bob' "$bob_btc_address" + retry 45 1 check_for_incoming_broadcast 'alice' "$alice_btc_address" + retry 3 1 check_for_incoming_broadcast 'alice' "$alice_usd_address" + retry 3 1 check_for_incoming_broadcast 'bob' "$bob_btc_address" # Mine transactions # Note: subscription event operates in a delayed way from lnd1 state diff --git a/bats/helpers/onchain.bash b/bats/helpers/onchain.bash index bc6f49279b1..db6885d9199 100644 --- a/bats/helpers/onchain.bash +++ b/bats/helpers/onchain.bash @@ -54,7 +54,7 @@ get_from_pending_transaction_by_address() { | jq -r "$property_query" } -check_for_broadcast() { +check_for_incoming_broadcast() { local token_name=$1 local address=$2 diff --git a/core/api/test/bats/helpers/onchain.bash b/core/api/test/bats/helpers/onchain.bash index 07b58236cd5..12861a5de2c 100644 --- a/core/api/test/bats/helpers/onchain.bash +++ b/core/api/test/bats/helpers/onchain.bash @@ -31,44 +31,6 @@ get_from_pending_transaction_by_address() { | jq -r "$property_query" } -check_for_broadcast() { - local token_name=$1 - local address=$2 - - exec_graphql "$token_name" 'pending-incoming-transactions' - - tx="$(get_from_pending_transaction_by_address "$address" '.')" - [[ -n "${tx}" && "${tx}" != "null" ]] || exit 1 - txid="$(echo $tx | jq -r '.settlementVia.transactionHash')" - [[ "${txid}" != "null" ]] || exit 1 - status="$(echo $tx | jq -r '.status')" - [[ "${status}" == "PENDING" ]] || exit 1 - - bitcoin_cli gettransaction "$txid" || exit 1 -} - -check_for_outgoing_broadcast() { - local token_name=$1 - local address=$2 - local first=${3:-"1"} - - variables=$( - jq -n \ - --argjson first "$first" \ - '{"first": $first}' - ) - exec_graphql "$token_name" 'transactions' "$variables" - - tx="$(get_from_transaction_by_address "$address" '.')" - [[ -n "${tx}" && "${tx}" != "null" ]] || exit 1 - txid="$(echo $tx | jq -r '.settlementVia.transactionHash')" - [[ "${txid}" != "null" ]] || exit 1 - status="$(echo $tx | jq -r '.status')" - [[ "${status}" == "PENDING" ]] || exit 1 - - bitcoin_cli gettransaction "$txid" || exit 1 -} - check_for_onchain_initiated_settled() { local token_name=$1 local address=$2