@@ -25,11 +25,9 @@ pub trait ChainWatchInterface: Sync + Send {
25
25
//TODO: unregister
26
26
}
27
27
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.
31
29
pub trait BroadcasterInterface : Sync + Send {
32
- /// Sends a transaction out to (hopefully) be mined
30
+ /// Sends a transaction out to (hopefully) be mined.
33
31
fn broadcast_transaction ( & self , tx : & Transaction ) ;
34
32
}
35
33
@@ -105,8 +103,9 @@ impl ChainWatchInterfaceUtil {
105
103
}
106
104
}
107
105
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).
110
109
pub fn block_connected_with_filtering ( & self , block : & Block , height : u32 ) {
111
110
let mut reentered = true ;
112
111
while reentered {
@@ -125,7 +124,7 @@ impl ChainWatchInterfaceUtil {
125
124
}
126
125
}
127
126
128
- /// notify listener that a block was disconnected
127
+ /// Notify listeners that a block was disconnected.
129
128
pub fn block_disconnected ( & self , header : & BlockHeader ) {
130
129
let listeners = self . listeners . lock ( ) . unwrap ( ) . clone ( ) ;
131
130
for listener in listeners. iter ( ) {
@@ -136,8 +135,10 @@ impl ChainWatchInterfaceUtil {
136
135
}
137
136
}
138
137
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).
141
142
pub fn block_connected_checked ( & self , header : & BlockHeader , height : u32 , txn_matched : & [ & Transaction ] , indexes_of_txn_matched : & [ u32 ] ) -> bool {
142
143
let last_seen = self . reentered . load ( Ordering :: Relaxed ) ;
143
144
@@ -151,7 +152,7 @@ impl ChainWatchInterfaceUtil {
151
152
return last_seen != self . reentered . load ( Ordering :: Relaxed ) ;
152
153
}
153
154
154
- /// Checks if a given transaction matches the current filter
155
+ /// Checks if a given transaction matches the current filter.
155
156
pub fn does_match_tx ( & self , tx : & Transaction ) -> bool {
156
157
let watched = self . watched . lock ( ) . unwrap ( ) ;
157
158
self . does_match_tx_unguarded ( tx, & watched)
0 commit comments