@@ -10,7 +10,7 @@ use lightning::{log_error, log_debug, log_trace};
10
10
use lightning:: chain:: WatchedOutput ;
11
11
use lightning:: chain:: { Confirm , Filter } ;
12
12
13
- use bitcoin:: { BlockHash , BlockHeader , Script , Transaction , Txid , TxMerkleNode } ;
13
+ use bitcoin:: { BlockHash , Script , Transaction , Txid , TxMerkleNode } ;
14
14
use bitcoin:: hashes:: Hash ;
15
15
use bitcoin:: hashes:: sha256d:: Hash as Sha256d ;
16
16
@@ -119,9 +119,12 @@ where
119
119
}
120
120
121
121
num_unconfirmed += unconfirmed_txs. len ( ) ;
122
- self . sync_unconfirmed_transactions ( & mut sync_state , & confirmables,
122
+ sync_state . sync_unconfirmed_transactions ( & confirmables,
123
123
unconfirmed_txs) ;
124
- self . sync_best_block_updated ( & confirmables, & tip_header, tip_height) ;
124
+
125
+ for c in & confirmables {
126
+ c. best_block_updated ( & tip_header, tip_height) ;
127
+ }
125
128
} ,
126
129
Err ( err) => {
127
130
// (Semi-)permanent failure, retry later.
@@ -146,8 +149,7 @@ where
146
149
}
147
150
148
151
num_confirmed += confirmed_txs. len ( ) ;
149
- self . sync_confirmed_transactions (
150
- & mut sync_state,
152
+ sync_state. sync_confirmed_transactions (
151
153
& confirmables,
152
154
confirmed_txs,
153
155
) ;
@@ -177,50 +179,6 @@ where
177
179
Ok ( ( ) )
178
180
}
179
181
180
- fn sync_unconfirmed_transactions (
181
- & self , sync_state : & mut SyncState , confirmables : & Vec < & ( dyn Confirm + Sync + Send ) > ,
182
- unconfirmed_txs : Vec < Txid > ,
183
- ) {
184
- for txid in unconfirmed_txs {
185
- for c in confirmables {
186
- c. transaction_unconfirmed ( & txid) ;
187
- }
188
-
189
- sync_state. watched_transactions . insert ( txid) ;
190
- }
191
- }
192
-
193
-
194
- fn sync_best_block_updated (
195
- & self , confirmables : & Vec < & ( dyn Confirm + Sync + Send ) > , tip_header : & BlockHeader ,
196
- tip_height : u32 ,
197
- ) {
198
- for c in confirmables {
199
- c. best_block_updated ( & tip_header, tip_height) ;
200
- }
201
- }
202
-
203
- fn sync_confirmed_transactions (
204
- & self , sync_state : & mut SyncState , confirmables : & Vec < & ( dyn Confirm + Sync + Send ) > ,
205
- confirmed_txs : Vec < ConfirmedTx >
206
- ) {
207
- for ctx in confirmed_txs {
208
- for c in confirmables {
209
- c. transactions_confirmed (
210
- & ctx. block_header ,
211
- & [ ( ctx. pos , & ctx. tx ) ] ,
212
- ctx. block_height ,
213
- ) ;
214
- }
215
-
216
- sync_state. watched_transactions . remove ( & ctx. tx . txid ( ) ) ;
217
-
218
- for input in & ctx. tx . input {
219
- sync_state. watched_outputs . remove ( & input. previous_output ) ;
220
- }
221
- }
222
- }
223
-
224
182
fn get_confirmed_transactions (
225
183
& self , sync_state : & SyncState ,
226
184
) -> Result < Vec < ConfirmedTx > , InternalError > {
0 commit comments