diff --git a/tests/regtest/regtest.sh b/tests/regtest/regtest.sh index e51af808c..61873dc67 100755 --- a/tests/regtest/regtest.sh +++ b/tests/regtest/regtest.sh @@ -22,7 +22,7 @@ function wait_until_htlcs_settled() { msg="wait until $1's local_unsettled_sent is zero" cmd="./run_electrum --regtest -D /tmp/$1" - declare -i timeout_sec=30 + declare -i timeout_sec=120 declare -i elapsed_sec=0 while unsettled=$($cmd list_channels | jq '.[] | .local_unsettled_sent') && [ $unsettled != "0" ]; do @@ -44,7 +44,7 @@ function wait_for_balance() { msg="wait until $1's balance reaches $2" cmd="./run_electrum --regtest -D /tmp/$1" - declare -i timeout_sec=30 + declare -i timeout_sec=120 declare -i elapsed_sec=0 while balance=$($cmd getbalance | jq '[.confirmed, .unconfirmed] | to_entries | map(select(.value != null).value) | map(tonumber) | add ') && (( $(echo "$balance < $2" | bc -l) )); do @@ -65,7 +65,7 @@ function wait_until_channel_open() { msg="wait until $1 sees channel open" cmd="./run_electrum --regtest -D /tmp/$1" - declare -i timeout_sec=30 + declare -i timeout_sec=120 declare -i elapsed_sec=0 while channel_state=$($cmd list_channels | jq '.[0] | .state' | tr -d '"') && [ $channel_state != "OPEN" ]; do @@ -86,7 +86,7 @@ function wait_until_channel_closed() { msg="wait until $1 sees channel closed" cmd="./run_electrum --regtest -D /tmp/$1" - declare -i timeout_sec=30 + declare -i timeout_sec=120 declare -i elapsed_sec=0 while [[ $($cmd list_channels | jq '.[0].state' | tr -d '"') != "CLOSED" ]]; do @@ -107,7 +107,7 @@ function wait_until_preimage() { msg="wait until $1 has preimage for $2" cmd="./run_electrum --regtest -D /tmp/$1" - declare -i timeout_sec=30 + declare -i timeout_sec=120 declare -i elapsed_sec=0 while [[ $($cmd get_invoice $2 | jq '.preimage' | tr -d '"') == "null" ]]; do @@ -127,7 +127,7 @@ function wait_until_preimage() function wait_until_spent() { msg="wait until $1:$2 is spent" - declare -i timeout_sec=30 + declare -i timeout_sec=120 declare -i elapsed_sec=0 while [[ $($bitcoin_cli gettxout $1 $2) ]]; do @@ -758,13 +758,8 @@ if [[ $1 == "fw_fail_htlc" ]]; then wait_until_spent $ctx_id $output_index new_blocks 1 # confirm 2nd stage. sleep 1 - new_blocks 100 # deep - sleep 5 # give bob time to fail incoming htlc - unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent') - if [[ "$unsettled" != "0" ]]; then - echo 'alice htlc was not failed' - exit 1 - fi + new_blocks 100 # deep enough for is_deeply_mined (>20 confs) + wait_until_htlcs_settled alice # bob propagates the failure back once the HTLC-timeout tx is deeply mined fi if [[ $1 == "just_in_time" ]]; then