Skip to main content

BlockchainReadRequest

Enum BlockchainReadRequest 

Source
pub enum BlockchainReadRequest {
Show 34 variants BlockCompleteEntries(Vec<[u8; 32]>), BlockCompleteEntriesByHeight(Vec<usize>), BlockCompleteEntriesAboveSplitPoint { chain: Vec<[u8; 32]>, start_height: Option<usize>, no_miner_tx: bool, len: usize, pruned: bool, }, BlockExtendedHeader(usize), BlockHash(usize, Chain), BlockHashInRange(Range<usize>, Chain), FindBlock([u8; 32]), FilterUnknownHashes(HashSet<[u8; 32]>), BlockExtendedHeaderInRange(Range<usize>, Chain), ChainHeight, GeneratedCoins(usize), CumulativeRctOutsInRange(Range<usize>), Outputs { outputs: IndexMap<u64, IndexSet<u64>>, get_txid: bool, }, OutputsVec { outputs: Vec<(u64, u64)>, get_txid: bool, }, NumberOutputsWithAmount(Vec<u64>), KeyImagesSpent(HashSet<[u8; 32]>), KeyImagesSpentVec(Vec<[u8; 32]>), CompactChainHistory, NextChainEntry(Vec<[u8; 32]>, usize), FindFirstUnknown(Vec<[u8; 32]>), TxsInBlock { block_hash: [u8; 32], tx_indexes: Vec<u64>, }, AltBlocksInChain(ChainId), Block { height: usize, }, BlockByHash([u8; 32]), TotalTxCount, DatabaseSize, OutputHistogram(OutputHistogramInput), PreRctOutputDistribution(PreRctOutputDistributionInput), CoinbaseTxSum { height: usize, count: u64, }, AltChains, AltChainCount, Transactions { tx_hashes: Vec<[u8; 32]>, }, TotalRctOutputs, TxOutputIndexes { tx_hash: [u8; 32], },
}
Expand description

A read request to the blockchain database.

This pairs with BlockchainResponse, where each variant here matches in name with a BlockchainResponse variant. For example, the proper response for a BlockchainReadRequest::BlockHash would be a BlockchainResponse::BlockHash.

See Response for the expected responses per Request.

Variants§

§

BlockCompleteEntries(Vec<[u8; 32]>)

Request BlockCompleteEntrys.

The input is the block hashes.

§

BlockCompleteEntriesByHeight(Vec<usize>)

Request BlockCompleteEntrys.

The input is the block heights.

§

BlockCompleteEntriesAboveSplitPoint

Request BlockCompleteEntrys (and output indices) for the blocks above the split point between our chain and the given chain.

Fields

§chain: Vec<[u8; 32]>
§start_height: Option<usize>

If Some, skip the chain scan and start serving from this height directly.

§no_miner_tx: bool

If true, each block’s miner-tx entry in the output indices is an empty placeholder.

§len: usize
§pruned: bool
§

BlockExtendedHeader(usize)

Request a block’s extended header.

The input is the block’s height.

§

BlockHash(usize, Chain)

Request a block’s hash.

The input is the block’s height and the chain it is on.

§

BlockHashInRange(Range<usize>, Chain)

Request a range of block’s hashes.

The input is the range of block heights and the chain it is on.

§

FindBlock([u8; 32])

Request to check if we have a block and which Chain it is on.

The input is the block’s hash.

§

FilterUnknownHashes(HashSet<[u8; 32]>)

Removes the block hashes that are not in the main chain.

This should filter (remove) hashes in alt-blocks as well.

§

BlockExtendedHeaderInRange(Range<usize>, Chain)

Request a range of block extended headers.

The input is a range of block heights.

§

ChainHeight

Request the current chain height.

Note that this is not the top-block height.

§

GeneratedCoins(usize)

Request the total amount of generated coins (atomic units) at this height.

§

CumulativeRctOutsInRange(Range<usize>)

Request the cumulative RCT output count for the main-chain blocks in this height range.

§

Outputs

Request data for multiple outputs.

The input is a HashMap where:

  • Key = output amount
  • Value = set of amount indices

For pre-RCT outputs, the amount is non-zero, and the amount indices represent the wanted indices of duplicate amount outputs, i.e.:

// list of outputs with amount 10
[0, 1, 2, 3, 4, 5]
//  ^     ^
// we only want these two, so we would provide
// `amount: 10, amount_index: {1, 3}`

For RCT outputs, the amounts would be 0 and the amount indices would represent the global RCT output indices.

Fields

§outputs: IndexMap<u64, IndexSet<u64>>
§get_txid: bool
§

OutputsVec

This is the same as BlockchainReadRequest::Outputs but with a Vec container.

The input Vec values are (amount, amount_index).

The response will be in the same order as the request.

