1
0

Replace lightning_settle_delay with enable_htlc_settle (asyncio.Event)

This commit is contained in:
ThomasV
2020-02-27 20:53:50 +01:00
parent ce81957d25
commit 077f778632
5 changed files with 27 additions and 16 deletions

View File

@@ -162,7 +162,7 @@ if [[ $1 == "breach" ]]; then
fi
if [[ $1 == "redeem_htlcs" ]]; then
$bob setconfig lightning_settle_delay 10
$bob enable_htlc_settle false
wait_for_balance alice 1
echo "alice opens channel"
bob_node=$($bob nodeid)
@@ -172,10 +172,9 @@ if [[ $1 == "redeem_htlcs" ]]; then
# alice pays bob
invoice=$($bob add_lightning_request 0.05 -m "test")
$alice lnpay $invoice --timeout=1 || true
sleep 1
settled=$($alice list_channels | jq '.[] | .local_htlcs | .settles | length')
if [[ "$settled" != "0" ]]; then
echo 'SETTLE_DELAY did not work'
echo 'enable_htlc_settle did not work'
exit 1
fi
# bob goes away
@@ -205,7 +204,7 @@ fi
if [[ $1 == "breach_with_unspent_htlc" ]]; then
$bob setconfig lightning_settle_delay 3
$bob enable_htlc_settle false
wait_for_balance alice 1
echo "alice opens channel"
bob_node=$($bob nodeid)
@@ -217,14 +216,14 @@ if [[ $1 == "breach_with_unspent_htlc" ]]; then
$alice lnpay $invoice --timeout=1 || true
settled=$($alice list_channels | jq '.[] | .local_htlcs | .settles | length')
if [[ "$settled" != "0" ]]; then
echo "SETTLE_DELAY did not work, $settled != 0"
echo "enable_htlc_settle did not work, $settled != 0"
exit 1
fi
ctx=$($alice get_channel_ctx $channel)
sleep 5
$bob enable_htlc_settle true
settled=$($alice list_channels | jq '.[] | .local_htlcs | .settles | length')
if [[ "$settled" != "1" ]]; then
echo "SETTLE_DELAY did not work, $settled != 1"
echo "enable_htlc_settle did not work, $settled != 1"
exit 1
fi
echo "alice breaches with old ctx"
@@ -234,7 +233,7 @@ fi
if [[ $1 == "breach_with_spent_htlc" ]]; then
$bob setconfig lightning_settle_delay 3
$bob enable_htlc_settle false
wait_for_balance alice 1
echo "alice opens channel"
bob_node=$($bob nodeid)
@@ -247,14 +246,14 @@ if [[ $1 == "breach_with_spent_htlc" ]]; then
ctx=$($alice get_channel_ctx $channel)
settled=$($alice list_channels | jq '.[] | .local_htlcs | .settles | length')
if [[ "$settled" != "0" ]]; then
echo "SETTLE_DELAY did not work, $settled != 0"
echo "enable_htlc_settle did not work, $settled != 0"
exit 1
fi
cp /tmp/alice/regtest/wallets/default_wallet /tmp/alice/regtest/wallets/toxic_wallet
sleep 5
$bob enable_htlc_settle true
settled=$($alice list_channels | jq '.[] | .local_htlcs | .settles | length')
if [[ "$settled" != "1" ]]; then
echo "SETTLE_DELAY did not work, $settled != 1"
echo "enable_htlc_settle did not work, $settled != 1"
exit 1
fi
echo $($bob getbalance)