commit 7cbb102c81fa0a5d0e67ae0b516ce8c6614cc83a
parent ab188ff375d808f096c3596026be2769d818a9f0
Author: ThomasV <thomasv@electrum.org>
Date: Tue, 5 May 2020 09:04:17 +0200
add test with fail_malformed_htlc to forwarding regtest
Diffstat:
2 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/electrum/tests/regtest.py b/electrum/tests/regtest.py
@@ -56,9 +56,7 @@ class TestLightningABC(TestLightning):
agents = ['alice', 'bob', 'carol']
def test_forwarding(self):
- self.run_shell(['open'])
- self.run_shell(['alice_pays_carol'])
- self.run_shell(['close'])
+ self.run_shell(['forwarding'])
def test_watchtower(self):
self.run_shell(['watchtower'])
diff --git a/electrum/tests/regtest/regtest.sh b/electrum/tests/regtest/regtest.sh
@@ -102,37 +102,29 @@ if [[ $1 == "stop" ]]; then
$agent stop || true
fi
-if [[ $1 == "configure_test_forwarding" ]]; then
- $bob setconfig --offline lightning_forward_payments true
- # $carol setconfig --offline test_fail_malformed_htlc true # uncomment to test update_fail_malformed_htlc
-fi
-
-if [[ $1 == "open" ]]; then
+if [[ $1 == "forwarding" ]]; then
+ $bob setconfig lightning_forward_payments true
bob_node=$($bob nodeid)
channel_id1=$($alice open_channel $bob_node 0.002 --push_amount 0.001)
channel_id2=$($carol open_channel $bob_node 0.002 --push_amount 0.001)
echo "mining 3 blocks"
new_blocks 3
sleep 10 # time for channelDB
-fi
-
-if [[ $1 == "alice_pays_carol" ]]; then
request=$($carol add_lightning_request 0.0001 -m "blah")
+ $carol setconfig test_fail_malformed_htlc true
$alice lnpay $request
+ request2=$($carol add_lightning_request 0.0001 -m "blah")
+ $carol setconfig test_fail_malformed_htlc false
+ $alice lnpay $request2
carol_balance=$($carol list_channels | jq -r '.[0].local_balance')
echo "carol balance: $carol_balance"
if [[ $carol_balance != 110000 ]]; then
exit 1
fi
-fi
-
-if [[ $1 == "close" ]]; then
chan1=$($alice list_channels | jq -r ".[0].channel_point")
chan2=$($carol list_channels | jq -r ".[0].channel_point")
$alice close_channel $chan1
$carol close_channel $chan2
- echo "mining 1 block"
- new_blocks 1
fi
# alice sends two payments, then broadcast ctx after first payment.