Fields

§outputs: Vec<(u64, u64)>
§get_txid: bool
§

NumberOutputsWithAmount(Vec<u64>)

Request the amount of outputs with a certain amount.

The input is a list of output amounts.

§

KeyImagesSpent(HashSet<[u8; 32]>)

Check the spend status of key images.

Input is a set of key images.

§

KeyImagesSpentVec(Vec<[u8; 32]>)

Same as BlockchainReadRequest::KeyImagesSpent but with a Vec.

The response will be in the same order as the request.

§

CompactChainHistory

A request for the compact chain history.

§

NextChainEntry(Vec<[u8; 32]>, usize)

A request for the next chain entry.

Input is a list of block hashes and the amount of block hashes to return in the next chain entry.

§Invariant

The Vec containing the block IDs must be sorted in reverse chronological block order, or else the returned response is unspecified and meaningless, as this request performs a binary search

§

FindFirstUnknown(Vec<[u8; 32]>)

A request to find the first unknown block ID in a list of block IDs.

§Invariant

The Vec containing the block IDs must be sorted in chronological block order, or else the returned response is unspecified and meaningless, as this request performs a binary search.

§

TxsInBlock

A request for transactions from a specific block.

Fields

§block_hash: [u8; 32]

The block to get transactions from.

§tx_indexes: Vec<u64>

The indexes of the transactions from the block. This is not the global index of the txs, instead it is the local index as they appear in the block.

§

AltBlocksInChain(ChainId)

A request for all alt blocks in the chain with the given ChainId.

§

Block

Get a [Block] by its height.

Fields

§height: usize
§

BlockByHash([u8; 32])

Get a [Block] by its hash.

§

TotalTxCount

Get the total amount of non-coinbase transactions in the chain.

§

DatabaseSize

Get the current size of the database.

§

OutputHistogram(OutputHistogramInput)

Get an output histogram.

TODO: document fields after impl.

§

PreRctOutputDistribution(PreRctOutputDistributionInput)

Get the distribution for a pre-RCT output amount.

§

CoinbaseTxSum

Get the coinbase amount and the fees amount for N last blocks starting at particular height.

TODO: document fields after impl.

Fields

§height: usize
§count: u64
§

AltChains

Get information on all alternative chains.

§

AltChainCount

Get the amount of alternative chains that exist.

§

Transactions

Get transaction blobs by their hashes.

Returned transactions must preserve request order, omitting missing hashes.

Fields

§tx_hashes: Vec<[u8; 32]>
§

TotalRctOutputs

Get the total amount of RCT outputs in the blockchain.

§

TxOutputIndexes

Get the output indexes of a transaction.

Fields

§tx_hash: [u8; 32]

Trait Implementations§

Source§

impl Clone for BlockchainReadRequest

Source§

fn clone(&self) -> BlockchainReadRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BlockchainReadRequest

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for BlockchainReadRequest

Source§

impl PartialEq for BlockchainReadRequest

Source§

fn eq(&self, other: &BlockchainReadRequest) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BlockchainReadRequest

Auto Trait Implementations§

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

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
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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
Source§

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

Source§

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>,

Source§

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

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: 80 bytes

Size for each variant:

  • BlockCompleteEntries: 32 bytes
  • BlockCompleteEntriesByHeight: 32 bytes
  • BlockCompleteEntriesAboveSplitPoint: 64 bytes
  • BlockExtendedHeader: 16 bytes
  • BlockHash: 24 bytes
  • BlockHashInRange: 32 bytes
  • FindBlock: 40 bytes
  • FilterUnknownHashes: 56 bytes
  • BlockExtendedHeaderInRange: 32 bytes
  • ChainHeight: 0 bytes
  • GeneratedCoins: 16 bytes
  • CumulativeRctOutsInRange: 24 bytes
  • Outputs: 80 bytes
  • OutputsVec: 40 bytes
  • NumberOutputsWithAmount: 32 bytes
  • KeyImagesSpent: 56 bytes
  • KeyImagesSpentVec: 32 bytes
  • CompactChainHistory: 0 bytes
  • NextChainEntry: 40 bytes
  • FindFirstUnknown: 32 bytes
  • TxsInBlock: 64 bytes
  • AltBlocksInChain: 16 bytes
  • Block: 16 bytes
  • BlockByHash: 40 bytes
  • TotalTxCount: 0 bytes
  • DatabaseSize: 0 bytes
  • OutputHistogram: 64 bytes
  • PreRctOutputDistribution: 56 bytes
  • CoinbaseTxSum: 24 bytes
  • AltChains: 0 bytes
  • AltChainCount: 0 bytes
  • Transactions: 32 bytes
  • TotalRctOutputs: 0 bytes
  • TxOutputIndexes: 40 bytes