Skip to content

Commit 9bbaf19

Browse files
committed
Remove unused TransactionListener
1 parent fa617d6 commit 9bbaf19

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

core/src/miner/miner.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,8 @@ struct SealingWork {
111111
enabled: bool,
112112
}
113113

114-
type TransactionListener = Box<dyn Fn(&[TxHash]) + Send + Sync>;
115-
116114
pub struct Miner {
117115
mem_pool: Arc<RwLock<MemPool>>,
118-
transaction_listener: RwLock<Vec<TransactionListener>>,
119116
next_allowed_reseal: Mutex<Instant>,
120117
next_mandatory_reseal: RwLock<Instant>,
121118
sealing_block_last_request: Mutex<u64>,
@@ -173,7 +170,6 @@ impl Miner {
173170

174171
Self {
175172
mem_pool,
176-
transaction_listener: RwLock::new(vec![]),
177173
next_allowed_reseal: Mutex::new(Instant::now()),
178174
next_mandatory_reseal: RwLock::new(Instant::now() + options.reseal_max_period),
179175
params: RwLock::new(AuthoringParams::default()),
@@ -196,11 +192,6 @@ impl Miner {
196192
self.mem_pool.write().recover_from_db(client);
197193
}
198194

199-
/// Set a callback to be notified about imported transactions' hashes.
200-
pub fn add_transactions_listener(&self, f: Box<dyn Fn(&[TxHash]) + Send + Sync>) {
201-
self.transaction_listener.write().push(f);
202-
}
203-
204195
/// Get `Some` `clone()` of the current pending block's state or `None` if we're not sealing.
205196
pub fn pending_state(&self, latest_block_number: BlockNumber) -> Option<TopLevelState> {
206197
self.map_pending_block(|b| b.state().clone(), latest_block_number)
@@ -355,7 +346,7 @@ impl Miner {
355346

356347
debug_assert_eq!(insertion_results.len(), intermediate_results.iter().filter(|r| r.is_ok()).count());
357348
let mut insertion_results_index = 0;
358-
let results = intermediate_results
349+
intermediate_results
359350
.into_iter()
360351
.map(|res| match res {
361352
Err(e) => Err(e),
@@ -367,13 +358,7 @@ impl Miner {
367358
Ok(result)
368359
}
369360
})
370-
.collect();
371-
372-
for listener in &*self.transaction_listener.read() {
373-
listener(&inserted);
374-
}
375-
376-
results
361+
.collect()
377362
}
378363

379364
fn calculate_timelock<C: BlockChainTrait>(&self, tx: &SignedTransaction, client: &C) -> Result<TxTimelock, Error> {

0 commit comments

Comments
 (0)