Skip to content

Commit 5d0bfa3

Browse files
committed
Delay creating outbound ChannelMonitor until funding_signed rcpt
Previously, we created the initial ChannelMonitor on outbound channels when we generated the funding_created message. This was somewhat unnecessary as, at that time, we hadn't yet received clearance to broadcast our initial funding transaction, and thus there should never be any use for a ChannelMonitor. It also complicated ChannelMonitor a bit as, at this point, we didn't have an initial local commitment transaction. By moving the creation of the initial ChannelMonitor to when we receive our counterparty's funding_signed, we can ensure that any ChannelMonitor will always have both a latest remote commitment tx and a latest local commitment tx for broadcast. This also fixes a strange API where we would close a channel unceremoniously on peer-disconnection if we hadn't yet received the funding_signed, but we'd already have a ChannelMonitor for that channel. While it isn't strictly a bug (some potential DoS issues aside), it is strange that these two definitions of a channel being open were not in sync.
1 parent 3ea1319 commit 5d0bfa3

File tree

5 files changed

+81
-154
lines changed

5 files changed

+81
-154
lines changed

lightning/src/ln/chanmon_update_fail_tests.rs

Lines changed: 14 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,12 +1629,9 @@ fn monitor_update_claim_fail_no_response() {
16291629
claim_payment(&nodes[0], &[&nodes[1]], payment_preimage_2, 1_000_000);
16301630
}
16311631

