Skip to content

Commit a5ec986

Browse files
committed
Clean up a few comments after lightningdevkit#11 merge.
1 parent ad9dda2 commit a5ec986

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/chain/chaininterface.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ pub trait ChainWatchInterface: Sync + Send {
2525
//TODO: unregister
2626
}
2727

28-
/// An interface to send a transaction to connected Bitcoin peers.
29-
/// This is for final settlement. An error might indicate that no peers can be reached or
30-
/// that peers rejected the transaction.
28+
/// An interface to send a transaction to the Bitcoin network.
3129
pub trait BroadcasterInterface: Sync + Send {
32-
/// Sends a transaction out to (hopefully) be mined
30+
/// Sends a transaction out to (hopefully) be mined.
3331
fn broadcast_transaction(&self, tx: &Transaction);
3432
}
3533

@@ -105,8 +103,9 @@ impl ChainWatchInterfaceUtil {
105103
}
106104
}
107105

108-
/// notify listener that a block was connected
109-
/// notification will repeat if notified listener register new listeners
106+
/// Notify listeners that a block was connected.
107+
/// Handles re-scanning the block and calling block_connected again if listeners register new
108+
/// watch data during the callbacks for you (see ChainListener::block_connected for more info).
110109
pub fn block_connected_with_filtering(&self, block: &Block, height: u32) {
111110
let mut reentered = true;
112111
while reentered {
@@ -125,7 +124,7 @@ impl ChainWatchInterfaceUtil {
125124
}
126125
}
127126

128-
/// notify listener that a block was disconnected
127+
/// Notify listeners that a block was disconnected.
129128
pub fn block_disconnected(&self, header: &BlockHeader) {
130129
let listeners = self.listeners.lock().unwrap().clone();
131130
for listener in listeners.iter() {
@@ -136,8 +135,10 @@ impl ChainWatchInterfaceUtil {
136135
}
137136
}
138137

139-
/// call listeners for connected blocks if they are still around.
140-
/// returns true if notified listeners registered additional listener
138+
/// Notify listeners that a block was connected.
139+
/// Returns true if notified listeners registered additional watch data (implying that the
140+
/// block must be re-scanned and this function called again prior to further block_connected
141+
/// calls, see ChainListener::block_connected for more info).
141142
pub fn block_connected_checked(&self, header: &BlockHeader, height: u32, txn_matched: &[&Transaction], indexes_of_txn_matched: &[u32]) -> bool {
142143
let last_seen = self.reentered.load(Ordering::Relaxed);
143144

@@ -151,7 +152,7 @@ impl ChainWatchInterfaceUtil {
151152
return last_seen != self.reentered.load(Ordering::Relaxed);
152153
}
153154

154-
/// Checks if a given transaction matches the current filter
155+
/// Checks if a given transaction matches the current filter.
155156
pub fn does_match_tx(&self, tx: &Transaction) -> bool {
156157
let watched = self.watched.lock().unwrap();
157158
self.does_match_tx_unguarded (tx, &watched)

src/ln/channelmonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ impl ChannelMonitor {
456456
for txin in tx.input.iter() {
457457
if self.funding_txo.is_none() || (txin.prev_hash == self.funding_txo.unwrap().0 && txin.prev_index == self.funding_txo.unwrap().1 as u32) {
458458
for tx in self.check_spend_transaction(tx, height).iter() {
459-
broadcaster.broadcast_transaction(tx); // TODO: use result
459+
broadcaster.broadcast_transaction(tx);
460460
}
461461
}
462462
}

0 commit comments

Comments
 (0)