/// Helper to create the signature share
Helper to create the signature share
Helper to create the signature share
fn crypto_create_signature_share(
        &self,
        block_reader: &dyn EcdsaBlockReader,
        request_id: &RequestId,
        sig_inputs: &ThresholdEcdsaSigInputs,
    ) -> EcdsaChangeSet {
        if self.crypto_load_transcript(sig_inputs).is_err() {
            self.metrics.sign_errors_inc("load_transcript");
            return Default::default();
        } else {
            self.metrics.sign_metrics_inc("transcript_loaded");
        }
        ThresholdEcdsaSigner::sign_share(&*self.crypto, sig_inputs).map_or_else(
            |error| {
                warn!(
                    self.log,
                    "Failed to create share: request_id = {:?}, {:?}", request_id, error
                );
                self.metrics.sign_errors_inc("create_sig_share");
                Default::default()
            },
            |share| {
                let sig_share = EcdsaSigShare {
                    requested_height: block_reader.height(),
                    signer_id: self.node_id,
                    request_id: request_id.clone(),
                    share,
                };
                self.metrics.sign_metrics_inc("sig_shares_sent");
                vec![EcdsaChangeAction::AddToValidated(
                    EcdsaMessage::EcdsaSigShare(sig_share),
                )]
            },
        )
    }
fn crypto_create_signature_share ( & self , block_reader : & dyn EcdsaBlockReader , request_id : & RequestId , sig_inputs : & ThresholdEcdsaSigInputs , ) -> EcdsaChangeSet { if self . crypto_load_transcript ( sig_inputs ) . is_err ( ) { self . metrics . sign_errors_inc ( " " ) ; return Default :: default ( ) ; } else { self . metrics . sign_metrics_inc ( " " ) ; } ThresholdEcdsaSigner :: sign_share ( & * self . crypto , sig_inputs ) . map_or_else ( | error | { warn ! ( self log " " request_id error ) ; self . metrics . sign_errors_inc ( " " ) ; Default :: default ( ) } , | share | { let sig_share = EcdsaSigShare { requested_height : block_reader . height ( ) , signer_id : self . node_id , request_id : request_id . clone ( ) , share , } ; self . metrics . sign_metrics_inc ( " " ) ; vec ! [ EcdsaChangeAction AddToValidated ( EcdsaMessage EcdsaSigShare ( sig_share ) ) ] } , ) }
Helper to create the signature share
Helper to create the signature share
&self
block_reader
&dyn EcdsaBlockReader
request_id
&RequestId
sig_inputs
&ThresholdEcdsaSigInputs