Avoid unwrap'ing `channel_parameters` in to_counterparty signing
authorMatt Corallo <git@bluematt.me>
Sun, 1 Oct 2023 00:15:22 +0000 (00:15 +0000)
committerMatt Corallo <git@bluematt.me>
Sun, 1 Oct 2023 00:40:20 +0000 (00:40 +0000)
commit6a55dcce8380297c28dc70c37ef543bd18f62617
treee7f1765906d3d91c5599c973ec2e4fbcc7ebf6bb
parent20f287f4392e7bdb5e83793d4024f4dc5a29ce58
Avoid unwrap'ing `channel_parameters` in to_counterparty signing

Previously, `StaticPaymentOutputDescriptor`s did not include
`channel_parameters` for the signer. As a result, when going to
spend old `StaticPaymentOutputDescriptor`s,
`InMemorySigner::sign_counterparty_payment_input` may be called
with `channel_parameters` set to `None`. This should be fine, but
in fa2a2efef47b5da48ac7a239f3d8a835a7f28164 we started relying on
it (indirectly via `channel_features`) for signing. This caused an
`unwrap` when spending old output descriptors.

This is fixed here by simply avoiding the unwrap and assuming old
`StaticPaymentOutputDescriptor`s represent non-anchor channels.
lightning/src/sign/mod.rs