rust-lightning/lightning/src/ln
Matt Corallo 6c480ae887 Fix spurious panic on bogus funding txn that confirm and are spent
In c02b6a3807 we moved the
`payment_preimage` copy from inside the macro which only runs if we
are spending an output we know is an HTLC output to doing it for
any script that matches our expected length. This can panic if an
inbound channel is created with a bogus funding transaction that
has a witness program of the HTLC-Success/-Offered length but which
does not have a second-to-last witness element which is 32 bytes.

Luckily this panic is relatively simple for downstream users to
work around - if an invalid-length-copy panic occurs, simply remove
the ChannelMonitor from the bogus channel on startup and run
without it. Because the channel must be funded by a bogus script in
order to reach this panic, the channel will already have closed by
the time the funding transaction is spent, and there can be no
local funds in such a channel, so removing the `ChannelMonitor`
wholesale is completely safe.

In order to test this we have to disable an in-line assertion that
checks that our transactions match expected scripts which we do by
checking for the specific bogus script that we now use in
`test_invalid_funding_tx`.

Thanks to Eugene Siegel for reporting this issue.
2022-07-01 14:47:17 +00:00
..
chan_utils.rs Use new spec repository URL. 2022-05-20 17:17:29 +02:00
chanmon_update_fail_tests.rs Add ChannelManager methods to force close without broadcasting 2022-06-25 02:25:32 +00:00
channel.rs Panic if we're running with outdated state instead of force-closing 2022-06-25 02:25:32 +00:00
channelmanager.rs Have find_route take a NetworkGraph instead of a ReadOnly one 2022-06-29 17:45:49 +00:00
features.rs Document better optional features 2022-06-12 11:31:53 -07:00
functional_test_utils.rs Allow forwarding HTLCs that were constructed for previous config 2022-06-20 13:12:57 -07:00
functional_tests.rs Fix spurious panic on bogus funding txn that confirm and are spent 2022-07-01 14:47:17 +00:00
inbound_payment.rs Pass FinalOnionHopData to payment verify by reference, not clone 2022-05-02 09:37:23 -07:00
mod.rs Move network_graph.rs to gossip.rs 2022-06-02 15:15:30 -07:00
monitor_tests.rs Don't fail HTLCs in revoked commitment txn until we spend them 2022-06-21 16:14:55 +00:00
msgs.rs Rename FundingLocked to ChannelReady. 2022-05-30 17:07:09 -07:00
onion_route_tests.rs Allow forwarding HTLCs that were constructed for previous config 2022-06-20 13:12:57 -07:00
onion_utils.rs onion_utils: add next_hop_packet_pubkey method 2022-06-17 18:36:10 -04:00
payment_tests.rs Add ChannelManager methods to force close without broadcasting 2022-06-25 02:25:32 +00:00
peer_channel_encryptor.rs Use new spec repository URL. 2022-05-20 17:17:29 +02:00
peer_handler.rs Parameterize NetworkGraph with Logger 2022-06-06 13:02:43 -05:00
priv_short_conf_tests.rs Add ChannelManager methods to force close without broadcasting 2022-06-25 02:25:32 +00:00
reorg_tests.rs Correct handling of reorg'd-out revoked counterparty transactions 2022-06-15 14:21:35 +00:00
script.rs Use new spec repository URL. 2022-05-20 17:17:29 +02:00
shutdown_tests.rs Rename UserConfig and LegacyChannelConfig fields 2022-06-13 13:57:00 -07:00
wire.rs Rename FundingLocked to ChannelReady. 2022-05-30 17:07:09 -07:00