18
18
19
19
use std:: { collections:: HashMap , fmt:: Debug , hash} ;
20
20
21
+ use crate :: LOG_TARGET ;
21
22
use linked_hash_map:: LinkedHashMap ;
22
23
use log:: { debug, trace} ;
23
24
use serde:: Serialize ;
@@ -67,13 +68,13 @@ impl<H: hash::Hash + traits::Member + Serialize, C: ChainApi> Listener<H, C> {
67
68
68
69
/// Notify the listeners about extrinsic broadcast.
69
70
pub fn broadcasted ( & mut self , hash : & H , peers : Vec < String > ) {
70
- trace ! ( target: "txpool" , "[{:?}] Broadcasted" , hash) ;
71
+ trace ! ( target: LOG_TARGET , "[{:?}] Broadcasted" , hash) ;
71
72
self . fire ( hash, |watcher| watcher. broadcast ( peers) ) ;
72
73
}
73
74
74
75
/// New transaction was added to the ready pool or promoted from the future pool.
75
76
pub fn ready ( & mut self , tx : & H , old : Option < & H > ) {
76
- trace ! ( target: "txpool" , "[{:?}] Ready (replaced with {:?})" , tx, old) ;
77
+ trace ! ( target: LOG_TARGET , "[{:?}] Ready (replaced with {:?})" , tx, old) ;
77
78
self . fire ( tx, |watcher| watcher. ready ( ) ) ;
78
79
if let Some ( old) = old {
79
80
self . fire ( old, |watcher| watcher. usurped ( tx. clone ( ) ) ) ;
@@ -82,13 +83,13 @@ impl<H: hash::Hash + traits::Member + Serialize, C: ChainApi> Listener<H, C> {
82
83
83
84
/// New transaction was added to the future pool.
84
85
pub fn future ( & mut self , tx : & H ) {
85
- trace ! ( target: "txpool" , "[{:?}] Future" , tx) ;
86
+ trace ! ( target: LOG_TARGET , "[{:?}] Future" , tx) ;
86
87
self . fire ( tx, |watcher| watcher. future ( ) ) ;
87
88
}
88
89
89
90
/// Transaction was dropped from the pool because of the limit.
90
91
pub fn dropped ( & mut self , tx : & H , by : Option < & H > ) {
91
- trace ! ( target: "txpool" , "[{:?}] Dropped (replaced with {:?})" , tx, by) ;
92
+ trace ! ( target: LOG_TARGET , "[{:?}] Dropped (replaced with {:?})" , tx, by) ;
92
93
self . fire ( tx, |watcher| match by {
93
94
Some ( t) => watcher. usurped ( t. clone ( ) ) ,
94
95
None => watcher. dropped ( ) ,
@@ -97,13 +98,13 @@ impl<H: hash::Hash + traits::Member + Serialize, C: ChainApi> Listener<H, C> {
97
98
98
99
/// Transaction was removed as invalid.
99
100
pub fn invalid ( & mut self , tx : & H ) {
100
- debug ! ( target: "txpool" , "[{:?}] Extrinsic invalid" , tx) ;
101
+ debug ! ( target: LOG_TARGET , "[{:?}] Extrinsic invalid" , tx) ;
101
102
self . fire ( tx, |watcher| watcher. invalid ( ) ) ;
102
103
}
103
104
104
105
/// Transaction was pruned from the pool.
105
106
pub fn pruned ( & mut self , block_hash : BlockHash < C > , tx : & H ) {
106
- debug ! ( target: "txpool" , "[{:?}] Pruned at {:?}" , tx, block_hash) ;
107
+ debug ! ( target: LOG_TARGET , "[{:?}] Pruned at {:?}" , tx, block_hash) ;
107
108
// Get the transactions included in the given block hash.
108
109
let txs = self . finality_watchers . entry ( block_hash) . or_insert ( vec ! [ ] ) ;
109
110
txs. push ( tx. clone ( ) ) ;
@@ -134,7 +135,12 @@ impl<H: hash::Hash + traits::Member + Serialize, C: ChainApi> Listener<H, C> {
134
135
pub fn finalized ( & mut self , block_hash : BlockHash < C > ) {
135
136
if let Some ( hashes) = self . finality_watchers . remove ( & block_hash) {
136
137
for ( tx_index, hash) in hashes. into_iter ( ) . enumerate ( ) {
137
- log:: debug!( target: "txpool" , "[{:?}] Sent finalization event (block {:?})" , hash, block_hash) ;
138
+ log:: debug!(
139
+ target: LOG_TARGET ,
140
+ "[{:?}] Sent finalization event (block {:?})" ,
141
+ hash,
142
+ block_hash
143
+ ) ;
138
144
self . fire ( & hash, |watcher| watcher. finalized ( block_hash, tx_index) )
139
145
}
140
146
}
0 commit comments