@@ -87,7 +87,7 @@ pub trait MultiSigner: Sync + Send {
8787 /// Retrieves a multi signature from a message
8888 fn get_multi_signature (
8989 & self ,
90- message : String ,
90+ message : & str ,
9191 ) -> Result < Option < ProtocolMultiSignature > , ProtocolError > ;
9292
9393 /// Create a multi signature from single signatures
@@ -96,12 +96,23 @@ pub trait MultiSigner: Sync + Send {
9696
9797/// MultiSignerImpl is an implementation of the MultiSigner
9898pub struct MultiSignerImpl {
99+ /// Message that is currently signed
99100 current_message : Option < Bytes > ,
101+
102+ /// Protocol parameters used for signing
100103 protocol_parameters : Option < ProtocolParameters > ,
104+
105+ /// Stake distribution used for signing
101106 stakes : ProtocolStakeDistribution ,
107+
108+ /// Registered signers
102109 signers : HashMap < ProtocolPartyId , ProtocolSignerVerificationKey > ,
110+
111+ /// Registered single signatures by party and lottery index
103112 single_signatures :
104113 HashMap < ProtocolPartyId , HashMap < ProtocolLotteryIndex , ProtocolSingleSignature > > ,
114+
115+ /// Recorded multi signatures by message signed
105116 multi_signatures : HashMap < String , String > ,
106117}
107118
@@ -271,10 +282,10 @@ impl MultiSigner for MultiSignerImpl {
271282 /// Retrieves a multi signature from a message
272283 fn get_multi_signature (
273284 & self ,
274- message : String ,
285+ message : & str ,
275286 ) -> Result < Option < ProtocolMultiSignature > , ProtocolError > {
276287 debug ! ( "Get multi signature for message {}" , message) ;
277- match self . multi_signatures . get ( & message) {
288+ match self . multi_signatures . get ( message) {
278289 Some ( multi_signature) => {
279290 let multi_signature: ProtocolMultiSignature =
280291 key_decode_hex ( multi_signature) . map_err ( ProtocolError :: Codec ) ?;
@@ -463,7 +474,7 @@ mod tests {
463474 . create_multi_signature ( )
464475 . expect ( "create multi sgnature should not fail" ) ;
465476 assert ! ( multi_signer
466- . get_multi_signature( message. encode_hex:: <String >( ) )
477+ . get_multi_signature( & message. encode_hex:: <String >( ) )
467478 . expect( "get multi signature should not fail" )
468479 . is_none( ) ) ;
469480 signatures[ 0 ..quorum_split]
@@ -477,7 +488,7 @@ mod tests {
477488 . create_multi_signature ( )
478489 . expect ( "create multi sgnature should not fail" ) ;
479490 assert ! ( multi_signer
480- . get_multi_signature( message. encode_hex:: <String >( ) )
491+ . get_multi_signature( & message. encode_hex:: <String >( ) )
481492 . expect( "get multi signature should not fail" )
482493 . is_none( ) ) ;
483494 signatures[ quorum_split..]
@@ -491,7 +502,7 @@ mod tests {
491502 . create_multi_signature ( )
492503 . expect ( "create multi sgnature should not fail" ) ;
493504 assert ! ( multi_signer
494- . get_multi_signature( message. encode_hex:: <String >( ) )
505+ . get_multi_signature( & message. encode_hex:: <String >( ) )
495506 . expect( "get multi signature should not fail" )
496507 . is_some( ) ) ;
497508 }
0 commit comments