File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -270,6 +270,12 @@ impl Miner {
270270 . into_iter ( )
271271 . map ( |tx| {
272272 let hash = tx. hash ( ) ;
273+ let signer_public = tx. recover_public ( ) ?;
274+
275+ if self . malicious_users . read ( ) . contains ( & signer_public) {
276+ // FIXME: just to skip, think about another way.
277+ return Ok ( ( ) )
278+ }
273279 if client. transaction_block ( & TransactionId :: Hash ( hash) ) . is_some ( ) {
274280 cdebug ! ( MINER , "Rejected transaction {:?}: already in the blockchain" , hash) ;
275281 return Err ( HistoryError :: TransactionAlreadyImported . into ( ) )
@@ -283,12 +289,29 @@ impl Miner {
283289 . and_then ( |_| self . engine . verify_transaction_unordered ( tx, & best_block_header) )
284290 {
285291 Err ( e) => {
292+ match e {
293+ Error :: Syntax ( _) if !self . mem_pool . read ( ) . is_local_transaction ( hash) => {
294+ self . malicious_users . write ( ) . insert ( signer_public) ;
295+ }
296+ _ => { }
297+ }
286298 cdebug ! ( MINER , "Rejected transaction {:?} with invalid signature: {:?}" , hash, e) ;
287299 Err ( e)
288300 }
289301 Ok ( tx) => {
290302 // This check goes here because verify_transaction takes SignedTransaction parameter
291- self . engine . machine ( ) . verify_transaction ( & tx, & best_block_header, client, false ) ?;
303+ self . engine . machine ( ) . verify_transaction ( & tx, & best_block_header, client, false ) . map_err (
304+ |e| {
305+ match e {
306+ Error :: Syntax ( _) if !self . mem_pool . read ( ) . is_local_transaction ( hash) => {
307+ self . malicious_users . write ( ) . insert ( tx. signer_public ( ) ) ;
308+ }
309+ _ => { }
310+ } ;
311+ e
312+ } ,
313+ ) ?;
314+
292315
293316 let origin = self
294317 . accounts
You can’t perform that action at this time.
0 commit comments