pub struct CoinbaseSolution<N: Network> { /* private fields */ }
Expand description

The coinbase puzzle solution is composed of individual prover solutions.

Implementations§

source§

impl<N: Network> CoinbaseSolution<N>

source

pub fn new(solutions: Vec<ProverSolution<N>>) -> Result<Self>

Initializes a new instance of the solutions.

source

pub fn puzzle_commitments( &self ) -> impl '_ + Iterator<Item = &PuzzleCommitment<N>>

Returns the puzzle commitments.

source

pub fn len(&self) -> usize

Returns the number of solutions.

source

pub fn is_empty(&self) -> bool

Returns true if there are no solutions.

source

pub fn get_solution( &self, puzzle_commitment: &PuzzleCommitment<N> ) -> Option<&ProverSolution<N>>

Returns the prover solution for the puzzle commitment.

source

pub fn to_combined_proof_target(&self) -> Result<u128>

Returns the combined sum of the prover solutions.

source

pub fn to_accumulator_point(&self) -> Result<Field<N>>

Returns the accumulator challenge point.

Methods from Deref<Target = IndexMap<PuzzleCommitment<N>, ProverSolution<N>>>§

source

pub fn capacity(&self) -> usize

Return the number of elements the map can hold without reallocating.

This number is a lower bound; the map might be able to hold more, but is guaranteed to be able to hold at least this many.

Computes in O(1) time.

source

pub fn hasher(&self) -> &S

Return a reference to the map’s BuildHasher.

source

pub fn len(&self) -> usize

Return the number of key-value pairs in the map.

Computes in O(1) time.

source

pub fn is_empty(&self) -> bool

Returns true if the map contains no elements.

Computes in O(1) time.

source

pub fn iter(&self) -> Iter<'_, K, V>

Return an iterator over the key-value pairs of the map, in their order

source

pub fn keys(&self) -> Keys<'_, K, V>

Return an iterator over the keys of the map, in their order

source

pub fn values(&self) -> Values<'_, K, V>

Return an iterator over the values of the map, in their order

source

pub fn contains_key<Q>(&self, key: &Q) -> bool
where Q: Hash + Equivalent<K> + ?Sized,

Return true if an equivalent to key exists in the map.

Computes in O(1) time (average).

source

pub fn get<Q>(&self, key: &Q) -> Option<&V>
where Q: Hash + Equivalent<K> + ?Sized,

Return a reference to the value stored for key, if it is present, else None.

Computes in O(1) time (average).

source

pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>
where Q: Hash + Equivalent<K> + ?Sized,

Return references to the key-value pair stored for key, if it is present, else None.

Computes in O(1) time (average).

source

pub fn get_full<Q>(&self, key: &Q) -> Option<(usize, &K, &V)>
where Q: Hash + Equivalent<K> + ?Sized,

Return item index, key and value

source

pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
where Q: Hash + Equivalent<K> + ?Sized,

Return item index, if it exists in the map

Computes in O(1) time (average).

source

pub fn binary_search_keys(&self, x: &K) -> Result<usize, usize>
where K: Ord,

Search over a sorted map for a key.

Returns the position where that key is present, or the position where it can be inserted to maintain the sort. See slice::binary_search for more details.

Computes in O(log(n)) time, which is notably less scalable than looking the key up using get_index_of, but this can also position missing keys.

source

pub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>
where F: FnMut(&'a K, &'a V) -> Ordering,

Search over a sorted map with a comparator function.

Returns the position where that value is present, or the position where it can be inserted to maintain the sort. See slice::binary_search_by for more details.

Computes in O(log(n)) time.

source

pub fn binary_search_by_key<'a, B, F>( &'a self, b: &B, f: F ) -> Result<usize, usize>
where F: FnMut(&'a K, &'a V) -> B, B: Ord,

Search over a sorted map with an extraction function.

Returns the position where that value is present, or the position where it can be inserted to maintain the sort. See slice::binary_search_by_key for more details.

Computes in O(log(n)) time.

source

pub fn partition_point<P>(&self, pred: P) -> usize
where P: FnMut(&K, &V) -> bool,

Returns the index of the partition point of a sorted map according to the given predicate (the index of the first element of the second partition).

See slice::partition_point for more details.

Computes in O(log(n)) time.

source

pub fn as_slice(&self) -> &Slice<K, V>

Returns a slice of all the key-value pairs in the map.

Computes in O(1) time.

