pub struct Validator<A> {
pub address: A,
pub public_key: PublicKey,
pub voting_power: VotingPower,
}Expand description
A validator in the consensus protocol.
Each validator has an associated address and public key to uniquely identify them. The voting power determines their weight in consensus decisions.
Fields§
§address: AThe validator’s address
public_key: PublicKeyThe validator’s public key for signature verification
voting_power: VotingPowerThe validator’s voting power (weight in consensus)
Implementations§
Source§impl<A> Validator<A>
impl<A> Validator<A>
Sourcepub fn new(address: A, public_key: PublicKey) -> Self
pub fn new(address: A, public_key: PublicKey) -> Self
Create a new validator with the given address and public key.
The voting power defaults to 1.
Sourcepub fn with_voting_power(self, voting_power: VotingPower) -> Self
pub fn with_voting_power(self, voting_power: VotingPower) -> Self
Set the voting power for the validator.
This method returns self for method chaining.
Trait Implementations§
Source§impl<A: Ord> Ord for Validator<A>
impl<A: Ord> Ord for Validator<A>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<A: PartialOrd> PartialOrd for Validator<A>
impl<A: PartialOrd> PartialOrd for Validator<A>
impl<A: Eq> Eq for Validator<A>
impl<A> StructuralPartialEq for Validator<A>
Auto Trait Implementations§
impl<A> Freeze for Validator<A>where
A: Freeze,
impl<A> RefUnwindSafe for Validator<A>where
A: RefUnwindSafe,
impl<A> Send for Validator<A>where
A: Send,
impl<A> Sync for Validator<A>where
A: Sync,
impl<A> Unpin for Validator<A>where
A: Unpin,
impl<A> UnwindSafe for Validator<A>where
A: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more