1632-
// Note that restore_between_fails with !fail_on_generate is useless
1633-
// Also note that !fail_on_generate && !fail_on_signed is useless
1634-
// Finally, note that !fail_on_signed is not possible with fail_on_generate && !restore_between_fails
16351632
// confirm_a_first and restore_b_before_conf are wholly unrelated to earlier bools and
16361633
// restore_b_before_conf has no meaning if !confirm_a_first
1637-
fn do_during_funding_monitor_fail(fail_on_generate: bool, restore_between_fails: bool, fail_on_signed: bool, confirm_a_first: bool, restore_b_before_conf: bool) {
1634+
fn do_during_funding_monitor_fail(confirm_a_first: bool, restore_b_before_conf: bool) {
16381635
// Test that if the monitor update generated by funding_transaction_generated fails we continue
16391636
// the channel setup happily after the update is restored.
16401637
let chanmon_cfgs = create_chanmon_cfgs(2);
@@ -1648,52 +1645,25 @@ fn do_during_funding_monitor_fail(fail_on_generate: bool, restore_between_fails:
16481645

16491646
let (temporary_channel_id, funding_tx, funding_output) = create_funding_transaction(&nodes[0], 100000, 43);
16501647

1651-
if fail_on_generate {
1652-
*nodes[0].chan_monitor.update_ret.lock().unwrap() = Err(ChannelMonitorUpdateErr::TemporaryFailure);
1653-
}
16541648
nodes[0].node.funding_transaction_generated(&temporary_channel_id, funding_output);
1655-
check_added_monitors!(nodes[0], 1);
1649+
check_added_monitors!(nodes[0], 0);
16561650

16571651
*nodes[1].chan_monitor.update_ret.lock().unwrap() = Err(ChannelMonitorUpdateErr::TemporaryFailure);
16581652
let funding_created_msg = get_event_msg!(nodes[0], MessageSendEvent::SendFundingCreated, nodes[1].node.get_our_node_id());
16591653
let channel_id = OutPoint { txid: funding_created_msg.funding_txid, index: funding_created_msg.funding_output_index }.to_channel_id();
16601654
nodes[1].node.handle_funding_created(&nodes[0].node.get_our_node_id(), &funding_created_msg);
16611655
check_added_monitors!(nodes[1], 1);
16621656

1663-
if restore_between_fails {
1664-
assert!(fail_on_generate);
1665-
*nodes[0].chan_monitor.update_ret.lock().unwrap() = Ok(());
1666-
let (outpoint, latest_update) = nodes[0].chan_monitor.latest_monitor_update_id.lock().unwrap().get(&channel_id).unwrap().clone();
1667-
nodes[0].node.channel_monitor_updated(&outpoint, latest_update);
1668-
check_added_monitors!(nodes[0], 0);
1669-
assert!(nodes[0].node.get_and_clear_pending_events().is_empty());
1670-
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
1671-
}
1672-
1673-
if fail_on_signed {
1674-
*nodes[0].chan_monitor.update_ret.lock().unwrap() = Err(ChannelMonitorUpdateErr::TemporaryFailure);
1675-
} else {
1676-
assert!(restore_between_fails || !fail_on_generate); // We can't switch to good now (there's no monitor update)
1677-
assert!(fail_on_generate); // Somebody has to fail
1678-
}
1657+
*nodes[0].chan_monitor.update_ret.lock().unwrap() = Err(ChannelMonitorUpdateErr::TemporaryFailure);
16791658
nodes[0].node.handle_funding_signed(&nodes[1].node.get_our_node_id(), &get_event_msg!(nodes[1], MessageSendEvent::SendFundingSigned, nodes[0].node.get_our_node_id()));
1680-
if fail_on_signed || !restore_between_fails {
1681-
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
1682-
if fail_on_generate && !restore_between_fails {
1683-
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(), "Previous monitor update failure prevented funding_signed from allowing funding broadcast".to_string(), 1);
1684-
check_added_monitors!(nodes[0], 1);
1685-
} else {
1686-
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(), "Failed to update ChannelMonitor".to_string(), 1);
1687-
check_added_monitors!(nodes[0], 1);
1688-
}
1689-
assert!(nodes[0].node.get_and_clear_pending_events().is_empty());
1690-
*nodes[0].chan_monitor.update_ret.lock().unwrap() = Ok(());
1691-
let (outpoint, latest_update) = nodes[0].chan_monitor.latest_monitor_update_id.lock().unwrap().get(&channel_id).unwrap().clone();
1692-
nodes[0].node.channel_monitor_updated(&outpoint, latest_update);
1693-
check_added_monitors!(nodes[0], 0);
1694-
} else {
1695-
check_added_monitors!(nodes[0], 1);
1696-
}
1659+
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
1660+
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(), "Failed to update ChannelMonitor".to_string(), 1);
1661+
check_added_monitors!(nodes[0], 1);
1662+
assert!(nodes[0].node.get_and_clear_pending_events().is_empty());
1663+
*nodes[0].chan_monitor.update_ret.lock().unwrap() = Ok(());
1664+
let (outpoint, latest_update) = nodes[0].chan_monitor.latest_monitor_update_id.lock().unwrap().get(&channel_id).unwrap().clone();
1665+
nodes[0].node.channel_monitor_updated(&outpoint, latest_update);
1666+
check_added_monitors!(nodes[0], 0);
16971667

