@@ -52,7 +52,7 @@ use substrate_client::BlockchainEvents;
52
52
53
53
use chainx_network:: consensus:: ConsensusNetwork ;
54
54
use chainx_pool:: { PoolApi , TransactionPool } ;
55
- use chainx_primitives:: { Block , Hash } ;
55
+ use chainx_primitives:: { Block , Hash , BlockId } ;
56
56
use chainx_api:: TClient ;
57
57
use cli:: ChainSpec ;
58
58
@@ -119,16 +119,36 @@ fn main() {
119
119
{
120
120
// block notifications
121
121
let network = network. clone ( ) ;
122
+ let txpool = extrinsic_pool. clone ( ) ;
123
+
122
124
let events = client
123
125
. import_notification_stream ( )
124
126
. for_each ( move |notification| {
125
127
network. on_block_imported ( notification. hash , & notification. header ) ;
128
+ txpool. inner ( ) . cull ( & BlockId :: hash ( notification. hash ) )
129
+ . map_err ( |e| warn ! ( "Error removing extrinsics: {:?}" , e) ) ?;
126
130
Ok ( ( ) )
127
131
} ) . select ( exit. clone ( ) )
128
132
. then ( |_| Ok ( ( ) ) ) ;
129
133
task_executor. spawn ( events) ;
130
134
}
131
135
136
+ {
137
+ // extrinsic notifications
138
+ let network = network. clone ( ) ;
139
+ let txpool = extrinsic_pool. clone ( ) ;
140
+ let events = txpool. inner ( ) . import_notification_stream ( )
141
+ // TODO [ToDr] Consider throttling?
142
+ . for_each ( move |_| {
143
+ network. trigger_repropagate ( ) ;
144
+ Ok ( ( ) )
145
+ } )
146
+ . select ( exit. clone ( ) )
147
+ . then ( |_| Ok ( ( ) ) ) ;
148
+
149
+ task_executor. spawn ( events) ;
150
+ }
151
+
132
152
let _consensus = if validator_mode {
133
153
let key = match matches
134
154
. subcommand_matches ( "validator" )
0 commit comments