Skip to content

Commit f9c945e

Browse files
committed
Fix crash on no-witness tx in ChannelMonitor found by fuzzer
Tehnically we can't currently hit this, but a theoretical future watchtower could, and full_stack_target crashes on it.
1 parent 0d7156f commit f9c945e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ln/channelmonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ impl ChannelMonitor {
13861386

13871387
/// Generate a spendable output event when closing_transaction get registered onchain.
13881388
fn check_spend_closing_transaction(&self, tx: &Transaction) -> Option<SpendableOutputDescriptor> {
1389-
if tx.input[0].sequence == 0xFFFFFFFF && tx.input[0].witness.last().unwrap().len() == 71 {
1389+
if tx.input[0].sequence == 0xFFFFFFFF && !tx.input[0].witness.is_empty() && tx.input[0].witness.last().unwrap().len() == 71 {
13901390
match self.key_storage {
13911391
KeyStorage::PrivMode { ref shutdown_pubkey, .. } => {
13921392
let our_channel_close_key_hash = Hash160::from_data(&shutdown_pubkey.serialize());

0 commit comments

Comments
 (0)