16981668
let events = nodes[0].node.get_and_clear_pending_events();
16991669
assert_eq!(events.len(), 1);
@@ -1757,8 +1727,7 @@ fn do_during_funding_monitor_fail(fail_on_generate: bool, restore_between_fails:
17571727

17581728
#[test]
17591729
fn during_funding_monitor_fail() {
1760-
do_during_funding_monitor_fail(false, false, true, true, true);
1761-
do_during_funding_monitor_fail(true, false, true, false, false);
1762-
do_during_funding_monitor_fail(true, true, true, true, false);
1763-
do_during_funding_monitor_fail(true, true, false, false, false);
1730+
do_during_funding_monitor_fail(true, true);
1731+
do_during_funding_monitor_fail(true, false);
1732+
do_during_funding_monitor_fail(false, false);
17641733
}

lightning/src/ln/channel.rs

Lines changed: 48 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,50 +1539,65 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
15391539

15401540
/// Handles a funding_signed message from the remote end.
15411541
/// If this call is successful, broadcast the funding transaction (and not before!)
1542-
pub fn funding_signed(&mut self, msg: &msgs::FundingSigned) -> Result<ChannelMonitorUpdate, (Option<ChannelMonitorUpdate>, ChannelError)> {
1542+
pub fn funding_signed(&mut self, msg: &msgs::FundingSigned) -> Result<ChannelMonitor<ChanSigner>, ChannelError> {
15431543
if !self.channel_outbound {
1544-
return Err((None, ChannelError::Close("Received funding_signed for an inbound channel?")));
1544+
return Err(ChannelError::Close("Received funding_signed for an inbound channel?"));
15451545
}
15461546
if self.channel_state & !(ChannelState::MonitorUpdateFailed as u32) != ChannelState::FundingCreated as u32 {
1547-
return Err((None, ChannelError::Close("Received funding_signed in strange state!")));
1547+
return Err(ChannelError::Close("Received funding_signed in strange state!"));
15481548
}
15491549
if self.commitment_secrets.get_min_seen_secret() != (1 << 48) ||
1550-
self.cur_remote_commitment_transaction_number != INITIAL_COMMITMENT_NUMBER - 1 ||
1550+
self.cur_remote_commitment_transaction_number != INITIAL_COMMITMENT_NUMBER ||
15511551
self.cur_local_commitment_transaction_number != INITIAL_COMMITMENT_NUMBER {
15521552
panic!("Should not have advanced channel commitment tx numbers prior to funding_created");
15531553
}
15541554

15551555
let funding_script = self.get_funding_redeemscript();
15561556

1557-
let local_keys = self.build_local_transaction_keys(self.cur_local_commitment_transaction_number).map_err(|e| (None, e))?;
1557+
let remote_keys = self.build_remote_transaction_keys()?;
1558+
let remote_initial_commitment_tx = self.build_commitment_transaction(self.cur_remote_commitment_transaction_number, &remote_keys, false, false, self.feerate_per_kw).0;
1559+
1560+
let local_keys = self.build_local_transaction_keys(self.cur_local_commitment_transaction_number)?;
15581561
let local_initial_commitment_tx = self.build_commitment_transaction(self.cur_local_commitment_transaction_number, &local_keys, true, false, self.feerate_per_kw).0;
15591562
let local_sighash = hash_to_message!(&bip143::SighashComponents::new(&local_initial_commitment_tx).sighash_all(&local_initial_commitment_tx.input[0], &funding_script, self.channel_value_satoshis)[..]);
15601563

15611564
let their_funding_pubkey = &self.their_pubkeys.as_ref().unwrap().funding_pubkey;
15621565

15631566
// They sign the "local" commitment transaction, allowing us to broadcast the tx if we wish.
15641567
if let Err(_) = self.secp_ctx.verify(&local_sighash, &msg.signature, their_funding_pubkey) {
1565-
return Err((None, ChannelError::Close("Invalid funding_signed signature from peer")));
1568+
return Err(ChannelError::Close("Invalid funding_signed signature from peer"));
15661569
}
15671570

1568-
self.latest_monitor_update_id += 1;
1569-
let monitor_update = ChannelMonitorUpdate {
1570-
update_id: self.latest_monitor_update_id,
1571-
updates: vec![ChannelMonitorUpdateStep::LatestLocalCommitmentTXInfo {
1572-
commitment_tx: LocalCommitmentTransaction::new_missing_local_sig(local_initial_commitment_tx, &msg.signature, &PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.funding_key()), their_funding_pubkey, local_keys, self.feerate_per_kw, Vec::new()),
1573-
htlc_outputs: Vec::new(),
1574-
}]
1575-
};
1576-
self.channel_monitor.as_mut().unwrap().update_monitor_ooo(monitor_update.clone()).unwrap();
1577-
self.channel_state = ChannelState::FundingSent as u32 | (self.channel_state & (ChannelState::MonitorUpdateFailed as u32));
1578-
self.cur_local_commitment_transaction_number -= 1;
1571+
let their_pubkeys = self.their_pubkeys.as_ref().unwrap();
1572+
let funding_redeemscript = self.get_funding_redeemscript();
1573+
let funding_txo = self.funding_txo.as_ref().unwrap();
1574+
let funding_txo_script = funding_redeemscript.to_v0_p2wsh();
1575+
macro_rules! create_monitor {
1576+
() => { {
1577+
let mut channel_monitor = ChannelMonitor::new(self.local_keys.clone(),
1578+
&self.shutdown_pubkey, self.our_to_self_delay,
1579+
&self.destination_script, (funding_txo.clone(), funding_txo_script.clone()),
1580+
&their_pubkeys.htlc_basepoint, &their_pubkeys.delayed_payment_basepoint,
1581+
self.their_to_self_delay, funding_redeemscript.clone(), self.channel_value_satoshis,
1582+
self.get_commitment_transaction_number_obscure_factor(),
1583+
self.logger.clone());
15791584

1580-
if self.channel_state & (ChannelState::MonitorUpdateFailed as u32) == 0 {
1581-
Ok(monitor_update)
1582-
} else {
1583-
Err((Some(monitor_update),
1584-
ChannelError::Ignore("Previous monitor update failure prevented funding_signed from allowing funding broadcast")))
1585+
channel_monitor.provide_latest_remote_commitment_tx_info(&remote_initial_commitment_tx, Vec::new(), self.cur_remote_commitment_transaction_number, self.their_cur_commitment_point.unwrap());
1586+
channel_monitor.provide_latest_local_commitment_tx_info(LocalCommitmentTransaction::new_missing_local_sig(local_initial_commitment_tx.clone(), &msg.signature, &PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.funding_key()), their_funding_pubkey, local_keys.clone(), self.feerate_per_kw, Vec::new()), Vec::new()).unwrap();
1587+
1588+
channel_monitor
1589+
} }
15851590
}
1591+
1592+
self.channel_monitor = Some(create_monitor!());
1593+
let channel_monitor = create_monitor!();
1594+
1595+
assert_eq!(self.channel_state & (ChannelState::MonitorUpdateFailed as u32), 0); // We have no had any monitor(s) yet to fail update!
1596+
self.channel_state = ChannelState::FundingSent as u32;
1597+
self.cur_local_commitment_transaction_number -= 1;
1598+
self.cur_remote_commitment_transaction_number -= 1;
1599+
1600+
Ok(channel_monitor)
15861601
}
15871602

15881603
pub fn funding_locked(&mut self, msg: &msgs::FundingLocked) -> Result<(), ChannelError> {
@@ -2951,7 +2966,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
29512966

29522967
/// May only be called after funding has been initiated (ie is_funding_initiated() is true)
29532968
pub fn channel_monitor(&mut self) -> &mut ChannelMonitor<ChanSigner> {
2954-
if self.channel_state < ChannelState::FundingCreated as u32 {
2969+
if self.channel_state < ChannelState::FundingSent as u32 {
29552970
panic!("Can't get a channel monitor until funding has been created");
29562971
}
29572972
self.channel_monitor.as_mut().unwrap()
@@ -3105,7 +3120,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
31053120

31063121
/// Returns true if funding_created was sent/received.
31073122
pub fn is_funding_initiated(&self) -> bool {
3108-
self.channel_state >= ChannelState::FundingCreated as u32
3123+
self.channel_state >= ChannelState::FundingSent as u32
31093124
}
31103125

31113126
/// Returns true if this channel is fully shut down. True here implies that no further actions
@@ -3337,11 +3352,11 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
33373352
}
33383353

33393354
/// If an Err is returned, it is a ChannelError::Close (for get_outbound_funding_created)
3340-
fn get_outbound_funding_created_signature(&mut self) -> Result<(Signature, Transaction), ChannelError> {
3355+
fn get_outbound_funding_created_signature(&mut self) -> Result<Signature, ChannelError> {
33413356
let remote_keys = self.build_remote_transaction_keys()?;
33423357
let remote_initial_commitment_tx = self.build_commitment_transaction(self.cur_remote_commitment_transaction_number, &remote_keys, false, false, self.feerate_per_kw).0;
3343-
Ok((self.local_keys.sign_remote_commitment(self.feerate_per_kw, &remote_initial_commitment_tx, &remote_keys, &Vec::new(), self.our_to_self_delay, &self.secp_ctx)
3344-
.map_err(|_| ChannelError::Close("Failed to get signatures for new commitment_signed"))?.0, remote_initial_commitment_tx))
3358+
Ok(self.local_keys.sign_remote_commitment(self.feerate_per_kw, &remote_initial_commitment_tx, &remote_keys, &Vec::new(), self.our_to_self_delay, &self.secp_ctx)
3359+
.map_err(|_| ChannelError::Close("Failed to get signatures for new commitment_signed"))?.0)
33453360
}
33463361

33473362
/// Updates channel state with knowledge of the funding transaction's txid/index, and generates
@@ -3351,7 +3366,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
33513366
/// Note that channel_id changes during this call!
33523367
/// Do NOT broadcast the funding transaction until after a successful funding_signed call!
33533368
/// If an Err is returned, it is a ChannelError::Close.
3354-
pub fn get_outbound_funding_created(&mut self, funding_txo: OutPoint) -> Result<(msgs::FundingCreated, ChannelMonitor<ChanSigner>), ChannelError> {
3369+
pub fn get_outbound_funding_created(&mut self, funding_txo: OutPoint) -> Result<msgs::FundingCreated, ChannelError> {
33553370
if !self.channel_outbound {
33563371
panic!("Tried to create outbound funding_created message on an inbound channel!");
33573372
}
@@ -3365,7 +3380,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
33653380
}
33663381

33673382
self.funding_txo = Some(funding_txo.clone());
3368-
let (our_signature, commitment_tx) = match self.get_outbound_funding_created_signature() {
3383+
let our_signature = match self.get_outbound_funding_created_signature() {
33693384
Ok(res) => res,
33703385
Err(e) => {
33713386
log_error!(self, "Got bad signatures: {:?}!", e);
@@ -3378,37 +3393,15 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
33783393

33793394
// Now that we're past error-generating stuff, update our local state:
33803395

3381-
let their_pubkeys = self.their_pubkeys.as_ref().unwrap();
3382-
let funding_redeemscript = self.get_funding_redeemscript();
3383-
let funding_txo_script = funding_redeemscript.to_v0_p2wsh();
3384-
macro_rules! create_monitor {
3385-
() => { {
3386-
let mut channel_monitor = ChannelMonitor::new(self.local_keys.clone(),
3387-
&self.shutdown_pubkey, self.our_to_self_delay,
3388-
&self.destination_script, (funding_txo, funding_txo_script.clone()),
3389-
&their_pubkeys.htlc_basepoint, &their_pubkeys.delayed_payment_basepoint,
3390-
self.their_to_self_delay, funding_redeemscript.clone(), self.channel_value_satoshis,
3391-
self.get_commitment_transaction_number_obscure_factor(),
3392-
self.logger.clone());
3393-
3394-
channel_monitor.provide_latest_remote_commitment_tx_info(&commitment_tx, Vec::new(), self.cur_remote_commitment_transaction_number, self.their_cur_commitment_point.unwrap());
3395-
channel_monitor
3396-
} }
3397-
}
3398-
3399-
self.channel_monitor = Some(create_monitor!());
3400-
let channel_monitor = create_monitor!();
3401-
34023396
self.channel_state = ChannelState::FundingCreated as u32;
34033397
self.channel_id = funding_txo.to_channel_id();
3404-
self.cur_remote_commitment_transaction_number -= 1;
34053398

3406-
Ok((msgs::FundingCreated {
3407-
temporary_channel_id: temporary_channel_id,
3399+
Ok(msgs::FundingCreated {
3400+
temporary_channel_id,
34083401
funding_txid: funding_txo.txid,
34093402
funding_output_index: funding_txo.index,
34103403
signature: our_signature
3411-
}, channel_monitor))
3404+
})
34123405
}
34133406

34143407
/// Gets an UnsignedChannelAnnouncement, as well as a signature covering it using our
@@ -4385,7 +4378,7 @@ mod tests {
43854378
value: 10000000, script_pubkey: output_script.clone(),
43864379
}]};
43874380
let funding_outpoint = OutPoint::new(tx.txid(), 0);
4388-
let (funding_created_msg, _) = node_a_chan.get_outbound_funding_created(funding_outpoint).unwrap();
4381+
let funding_created_msg = node_a_chan.get_outbound_funding_created(funding_outpoint).unwrap();
43894382
let (funding_signed_msg, _) = node_b_chan.funding_created(&funding_created_msg).unwrap();
43904383

43914384
// Node B --> Node A: funding signed

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,7 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref> ChannelMan
14121412
pub fn funding_transaction_generated(&self, temporary_channel_id: &[u8; 32], funding_txo: OutPoint) {
14131413
let _ = self.total_consistency_lock.read().unwrap();
14141414

1415-
let (mut chan, msg, chan_monitor) = {
1415+
let (chan, msg) = {
14161416
let (res, chan) = match self.channel_state.lock().unwrap().by_id.remove(temporary_channel_id) {
14171417
Some(mut chan) => {
14181418
(chan.get_outbound_funding_created(funding_txo)
@@ -1425,30 +1425,11 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref> ChannelMan
14251425
};
14261426
match handle_error!(self, res, chan.get_their_node_id()) {
14271427
Ok(funding_msg) => {
1428-
(chan, funding_msg.0, funding_msg.1)
1428+
(chan, funding_msg)
14291429
},
14301430
Err(_) => { return; }
14311431
}
14321432
};
1433-
// Because we have exclusive ownership of the channel here we can release the channel_state
1434-
// lock before add_monitor
1435-
if let Err(e) = self.monitor.add_monitor(chan_monitor.get_funding_txo(), chan_monitor) {
1436-
match e {
1437-
ChannelMonitorUpdateErr::PermanentFailure => {
1438-
match handle_error!(self, Err(MsgHandleErrInternal::from_finish_shutdown("ChannelMonitor storage failure", *temporary_channel_id, chan.force_shutdown(true), None)), chan.get_their_node_id()) {
1439-
Err(_) => { return; },
1440-
Ok(()) => unreachable!(),
1441-
}
1442-
},
1443-
ChannelMonitorUpdateErr::TemporaryFailure => {
1444-
// Its completely fine to continue with a FundingCreated until the monitor
1445-
// update is persisted, as long as we don't generate the FundingBroadcastSafe
1446-
// until the monitor has been safely persisted (as funding broadcast is not,
1447-
// in fact, safe).
1448-
chan.monitor_update_failed(false, false, Vec::new(), Vec::new());
1449-
},
1450-
}
1451-
}
14521433

14531434
let mut channel_state = self.channel_state.lock().unwrap();
14541435
channel_state.pending_msg_events.push(events::MessageSendEvent::SendFundingCreated {
@@ -2337,17 +2318,11 @@ impl<ChanSigner: ChannelKeys, M: Deref, T: Deref, K: Deref, F: Deref> ChannelMan
23372318
if chan.get().get_their_node_id() != *their_node_id {
23382319
return Err(MsgHandleErrInternal::send_err_msg_no_close("Got a message for a channel from the wrong node!", msg.channel_id));
23392320
}
2340-
let monitor_update = match chan.get_mut().funding_signed(&msg) {
2341-
Err((None, e)) => try_chan_entry!(self, Err(e), channel_state, chan),
2342-
Err((Some(monitor_update), e)) => {
2343-
assert!(chan.get().is_awaiting_monitor_update());
2344-
let _ = self.monitor.update_monitor(chan.get().get_funding_txo().unwrap(), monitor_update);
2345-
try_chan_entry!(self, Err(e), channel_state, chan);
2346-
unreachable!();
2347-
},
2321+
let monitor = match chan.get_mut().funding_signed(&msg) {
23482322
Ok(update) => update,
2323+
Err(e) => try_chan_entry!(self, Err(e), channel_state, chan),
23492324
};
2350-
if let Err(e) = self.monitor.update_monitor(chan.get().get_funding_txo().unwrap(), monitor_update) {
2325+
if let Err(e) = self.monitor.add_monitor(chan.get().get_funding_txo().unwrap(), monitor) {
23512326
return_monitor_err!(self, e, channel_state, chan, RAACommitmentOrder::RevokeAndACKFirst, false, false);
23522327
}
23532328
(chan.get().get_funding_txo().unwrap(), chan.get().get_user_id())

0 commit comments

Comments
 (0)