pub struct PaymentQuote {
pub content: XorName,
pub timestamp: SystemTime,
pub quoting_metrics: QuotingMetrics,
pub rewards_address: Address,
pub pub_key: Vec<u8>,
pub signature: Vec<u8>,
}Expand description
A payment quote to store data given by a node to a client Note that the PaymentQuote is a contract between the node and itself to make sure the clients aren’t mispaying. It is NOT a contract between the client and the node.
Fields§
§content: XorNamethe content paid for
timestamp: SystemTimethe local node time when the quote was created
quoting_metrics: QuotingMetricsquoting metrics being used to generate this quote
rewards_address: Addressthe node’s wallet address
pub_key: Vec<u8>the node’s libp2p identity public key in bytes (PeerId)
signature: Vec<u8>the node’s signature for the quote
Implementations§
Source§impl PaymentQuote
impl PaymentQuote
pub fn hash(&self) -> QuoteHash
Sourcepub fn bytes_for_signing(
xorname: XorName,
timestamp: SystemTime,
quoting_metrics: &QuotingMetrics,
rewards_address: &RewardsAddress,
) -> Vec<u8> ⓘ
pub fn bytes_for_signing( xorname: XorName, timestamp: SystemTime, quoting_metrics: &QuotingMetrics, rewards_address: &RewardsAddress, ) -> Vec<u8> ⓘ
returns the bytes to be signed from the given parameters
Sourcepub fn bytes_for_sig(&self) -> Vec<u8> ⓘ
pub fn bytes_for_sig(&self) -> Vec<u8> ⓘ
Returns the bytes to be signed from self
Sourcepub fn peer_id(&self) -> Result<PeerId, EvmError>
pub fn peer_id(&self) -> Result<PeerId, EvmError>
Returns the peer id of the node that created the quote
Sourcepub fn check_is_signed_by_claimed_peer(&self, claimed_peer: PeerId) -> bool
pub fn check_is_signed_by_claimed_peer(&self, claimed_peer: PeerId) -> bool
Check self is signed by the claimed peer
Sourcepub fn has_expired(&self) -> bool
pub fn has_expired(&self) -> bool
Returns true if the quote has expired
Sourcepub fn is_newer_than(&self, other: &Self) -> bool
pub fn is_newer_than(&self, other: &Self) -> bool
Check whether self is newer than the target quote.
Sourcepub fn historical_verify(&self, other: &Self) -> bool
pub fn historical_verify(&self, other: &Self) -> bool
Check against a new quote, verify whether it is a valid one from self perspective.
Returns true to flag the other quote is valid, from self perspective.
Trait Implementations§
Source§impl Clone for PaymentQuote
impl Clone for PaymentQuote
Source§fn clone(&self) -> PaymentQuote
fn clone(&self) -> PaymentQuote
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PaymentQuote
impl Debug for PaymentQuote
Source§impl<'de> Deserialize<'de> for PaymentQuote
impl<'de> Deserialize<'de> for PaymentQuote
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for PaymentQuote
impl Ord for PaymentQuote
Source§fn cmp(&self, other: &PaymentQuote) -> Ordering
fn cmp(&self, other: &PaymentQuote) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PaymentQuote
impl PartialEq for PaymentQuote
Source§impl PartialOrd for PaymentQuote
impl PartialOrd for PaymentQuote
Source§impl Serialize for PaymentQuote
impl Serialize for PaymentQuote
impl Eq for PaymentQuote
impl StructuralPartialEq for PaymentQuote
Auto Trait Implementations§
impl Freeze for PaymentQuote
impl RefUnwindSafe for PaymentQuote
impl Send for PaymentQuote
impl Sync for PaymentQuote
impl Unpin for PaymentQuote
impl UnwindSafe for PaymentQuote
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<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
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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