[][src]Struct grin_core::pow::Proof

pub struct Proof {
    pub edge_bits: u8,
    pub nonces: Vec<u64>,
}

A Cuck(at)oo Cycle proof of work, consisting of the edge_bits to get the graph size (i.e. the 2-log of the number of edges) and the nonces of the graph solution. While being expressed as u64 for simplicity, nonces a.k.a. edge indices range from 0 to (1 << edge_bits) - 1

The hash of the Proof is the hash of its packed nonces when serializing them at their exact bit size. The resulting bit sequence is padded to be byte-aligned.

Fields

edge_bits: u8

Power of 2 used for the size of the cuckoo graph

nonces: Vec<u64>

The nonces

Methods

impl Proof[src]

pub fn new(in_nonces: Vec<u64>) -> Proof[src]

Builds a proof with provided nonces at default edge_bits

pub fn zero(proof_size: usize) -> Proof[src]

Builds a proof with all bytes zeroed out

pub fn random(proof_size: usize) -> Proof[src]

Builds a proof with random POW data, needed so that tests that ignore POW don't fail due to duplicate hashes

pub fn proof_size(&self) -> usize[src]

Returns the proof size

Trait Implementations

impl DefaultHashable for Proof[src]

impl Writeable for Proof[src]

impl Readable for Proof[src]

impl PartialOrd<Proof> for Proof[src]

impl PartialEq<Proof> for Proof[src]

impl Clone for Proof[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for Proof[src]

impl Debug for Proof[src]

impl Serialize for Proof[src]

Auto Trait Implementations

impl Send for Proof

impl Sync for Proof

Blanket Implementations

impl<D> Hashed for D where
    D: DefaultHashable
[src]

impl<H> ShortIdentifiable for H where
    H: Hashed
[src]

fn short_id(&Self, &Hash, u64) -> ShortId[src]

Generate a short_id via the following -

  • extract k0/k1 from block_hash hashed with the nonce (first two u64 values) * initialize a siphasher24 with k0/k1
    • self.hash() passing in the siphasher24 instance
    • drop the 2 most significant bytes (to return a 6 byte short_id)

impl<T> PMMRIndexHashable for T where
    T: DefaultHashable
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> DebugAny for T where
    T: Any + Debug

impl<T> CloneAny for T where
    T: Clone + Any

impl<T> UnsafeAny for T where
    T: Any

impl<T> Erased for T

impl<T> Same for T

type Output = T

Should always be Self