use serde::{Deserialize, Serialize};
use std::collections::BTreeSet;
use threshold_crypto::PublicKeySet;
use xor_name::{Prefix, XorName};
use crate::PublicKey;
#[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize)]
pub struct SectionElders {
pub prefix: Prefix,
pub names: BTreeSet<XorName>,
pub key_set: PublicKeySet,
}
impl SectionElders {
pub fn key(&self) -> threshold_crypto::PublicKey {
self.key_set.public_key()
}
pub fn name(&self) -> XorName {
PublicKey::Bls(self.key()).into()
}
pub fn address(&self) -> XorName {
self.prefix.name()
}
}