Avoid panic when 0conf channel's ann. sigs race on-chain confirmation
authorElias Rohrer <dev@tnull.de>
Sat, 17 Jun 2023 11:16:52 +0000 (13:16 +0200)
committerElias Rohrer <dev@tnull.de>
Fri, 21 Jul 2023 07:54:28 +0000 (09:54 +0200)
commit82fdf0f62d983dfdcbd28f9037f94d70c7d98814
tree449428e164024466302238ae5b3c9923cc96fe24
parentae9e96e2772d2aaa3d6fbd1d17b83bb44f5ae07a
Avoid panic when 0conf channel's ann. sigs race on-chain confirmation

A channel's `short_channel_id` is currently only set when the funding
transaction is confirmed via `transactions_confirmed`, which might be
well after the channel initally becomes usable, e.g., in the 0conf case.

Previously we would panic due to a reachable `unwrap` when receiving a
counterparty's `announcement_signatures` message for a 0conf channel
pending confirmation on-chain.

Here we fix this bug by avoiding unsafe `unwrap`s and just erroring out
and ignoring the announcement_signatures message if the `short_channel_id`
hasn't been set yet.
lightning/src/ln/channel.rs
lightning/src/ln/priv_short_conf_tests.rs