Add feature-gated serde support for Participant/ThresholdParams

These don't have secret data yet sometimes have value to be communicated.
This commit is contained in:
Luke Parker
2023-03-07 03:13:55 -05:00
parent b1ea2dfba6
commit 1a99629a4a
3 changed files with 6 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ pub mod tests;
/// The ID of a participant, defined as a non-zero u16.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Zeroize)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Participant(pub(crate) u16);
impl Participant {
pub fn new(i: u16) -> Option<Participant> {
@@ -123,6 +124,7 @@ pub(crate) fn validate_map<T, B: Clone + PartialEq + Eq + Debug>(
/// Parameters for a multisig.
// These fields should not be made public as they should be static
#[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ThresholdParams {
/// Participants needed to sign on behalf of the group.
t: u16,