Skip to content

Commit e06484b

Browse files
Don't apply monitor updates after watch_channel PermFail
The full stack fuzzer found an unreachable panic where we receive a FundingSigned with a duplicate channel outpoint.
1 parent b3be420 commit e06484b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lightning/src/ln/channelmanager.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -3352,7 +3352,16 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
33523352
Err(e) => try_chan_entry!(self, Err(e), channel_state, chan),
33533353
};
33543354
if let Err(e) = self.chain_monitor.watch_channel(chan.get().get_funding_txo().unwrap(), monitor) {
3355-
return_monitor_err!(self, e, channel_state, chan, RAACommitmentOrder::RevokeAndACKFirst, false, false);
3355+
let mut res = handle_monitor_err!(self, e, channel_state, chan, RAACommitmentOrder::RevokeAndACKFirst, false, false);
3356+
if let Err(MsgHandleErrInternal { ref mut shutdown_finish, .. }) = res {
3357+
// We weren't able to watch the channel to begin with, so no updates should be made on
3358+
// it. Previously, full_stack_target found an (unreachable) panic when the
3359+
// monitor update contained within `shutdown_finish` was applied.
3360+
if let Some((ref mut shutdown_finish, _)) = shutdown_finish {
3361+
shutdown_finish.0.take();
3362+
}
3363+
}
3364+
return res
33563365
}
33573366
funding_tx
33583367
},

0 commit comments

Comments
 (0)