Skip to content

Commit 4d11f31

Browse files
committed
f write docs
1 parent 58a5b33 commit 4d11f31

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3678,6 +3678,8 @@ impl<Signer: Sign> Channel<Signer> {
36783678
Ok((None, timed_out_htlcs))
36793679
}
36803680

3681+
/// Indicates the funding transaction is no longer confirmed in the main chain. This may
3682+
/// force-close the channel, but may also indicate a harmless reorganization of a block or two.
36813683
pub fn funding_transaction_unconfirmed(&mut self) -> Result<(), msgs::ErrorMessage> {
36823684
if self.funding_tx_confirmation_height != 0 {
36833685
let effective_new_height = self.funding_tx_confirmation_height - 1;

lightning/src/ln/channelmanager.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3524,7 +3524,13 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
35243524
}
35253525
}
35263526

3527-
/// Gets the set of txids which should be monitored for their confirmation state. XXX: Docs
3527+
/// Gets the set of txids which should be monitored for their confirmation state.
3528+
///
3529+
/// If you're providing information about reorganizations via [`transaction_unconfirmed`], this
3530+
/// is the set of transactions which you may been to call [`transaction_unconfirmed`] for.
3531+
///
3532+
/// Note that this is NOT the set of transactions which must be included in calls to
3533+
/// [`transactions_confirmed`] if they are confirmed, but a small subset of it.
35283534
pub fn get_relevant_txids(&self) -> Vec<Txid> {
35293535
let channel_state = self.channel_state.lock().unwrap();
35303536
let mut res = Vec::with_capacity(channel_state.short_to_id.len());
@@ -3536,7 +3542,19 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
35363542
res
35373543
}
35383544

3539-
/// Marks a transaction as having been reorganized out of the blockchain XXX: Docs
3545+
/// Marks a transaction as having been reorganized out of the blockchain.
3546+
///
3547+
/// If a transaction is included in [`get_relevant_txids`], and is no longer in the main branch
3548+
/// of the blockchain, this function should be called to indicate that the transaction should
3549+
/// be considered reorganized out.
3550+
///
3551+
/// Once this is called, the given transaction will no longer appear on [`get_relevant_txids`],
3552+
/// though this may be called repeatedly for a given transaction without issue.
3553+
///
3554+
/// Note that if the transaction is confirmed on the main chain in a different block (indicated
3555+
/// via a call to [`transactions_confirmed`]), it may re-appear in [`get_relevant_txids`], thus
3556+
/// be very weary of race-conditions wherein the final state of a transaction indicated via
3557+
/// these APIs is not the same as its state on the blockchain.
35403558
pub fn transaction_unconfirmed(&self, txid: &Txid) {
35413559
let _persistence_guard = PersistenceNotifierGuard::new(&self.total_consistency_lock, &self.persistence_notifier);
35423560
self.do_chain_event(None, |channel| {

0 commit comments

Comments
 (0)