@@ -20,7 +20,6 @@ use std::sync::{Arc, Weak};
2020use std:: thread:: { Builder , JoinHandle } ;
2121use std:: time:: { Duration , SystemTime , UNIX_EPOCH } ;
2222
23- use ccrypto:: blake256;
2423use ckey:: { public_to_address, verify_schnorr, Address , SchnorrSignature } ;
2524use cnetwork:: { EventSender , NodeId } ;
2625use crossbeam_channel as crossbeam;
@@ -837,13 +836,12 @@ impl Worker {
837836 step : VoteStep :: new ( height, r, self . step . to_step ( ) ) ,
838837 block_hash,
839838 } ;
840- let vote_info = on. rlp_bytes ( ) ;
841839 let signer_index = self . signer_index ( ) . or_else ( || {
842840 ctrace ! ( ENGINE , "No message, since there is no engine signer." ) ;
843841 None
844842 } ) ?;
845843 let signature = self
846- . sign ( blake256 ( & vote_info ) )
844+ . sign ( & on )
847845 . map_err ( |error| {
848846 ctrace ! ( ENGINE , "{}th validator could not sign the message {}" , signer_index, error) ;
849847 error
@@ -1124,7 +1122,7 @@ impl Worker {
11241122 step : VoteStep :: new ( header. number ( ) as Height , self . view , Step :: Propose ) ,
11251123 block_hash : Some ( hash) ,
11261124 } ;
1127- let signature = self . sign ( vote_on. hash ( ) ) . expect ( "I am proposer" ) ;
1125+ let signature = self . sign ( & vote_on) . expect ( "I am proposer" ) ;
11281126 self . votes . vote (
11291127 ConsensusMessage :: new_proposal ( signature, & * self . validators , header, self . view , prev_proposer_idx)
11301128 . expect ( "I am proposer" ) ,
@@ -1484,7 +1482,7 @@ impl Worker {
14841482 } ;
14851483 let parent_hash = header. parent_hash ( ) ;
14861484 let prev_proposer_idx = self . block_proposer_idx ( * parent_hash) . expect ( "Prev block must exists" ) ;
1487- let signature = self . sign ( vote_on. hash ( ) ) . expect ( "I am proposer" ) ;
1485+ let signature = self . sign ( & vote_on) . expect ( "I am proposer" ) ;
14881486 self . votes . vote (
14891487 ConsensusMessage :: new_proposal ( signature, & * self . validators , & header, self . view , prev_proposer_idx)
14901488 . expect ( "I am proposer" ) ,
@@ -1517,8 +1515,8 @@ impl Worker {
15171515 self . signer . set_to_keep_decrypted_account ( ap, address) ;
15181516 }
15191517
1520- fn sign ( & self , hash : H256 ) -> Result < SchnorrSignature , Error > {
1521- self . signer . sign ( hash) . map_err ( Into :: into)
1518+ fn sign ( & self , vote_on : & VoteOn ) -> Result < SchnorrSignature , Error > {
1519+ self . signer . sign ( vote_on . hash ( ) ) . map_err ( Into :: into)
15221520 }
15231521
15241522 fn signer_index ( & self ) -> Option < usize > {
0 commit comments