lnworker: stop setting static jit alias for jit channel

...so we can have multiple just in time channels with the same lsp.
We already save a remote scid alias in `on_channel_ready` which we
already have received after the new zeroconf channel is in open state.
So setting the alias to the static node id hash is counterproductive
because it doesn't allow to differentiate between channels.

Also extends the regtest (`just_in_time`) to do a second channel
opening, to cover this scenario. This doesn't add much runtime to
the test, so the cost seems reasonable.
This commit is contained in:
f321x
2026-02-03 12:26:04 +01:00
parent 2da9fbbf15
commit f56e1cafac
2 changed files with 19 additions and 6 deletions
+1 -2
View File
@@ -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(
+17 -3
View File
@@ -779,9 +779,23 @@ 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"
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