Clean up a few comments after #11 merge.
authorMatt Corallo <git@bluematt.me>
Mon, 19 Mar 2018 20:26:39 +0000 (16:26 -0400)
committerMatt Corallo <git@bluematt.me>
Mon, 19 Mar 2018 21:46:35 +0000 (17:46 -0400)
src/chain/chaininterface.rs
src/ln/channelmonitor.rs

index f456afda691b023c3285ffe466aecb9bfd411f76..8fef60b3b2c11d574691f31211c73478d8388a6e 100644 (file)
@@ -25,11 +25,9 @@ pub trait ChainWatchInterface: Sync + Send {
        //TODO: unregister
 }
 
-/// An interface to send a transaction to connected Bitcoin peers.
-/// This is for final settlement. An error might indicate that no peers can be reached or
-/// that peers rejected the transaction.
+/// An interface to send a transaction to the Bitcoin network.
 pub trait BroadcasterInterface: Sync + Send {
-       /// Sends a transaction out to (hopefully) be mined
+       /// Sends a transaction out to (hopefully) be mined.
        fn broadcast_transaction(&self, tx: &Transaction);
 }
 
@@ -105,8 +103,9 @@ impl ChainWatchInterfaceUtil {
                }
        }
 
-       /// notify listener that a block was connected
-       /// notification will repeat if notified listener register new listeners
+       /// Notify listeners that a block was connected.
+       /// Handles re-scanning the block and calling block_connected again if listeners register new
+       /// watch data during the callbacks for you (see ChainListener::block_connected for more info).
        pub fn block_connected_with_filtering(&self, block: &Block, height: u32) {
                let mut reentered = true;
                while reentered {
@@ -125,7 +124,7 @@ impl ChainWatchInterfaceUtil {
                }
        }
 
-       /// notify listener that a block was disconnected
+       /// Notify listeners that a block was disconnected.
        pub fn block_disconnected(&self, header: &BlockHeader) {
                let listeners = self.listeners.lock().unwrap().clone();
                for listener in listeners.iter() {
@@ -136,8 +135,10 @@ impl ChainWatchInterfaceUtil {
                }
        }
 
-       /// call listeners for connected blocks if they are still around.
-       /// returns true if notified listeners registered additional listener
+       /// Notify listeners that a block was connected.
+       /// Returns true if notified listeners registered additional watch data (implying that the
+       /// block must be re-scanned and this function called again prior to further block_connected
+       /// calls, see ChainListener::block_connected for more info).
        pub fn block_connected_checked(&self, header: &BlockHeader, height: u32, txn_matched: &[&Transaction], indexes_of_txn_matched: &[u32]) -> bool {
                let last_seen = self.reentered.load(Ordering::Relaxed);
 
@@ -151,7 +152,7 @@ impl ChainWatchInterfaceUtil {
                return last_seen != self.reentered.load(Ordering::Relaxed);
        }
 
-       /// Checks if a given transaction matches the current filter
+       /// Checks if a given transaction matches the current filter.
        pub fn does_match_tx(&self, tx: &Transaction) -> bool {
                let watched = self.watched.lock().unwrap();
                self.does_match_tx_unguarded (tx, &watched)
index ac08bf5a37bbfa402a1b40179986c5d1cdc6b4f9..d5529af9c99e579d7f169446cf50f4022b151c70 100644 (file)
@@ -456,7 +456,7 @@ impl ChannelMonitor {
                        for txin in tx.input.iter() {
                                if self.funding_txo.is_none() || (txin.prev_hash == self.funding_txo.unwrap().0 && txin.prev_index == self.funding_txo.unwrap().1 as u32) {
                                        for tx in self.check_spend_transaction(tx, height).iter() {
-                                               broadcaster.broadcast_transaction(tx); // TODO: use result
+                                               broadcaster.broadcast_transaction(tx);
                                        }
                                }
                        }