pub struct DecompressedPruningSeed { /* private fields */ }
Expand description
This represents a valid Monero pruning seed.
It does allow representations of pruning seeds that Monero’s P2P network would not allow, i.e.
it does not restrict the seed to only have a log_stripes
of 8.
Implementations§
Source§impl DecompressedPruningSeed
impl DecompressedPruningSeed
Sourcepub const fn new(stripe: u32, log_stripes: u32) -> Result<Self, PruningError>
pub const fn new(stripe: u32, log_stripes: u32) -> Result<Self, PruningError>
Creates a new pruning seed from a stripe
and log_stripes
§What is a stripe
A stripe is the part of the blockchain this peer will keep.
Monero, when pruning, will split the blockchain into multiple “stripes”, that amount is currently 8 and each pruned peer will keep one of those 8 stripes.
§What is log_stripes
log_stripes
is log2 of the amount of stripes used.
For Monero, currently, that amount is 8 so log_stripes
will
be 3.
note this function allows you to make invalid seeds, this is done
to allow the specifics of pruning to change in the future. To make
a valid seed you currently MUST pass in a number 1 to 8 for stripe
and 3 for log_stripes
.
Sourcepub const fn decompress(seed: u32) -> Result<Option<Self>, PruningError>
pub const fn decompress(seed: u32) -> Result<Option<Self>, PruningError>
Attempts to decompress a raw pruning seed.
Will return Ok(None) if the pruning seed means no pruning.
An error means the pruning seed was invalid.
Sourcepub const fn has_full_block(
&self,
height: usize,
blockchain_height: usize,
) -> bool
pub const fn has_full_block( &self, height: usize, blockchain_height: usize, ) -> bool
Returns true
if a peer with this pruning seed should have a non-pruned version of a block.
Sourcepub fn get_next_unpruned_block(
&self,
block_height: usize,
blockchain_height: usize,
) -> Result<usize, PruningError>
pub fn get_next_unpruned_block( &self, block_height: usize, blockchain_height: usize, ) -> Result<usize, PruningError>
Gets the next unpruned block for a given block_height
and blockchain_height
Each seed will store, in a cyclic manner, a portion of blocks while discarding the ones that are out of your stripe. This function is finding the next height for which a specific seed will start storing blocks.
§Errors
This function will return an Error if the inputted block_height
or
blockchain_height
is greater than MAX_BLOCK_HEIGHT_USIZE
.
This function will also error if block_height
> blockchain_height
Sourcepub fn get_next_pruned_block(
&self,
block_height: usize,
blockchain_height: usize,
) -> Result<Option<usize>, PruningError>
pub fn get_next_pruned_block( &self, block_height: usize, blockchain_height: usize, ) -> Result<Option<usize>, PruningError>
Gets the next pruned block for a given block_height
and blockchain_height
Each seed will store, in a cyclic manner, a portion of blocks while discarding the ones that are out of your stripe. This function is finding the next height for which a specific seed will start pruning blocks.
§Errors
This function will return an Error if the inputted block_height
or
blockchain_height
is greater than MAX_BLOCK_HEIGHT_USIZE
.
This function will also error if block_height
> blockchain_height
Trait Implementations§
Source§impl BorshDeserialize for DecompressedPruningSeed
impl BorshDeserialize for DecompressedPruningSeed
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl Clone for DecompressedPruningSeed
impl Clone for DecompressedPruningSeed
Source§fn clone(&self) -> DecompressedPruningSeed
fn clone(&self) -> DecompressedPruningSeed
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DecompressedPruningSeed
impl Debug for DecompressedPruningSeed
Source§impl Hash for DecompressedPruningSeed
impl Hash for DecompressedPruningSeed
Source§impl Ord for DecompressedPruningSeed
impl Ord for DecompressedPruningSeed
Source§impl PartialEq for DecompressedPruningSeed
impl PartialEq for DecompressedPruningSeed
Source§impl PartialOrd for DecompressedPruningSeed
impl PartialOrd for DecompressedPruningSeed
impl Copy for DecompressedPruningSeed
impl Eq for DecompressedPruningSeed
impl StructuralPartialEq for DecompressedPruningSeed
Auto Trait Implementations§
impl Freeze for DecompressedPruningSeed
impl RefUnwindSafe for DecompressedPruningSeed
impl Send for DecompressedPruningSeed
impl Sync for DecompressedPruningSeed
impl Unpin for DecompressedPruningSeed
impl UnwindSafe for DecompressedPruningSeed
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,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes