diff --git a/electrum/lnworker.py b/electrum/lnworker.py index 8e39e7889..5bc933a4b 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -1511,8 +1511,7 @@ class LNWallet(Logger): while not next_chan.is_open(): await asyncio.sleep(1) await util.wait_for2(wait_for_channel(), LN_P2P_NETWORK_TIMEOUT) - next_chan.save_remote_scid_alias(self._scid_alias_of_node(next_peer.pubkey)) - self.logger.info(f'JIT channel is open') + self.logger.info(f'JIT channel is open (will forward htlc and await preimage now)') next_amount_msat_htlc -= channel_opening_fee # fixme: some checks are missing htlc = next_peer.send_htlc( diff --git a/tests/regtest/regtest.sh b/tests/regtest/regtest.sh index e51af808c..f9f19751c 100755 --- a/tests/regtest/regtest.sh +++ b/tests/regtest/regtest.sh @@ -779,10 +779,24 @@ if [[ $1 == "just_in_time" ]]; then echo "carol pays alice" # note: set amount to 0.001 to test failure: 'payment too low' invoice=$($alice add_request 0.01 --lightning --memo "invoice" | jq -r ".lightning_invoice") - success=$($carol lnpay $invoice| jq '.success') - if [[ $success != "true" ]]; then - echo "JIT payment failed" - exit 1 + success=$($carol lnpay $invoice | jq -r ".success") + if [[ "$success" != "true" ]]; then + echo "jit payment failed" + exit 1 + fi + # try again, multiple jit openings should work without issues + new_blocks 3 + echo "carol pays alice again" + invoice=$($alice add_request 0.04 --lightning --memo "invoice2" | jq -r ".lightning_invoice") + success=$($carol lnpay $invoice | jq -r ".success") + if [[ "$success" != "true" ]]; then + echo "jit payment failed" + exit 1 + fi + alice_chan_count=$($alice list_channels | jq '. | length') + if [[ "$alice_chan_count" != "2" ]]; then + echo "alice should have two jit channels" + exit 1 fi fi