pub struct NodeAnnouncement {
pub version: u8,
pub features: Features,
pub timestamp: Timestamp,
pub alias: Alias,
pub addresses: BoundedVec<Address, ADDRESS_LIMIT>,
pub nonce: u64,
pub agent: UserAgent,
}
Expand description
Node announcing itself to the network.
Fields§
§version: u8
Supported protocol version.
features: Features
Advertized features.
timestamp: Timestamp
Monotonic timestamp.
alias: Alias
Non-unique alias.
addresses: BoundedVec<Address, ADDRESS_LIMIT>
Announced addresses.
nonce: u64
Nonce used for announcement proof-of-work.
agent: UserAgent
User-agent string.
Implementations§
Source§impl NodeAnnouncement
impl NodeAnnouncement
Sourcepub fn work(&self) -> u32
pub fn work(&self) -> u32
Calculate the amount of work that went into creating this announcement.
Proof-of-work uses the scrypt
algorithm with the parameters in
Announcement::POW_PARAMS
. The “work” is calculated by counting the number of leading
zero bits after running scrypt
on a serialized NodeAnnouncement
using
wire::serialize
.
In other words, work = leading-zeros(scrypt(serialize(announcement)))
.
Higher numbers mean higher difficulty. For each increase in work, difficulty is doubled.
For instance, an output of 7
is four times more work than an output of 5
.
Trait Implementations§
Source§impl BindableWithIndex for &NodeAnnouncement
impl BindableWithIndex for &NodeAnnouncement
Source§impl Clone for NodeAnnouncement
impl Clone for NodeAnnouncement
Source§fn clone(&self) -> NodeAnnouncement
fn clone(&self) -> NodeAnnouncement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for NodeAnnouncement
impl Debug for NodeAnnouncement
Source§impl From<NodeAnnouncement> for AnnouncementMessage
impl From<NodeAnnouncement> for AnnouncementMessage
Source§fn from(ann: NodeAnnouncement) -> Self
fn from(ann: NodeAnnouncement) -> Self
Converts to this type from the input type.
Source§impl PartialEq for NodeAnnouncement
impl PartialEq for NodeAnnouncement
Source§impl TryFrom<&Value> for NodeAnnouncement
impl TryFrom<&Value> for NodeAnnouncement
impl Eq for NodeAnnouncement
impl StructuralPartialEq for NodeAnnouncement
Auto Trait Implementations§
impl Freeze for NodeAnnouncement
impl RefUnwindSafe for NodeAnnouncement
impl Send for NodeAnnouncement
impl Sync for NodeAnnouncement
impl Unpin for NodeAnnouncement
impl UnwindSafe for NodeAnnouncement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more