@@ -921,7 +921,9 @@ impl Worker {
921921 on : on. clone ( ) ,
922922 } ;
923923 if !self . votes . is_old_or_known ( & message) {
924- self . votes . collect ( message) ;
924+ if let Err ( double_vote) = self . votes . collect ( message) {
925+ cerror ! ( ENGINE , "Double vote found on_commit_message: {:?}" , double_vote) ;
926+ }
925927 }
926928 }
927929
@@ -1387,7 +1389,7 @@ impl Worker {
13871389 self . votes_received . set ( vote_index) ;
13881390 }
13891391
1390- if let Some ( double) = self . votes . collect ( message. clone ( ) ) {
1392+ if let Err ( double) = self . votes . collect ( message. clone ( ) ) {
13911393 cerror ! ( ENGINE , "Double vote found {:?}" , double) ;
13921394 self . report_double_vote ( & double) ;
13931395 return Err ( EngineError :: DoubleVote ( sender) )
@@ -1505,7 +1507,7 @@ impl Worker {
15051507 } ;
15061508
15071509 self . votes_received . set ( vote. signer_index ) ;
1508- self . votes . collect ( vote. clone ( ) ) ;
1510+ self . votes . collect ( vote. clone ( ) ) . expect ( "Must not attempt double vote" ) ;
15091511 cinfo ! ( ENGINE , "Voted {:?} as {}th validator." , vote, signer_index) ;
15101512 Ok ( Some ( vote) )
15111513 }
@@ -1531,7 +1533,7 @@ impl Worker {
15311533 on,
15321534 } ;
15331535
1534- self . votes . collect ( vote. clone ( ) ) ;
1536+ self . votes . collect ( vote. clone ( ) ) . expect ( "Must not attempt double vote on proposal" ) ; ;
15351537 cinfo ! ( ENGINE , "Voted {:?} as {}th proposer." , vote, signer_index) ;
15361538 Ok ( vote)
15371539 }
@@ -1783,7 +1785,7 @@ impl Worker {
17831785 ) ;
17841786 }
17851787
1786- if let Some ( double) = self . votes . collect ( message. clone ( ) ) {
1788+ if let Err ( double) = self . votes . collect ( message. clone ( ) ) {
17871789 cerror ! ( ENGINE , "Double Vote found {:?}" , double) ;
17881790 self . report_double_vote ( & double) ;
17891791 return None
@@ -2117,7 +2119,9 @@ impl Worker {
21172119 cdebug ! ( ENGINE , "Commit message-{} is verified" , commit_height) ;
21182120 for vote in votes {
21192121 if !self . votes . is_old_or_known ( & vote) {
2120- self . votes . collect ( vote) ;
2122+ if let Err ( double_vote) = self . votes . collect ( vote) {
2123+ cerror ! ( ENGINE , "Double vote found on_commit_message: {:?}" , double_vote) ;
2124+ }
21212125 }
21222126 }
21232127
0 commit comments