@@ -927,7 +927,9 @@ impl Worker {
927927 on : on. clone ( ) ,
928928 } ;
929929 if !self . votes . is_old_or_known ( & message) {
930- self . votes . collect ( message) ;
930+ if let Err ( double_vote) = self . votes . collect ( message) {
931+ cerror ! ( ENGINE , "Double vote found on_commit_message: {:?}" , double_vote) ;
932+ }
931933 }
932934 }
933935
@@ -1394,7 +1396,7 @@ impl Worker {
13941396 self . votes_received . set ( vote_index) ;
13951397 }
13961398
1397- if let Some ( double) = self . votes . collect ( message. clone ( ) ) {
1399+ if let Err ( double) = self . votes . collect ( message. clone ( ) ) {
13981400 cerror ! ( ENGINE , "Double vote found {:?}" , double) ;
13991401 self . report_double_vote ( & double) ;
14001402 return Err ( EngineError :: DoubleVote ( sender) )
@@ -1512,7 +1514,7 @@ impl Worker {
15121514 } ;
15131515
15141516 self . votes_received . set ( vote. signer_index ) ;
1515- self . votes . collect ( vote. clone ( ) ) ;
1517+ self . votes . collect ( vote. clone ( ) ) . expect ( "Must not attempt double vote" ) ;
15161518 cinfo ! ( ENGINE , "Voted {:?} as {}th validator." , vote, signer_index) ;
15171519 Ok ( Some ( vote) )
15181520 }
@@ -1538,7 +1540,7 @@ impl Worker {
15381540 on,
15391541 } ;
15401542
1541- self . votes . collect ( vote. clone ( ) ) ;
1543+ self . votes . collect ( vote. clone ( ) ) . expect ( "Must not attempt double vote on proposal" ) ; ;
15421544 cinfo ! ( ENGINE , "Voted {:?} as {}th proposer." , vote, signer_index) ;
15431545 Ok ( vote)
15441546 }
@@ -1790,7 +1792,7 @@ impl Worker {
17901792 ) ;
17911793 }
17921794
1793- if let Some ( double) = self . votes . collect ( message. clone ( ) ) {
1795+ if let Err ( double) = self . votes . collect ( message. clone ( ) ) {
17941796 cerror ! ( ENGINE , "Double Vote found {:?}" , double) ;
17951797 self . report_double_vote ( & double) ;
17961798 return None
@@ -2125,7 +2127,9 @@ impl Worker {
21252127 cdebug ! ( ENGINE , "Commit message-{} is verified" , commit_height) ;
21262128 for vote in votes {
21272129 if !self . votes . is_old_or_known ( & vote) {
2128- self . votes . collect ( vote) ;
2130+ if let Err ( double_vote) = self . votes . collect ( vote) {
2131+ cerror ! ( ENGINE , "Double vote found on_commit_message: {:?}" , double_vote) ;
2132+ }
21292133 }
21302134 }
21312135
0 commit comments