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>
impl<N: Network> CoinbaseSolution<N>
sourcepub fn new(solutions: Vec<ProverSolution<N>>) -> Result<Self>
pub fn new(solutions: Vec<ProverSolution<N>>) -> Result<Self>
Initializes a new instance of the solutions.
sourcepub fn puzzle_commitments(
&self
) -> impl '_ + Iterator<Item = &PuzzleCommitment<N>>
pub fn puzzle_commitments( &self ) -> impl '_ + Iterator<Item = &PuzzleCommitment<N>>
Returns the puzzle commitments.
sourcepub fn get_solution(
&self,
puzzle_commitment: &PuzzleCommitment<N>
) -> Option<&ProverSolution<N>>
pub fn get_solution( &self, puzzle_commitment: &PuzzleCommitment<N> ) -> Option<&ProverSolution<N>>
Returns the prover solution for the puzzle commitment.
sourcepub fn to_combined_proof_target(&self) -> Result<u128>
pub fn to_combined_proof_target(&self) -> Result<u128>
Returns the combined sum of the prover solutions.
sourcepub fn to_accumulator_point(&self) -> Result<Field<N>>
pub fn to_accumulator_point(&self) -> Result<Field<N>>
Returns the accumulator challenge point.
Methods from Deref<Target = IndexMap<PuzzleCommitment<N>, ProverSolution<N>>>§
sourcepub fn capacity(&self) -> usize
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.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Return the number of key-value pairs in the map.
Computes in O(1) time.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the map contains no elements.
Computes in O(1) time.
sourcepub fn iter(&self) -> Iter<'_, K, V>
pub fn iter(&self) -> Iter<'_, K, V>
Return an iterator over the key-value pairs of the map, in their order
sourcepub fn keys(&self) -> Keys<'_, K, V>
pub fn keys(&self) -> Keys<'_, K, V>
Return an iterator over the keys of the map, in their order
sourcepub fn values(&self) -> Values<'_, K, V>
pub fn values(&self) -> Values<'_, K, V>
Return an iterator over the values of the map, in their order
sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Return true
if an equivalent to key
exists in the map.
Computes in O(1) time (average).
sourcepub fn get<Q>(&self, key: &Q) -> Option<&V>
pub fn get<Q>(&self, key: &Q) -> Option<&V>
Return a reference to the value stored for key
, if it is present,
else None
.
Computes in O(1) time (average).
sourcepub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>
pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>
Return references to the key-value pair stored for key
,
if it is present, else None
.
Computes in O(1) time (average).
sourcepub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
Return item index, if it exists in the map
Computes in O(1) time (average).
sourcepub fn binary_search_keys(&self, x: &K) -> Result<usize, usize>where
K: Ord,
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.
sourcepub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>
pub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>
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.
sourcepub fn binary_search_by_key<'a, B, F>(
&'a self,
b: &B,
f: F
) -> Result<usize, usize>
pub fn binary_search_by_key<'a, B, F>( &'a self, b: &B, f: F ) -> Result<usize, usize>
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.
sourcepub fn partition_point<P>(&self, pred: P) -> usize
pub fn partition_point<P>(&self, pred: P) -> usize
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.
sourcepub fn as_slice(&self) -> &Slice<K, V>
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.
sourcepub fn get_index(&self, index: usize) -> Option<(&K, &V)>
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.
sourcepub fn get_range<R>(&self, range: R) -> Option<&Slice<K, V>>where
R: RangeBounds<usize>,
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.
sourcepub fn par_keys(&self) -> ParKeys<'_, K, V>
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
.
sourcepub fn par_values(&self) -> ParValues<'_, K, V>
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
.
Trait Implementations§
source§impl<N: Clone + Network> Clone for CoinbaseSolution<N>
impl<N: Clone + Network> Clone for CoinbaseSolution<N>
source§fn clone(&self) -> CoinbaseSolution<N>
fn clone(&self) -> CoinbaseSolution<N>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<N: Network> Debug for CoinbaseSolution<N>
impl<N: Network> Debug for CoinbaseSolution<N>
source§impl<N: Network> Deref for CoinbaseSolution<N>
impl<N: Network> Deref for CoinbaseSolution<N>
§type Target = IndexMap<PuzzleCommitment<N>, ProverSolution<N>>
type Target = IndexMap<PuzzleCommitment<N>, ProverSolution<N>>
source§impl<'de, N: Network> Deserialize<'de> for CoinbaseSolution<N>
impl<'de, N: Network> Deserialize<'de> for CoinbaseSolution<N>
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
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>
impl<N: Network> Display for CoinbaseSolution<N>
source§impl<N: Network> FromBytes for CoinbaseSolution<N>
impl<N: Network> FromBytes for CoinbaseSolution<N>
source§impl<N: Network> FromStr for CoinbaseSolution<N>
impl<N: Network> FromStr for CoinbaseSolution<N>
source§impl<N: PartialEq + Network> PartialEq for CoinbaseSolution<N>
impl<N: PartialEq + Network> PartialEq for CoinbaseSolution<N>
source§fn eq(&self, other: &CoinbaseSolution<N>) -> bool
fn eq(&self, other: &CoinbaseSolution<N>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<N: Network> Serialize for CoinbaseSolution<N>
impl<N: Network> Serialize for CoinbaseSolution<N>
source§impl<N: Network> ToBytes for CoinbaseSolution<N>
impl<N: Network> ToBytes for CoinbaseSolution<N>
impl<N: Eq + Network> Eq for CoinbaseSolution<N>
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> 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<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
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
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.