enable anchor_channels for regtest
* lower the final balance of the backup regtest, which is due to additional sweep transactions * adapt ctx index
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
export HOME=~
|
export HOME=~
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
TEST_ANCHOR_CHANNELS=True
|
||||||
|
|
||||||
# alice -> bob -> carol
|
# alice -> bob -> carol
|
||||||
|
|
||||||
alice="./run_electrum --regtest -D /tmp/alice"
|
alice="./run_electrum --regtest -D /tmp/alice"
|
||||||
@@ -89,6 +91,7 @@ if [[ $1 == "init" ]]; then
|
|||||||
rm -rf /tmp/$2/
|
rm -rf /tmp/$2/
|
||||||
agent="./run_electrum --regtest -D /tmp/$2"
|
agent="./run_electrum --regtest -D /tmp/$2"
|
||||||
$agent create --offline > /dev/null
|
$agent create --offline > /dev/null
|
||||||
|
$agent setconfig --offline enable_anchor_channels $TEST_ANCHOR_CHANNELS
|
||||||
$agent setconfig --offline log_to_file True
|
$agent setconfig --offline log_to_file True
|
||||||
$agent setconfig --offline use_gossip True
|
$agent setconfig --offline use_gossip True
|
||||||
$agent setconfig --offline server 127.0.0.1:51001:t
|
$agent setconfig --offline server 127.0.0.1:51001:t
|
||||||
@@ -169,7 +172,8 @@ if [[ $1 == "backup" ]]; then
|
|||||||
$alice request_force_close $channel1
|
$alice request_force_close $channel1
|
||||||
echo "request force close $channel2"
|
echo "request force close $channel2"
|
||||||
$alice 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
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -418,8 +422,16 @@ if [[ $1 == "breach_with_spent_htlc" ]]; then
|
|||||||
$alice load_wallet -w /tmp/alice/regtest/wallets/toxic_wallet
|
$alice load_wallet -w /tmp/alice/regtest/wallets/toxic_wallet
|
||||||
# wait until alice has spent both ctx outputs
|
# wait until alice has spent both ctx outputs
|
||||||
echo "alice spends to_local and htlc outputs"
|
echo "alice spends to_local and htlc outputs"
|
||||||
wait_until_spent $ctx_id 0
|
if [ $TEST_ANCHOR_CHANNELS = True ] ; then
|
||||||
wait_until_spent $ctx_id 1
|
# 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
|
new_blocks 1
|
||||||
echo "bob comes back"
|
echo "bob comes back"
|
||||||
$bob daemon -d
|
$bob daemon -d
|
||||||
@@ -458,7 +470,12 @@ if [[ $1 == "watchtower" ]]; then
|
|||||||
ctx_id=$($bitcoin_cli sendrawtransaction $ctx)
|
ctx_id=$($bitcoin_cli sendrawtransaction $ctx)
|
||||||
echo "alice breaches with old ctx:" $ctx_id
|
echo "alice breaches with old ctx:" $ctx_id
|
||||||
echo "watchtower publishes justice transaction"
|
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
|
fi
|
||||||
|
|
||||||
if [[ $1 == "just_in_time" ]]; then
|
if [[ $1 == "just_in_time" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user