dpp/errors/consensus/signature/
basic_ecdsa_error.rs

1use crate::consensus::signature::signature_error::SignatureError;
2use crate::consensus::ConsensusError;
3use crate::errors::ProtocolError;
4use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize};
5use thiserror::Error;
6
7use bincode::{Decode, Encode};
8
9#[derive(
10    Error,
11    Debug,
12    Clone,
13    PartialEq,
14    Eq,
15    Default,
16    Encode,
17    Decode,
18    PlatformSerialize,
19    PlatformDeserialize,
20)]
21#[error("ecdsa signing error {message}")]
22#[platform_serialize(unversioned)]
23pub struct BasicECDSAError {
24    message: String,
25}
26
27/*
28
29DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION
30
31*/
32
33impl BasicECDSAError {
34    pub fn new(message: String) -> Self {
35        Self { message }
36    }
37}
38
39impl From<BasicECDSAError> for ConsensusError {
40    fn from(err: BasicECDSAError) -> Self {
41        Self::SignatureError(SignatureError::BasicECDSAError(err))
42    }
43}