diff --git a/tests/regtest/regtest.sh b/tests/regtest/regtest.sh index 4389e5ed7..b206fc209 100755 --- a/tests/regtest/regtest.sh +++ b/tests/regtest/regtest.sh @@ -2,6 +2,8 @@ export HOME=~ set -eu +TEST_ANCHOR_CHANNELS=True + # alice -> bob -> carol alice="./run_electrum --regtest -D /tmp/alice" @@ -89,6 +91,7 @@ if [[ $1 == "init" ]]; then rm -rf /tmp/$2/ agent="./run_electrum --regtest -D /tmp/$2" $agent create --offline > /dev/null + $agent setconfig --offline enable_anchor_channels $TEST_ANCHOR_CHANNELS $agent setconfig --offline log_to_file True $agent setconfig --offline use_gossip True $agent setconfig --offline server 127.0.0.1:51001:t @@ -169,7 +172,8 @@ if [[ $1 == "backup" ]]; then $alice request_force_close $channel1 echo "request force close $channel2" $alice request_force_close $channel2 - wait_for_balance alice 0.998 + new_blocks 1 + wait_for_balance alice 0.997 fi @@ -418,8 +422,16 @@ if [[ $1 == "breach_with_spent_htlc" ]]; then $alice load_wallet -w /tmp/alice/regtest/wallets/toxic_wallet # wait until alice has spent both ctx outputs echo "alice spends to_local and htlc outputs" - wait_until_spent $ctx_id 0 - wait_until_spent $ctx_id 1 + if [ $TEST_ANCHOR_CHANNELS = True ] ; then + # to_local_anchor/to_remote_anchor: 0 and 1 (both are present due to untrimmed htlcs) + # htlc: 2, to_local: 3 + wait_until_spent $ctx_id 2 + wait_until_spent $ctx_id 3 + else + # htlc: 0, to_local: 1 + wait_until_spent $ctx_id 0 + wait_until_spent $ctx_id 1 + fi new_blocks 1 echo "bob comes back" $bob daemon -d @@ -458,7 +470,12 @@ if [[ $1 == "watchtower" ]]; then ctx_id=$($bitcoin_cli sendrawtransaction $ctx) echo "alice breaches with old ctx:" $ctx_id echo "watchtower publishes justice transaction" - wait_until_spent $ctx_id 1 # alice's to_local gets punished immediately + if [ $TEST_ANCHOR_CHANNELS = True ] ; then + output_index=3 + else + output_index=1 + fi + wait_until_spent $ctx_id $output_index # alice's to_local gets punished fi if [[ $1 == "just_in_time" ]]; then