source

pub fn get_index(&self, index: usize) -> Option<(&K, &V)>

Get a key-value pair by index

Valid indices are 0 <= index < self.len()

Computes in O(1) time.

source

pub fn get_range<R>(&self, range: R) -> Option<&Slice<K, V>>
where R: RangeBounds<usize>,

Returns a slice of key-value pairs in the given range of indices.

Valid indices are 0 <= index < self.len()

Computes in O(1) time.

source

pub fn first(&self) -> Option<(&K, &V)>

Get the first key-value pair

Computes in O(1) time.

source

pub fn last(&self) -> Option<(&K, &V)>

Get the last key-value pair

Computes in O(1) time.

source

pub fn par_keys(&self) -> ParKeys<'_, K, V>

Return a parallel iterator over the keys of the map.

While parallel iterators can process items in any order, their relative order in the map is still preserved for operations like reduce and collect.

source

pub fn par_values(&self) -> ParValues<'_, K, V>

Return a parallel iterator over the values of the map.

While parallel iterators can process items in any order, their relative order in the map is still preserved for operations like reduce and collect.

source

pub fn par_eq<V2, S2>(&self, other: &IndexMap<K, V2, S2>) -> bool
where V: PartialEq<V2>, V2: Sync, S2: BuildHasher + Sync,

Returns true if self contains all of the same key-value pairs as other, regardless of each map’s indexed order, determined in parallel.

Trait Implementations§

source§

impl<N: Clone + Network> Clone for CoinbaseSolution<N>

source§

fn clone(&self) -> CoinbaseSolution<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<N: Network> Debug for CoinbaseSolution<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Prints the solutions as a JSON-string.

source§

impl<N: Network> Deref for CoinbaseSolution<N>

§

type Target = IndexMap<PuzzleCommitment<N>, ProverSolution<N>>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'de, N: Network> Deserialize<'de> for CoinbaseSolution<N>

source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserializes the solutions from a JSON-string or buffer.

source§

impl<N: Network> Display for CoinbaseSolution<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Displays the solutions as a JSON-string.

source§

impl<N: Network> FromBytes for CoinbaseSolution<N>

source§

fn read_le<R: Read>(reader: R) -> IoResult<Self>

Reads the solutions from the buffer.

source§

fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized,

Returns Self from a byte array in little-endian order.
source§

impl<N: Network> FromStr for CoinbaseSolution<N>

source§

fn from_str(solutions: &str) -> Result<Self, Self::Err>

Initializes the solutions from a JSON-string.

§

type Err = Error

The associated error which can be returned from parsing.
source§

impl<N: PartialEq + Network> PartialEq for CoinbaseSolution<N>

source§

fn eq(&self, other: &CoinbaseSolution<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<N: Network> Serialize for CoinbaseSolution<N>

source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serializes the solutions to a JSON-string or buffer.

source§

impl<N: Network> ToBytes for CoinbaseSolution<N>

source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Writes the solutions to the buffer.

source§

fn to_bytes_le(&self) -> Result<Vec<u8>, Error>
where Self: Sized,

Returns self as a byte array in little-endian order.
source§

impl<N: Eq + Network> Eq for CoinbaseSolution<N>

source§

impl<N: Network> StructuralPartialEq for CoinbaseSolution<N>

Auto Trait Implementations§

§

impl<N> RefUnwindSafe for CoinbaseSolution<N>
where <N as Environment>::Field: RefUnwindSafe, <<N as Environment>::PairingCurve as PairingEngine>::G1Affine: RefUnwindSafe, <N as Environment>::Projective: RefUnwindSafe,

§

impl<N> Send for CoinbaseSolution<N>

§

impl<N> Sync for CoinbaseSolution<N>

§

impl<N> Unpin for CoinbaseSolution<N>
where <N as Environment>::Field: Unpin, <<N as Environment>::PairingCurve as PairingEngine>::G1Affine: Unpin, <N as Environment>::Projective: Unpin,

§

impl<N> UnwindSafe for CoinbaseSolution<N>
where <N as Environment>::Field: UnwindSafe, <<N as Environment>::PairingCurve as PairingEngine>::G1Affine: UnwindSafe, <N as Environment>::Projective: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<'de, T> DeserializeExt<'de> for T

source§

fn take_from_value<D>( value: &mut Value, field: &str ) -> Result<T, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

§

fn to_smolstr(&self) -> SmolStr

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,