Browse Source

regtest backups: test both cases (onchain and imported)

lnpeer: call close_and_cleanup() after we force close,
or the above test will fail.
patch-4
ThomasV 4 years ago
parent
commit
8b95b2127d
  1. 1
      electrum/lnpeer.py
  2. 14
      electrum/tests/regtest/regtest.sh

1
electrum/lnpeer.py

@ -1081,6 +1081,7 @@ class Peer(Logger):
elif we_are_ahead:
self.logger.warning(f"channel_reestablish ({chan.get_id_for_log()}): we are ahead of remote! trying to force-close.")
await self.lnworker.try_force_closing(chan_id)
self.close_and_cleanup()
return
chan.peer_state = PeerState.GOOD

14
electrum/tests/regtest/regtest.sh

@ -137,15 +137,12 @@ if [[ $1 == "backup" ]]; then
wait_for_balance alice 1
echo "alice opens channel"
bob_node=$($bob nodeid)
channel1=$($alice open_channel $bob_node 0.15)
$alice setconfig use_recoverable_channels False
channel=$($alice open_channel $bob_node 0.15)
echo "channel point: $channel"
channel2=$($alice open_channel $bob_node 0.15)
new_blocks 3
wait_until_channel_open alice
backup=$($alice export_channel_backup $channel)
request=$($bob add_lightning_request 0.01 -m "blah" | jq -r ".invoice")
echo "alice pays"
$alice lnpay $request
backup=$($alice export_channel_backup $channel2)
seed=$($alice getseed)
$alice stop
mv /tmp/alice/regtest/wallets/default_wallet /tmp/alice/regtest/wallets/default_wallet.old
@ -153,8 +150,9 @@ if [[ $1 == "backup" ]]; then
$alice daemon -d
$alice load_wallet
$alice import_channel_backup $backup
$alice request_force_close $channel
wait_for_balance alice 0.989
$alice request_force_close $channel1
$alice request_force_close $channel2
wait_for_balance alice 0.998
fi

Loading…
Cancel
Save