@@ -547,11 +547,14 @@ pub fn deal(
547547 strategy,
548548 ) ;
549549
550- Ok ( DealerLog {
551- dealing : Dealing :: reckon ( info, nonce, poly, masks) ?,
552- commitments,
553- }
554- . sign ( me, info) )
550+ Ok ( SignedDealerLog :: sign (
551+ me,
552+ info,
553+ DealerLog {
554+ dealing : Dealing :: reckon ( info, nonce, poly, masks) ?,
555+ commitments,
556+ } ,
557+ ) )
555558}
556559
557560struct Selection {
@@ -792,6 +795,17 @@ impl Read for SignedDealerLog {
792795}
793796
794797impl SignedDealerLog {
798+ fn sign ( signer : & PrivateKey , info : & Info , log : DealerLog ) -> Self {
799+ let dealer = signer. public ( ) ;
800+ let msg = Self :: signature_message ( info, & log) ;
801+ let signature = signer. sign ( NAMESPACE , & msg) ;
802+ Self {
803+ dealer,
804+ signature,
805+ log,
806+ }
807+ }
808+
795809 /// Verify the signature against a specific round [`Info`] and extract the
796810 /// dealer's public key and log.
797811 ///
@@ -893,17 +907,6 @@ impl DealerLog {
893907 } )
894908 . collect ( )
895909 }
896-
897- fn sign ( self , signer : & PrivateKey , info : & Info ) -> SignedDealerLog {
898- let dealer = signer. public ( ) ;
899- let msg = SignedDealerLog :: signature_message ( info, & self ) ;
900- let signature = signer. sign ( NAMESPACE , & msg) ;
901- SignedDealerLog {
902- dealer,
903- signature,
904- log : self ,
905- }
906- }
907910}
908911
909912#[ derive( Clone ) ]
@@ -1374,11 +1377,14 @@ mod test_plan {
13741377 ) ;
13751378 let dealing = Dealing :: reckon ( & info, nonce, poly, masks)
13761379 . expect ( "reckon should succeed" ) ;
1377- DealerLog {
1378- dealing,
1379- commitments,
1380- }
1381- . sign ( dk, & info)
1380+ SignedDealerLog :: sign (
1381+ dk,
1382+ & info,
1383+ DealerLog {
1384+ dealing,
1385+ commitments,
1386+ } ,
1387+ )
13821388 } else {
13831389 deal ( & mut rng, setup, & info, dk, share, strategy)
13841390 . map_err ( |e| anyhow:: anyhow!( "{e:?}" ) ) ?
0 commit comments