Enum BlockChainContextRequest
pub enum BlockChainContextRequest {
Show 16 variants
CurrentRxVms,
BatchGetDifficulties(Vec<(u64, HardFork)>),
NewRXVM(([u8; 32], Arc<RandomXVm>)),
Update(NewBlockData),
PopBlocks {
numb_blocks: usize,
},
HardForkInfos,
FeeEstimate {
grace_blocks: u64,
},
RctOutputDistribution {
from_height: u64,
to_height: Option<NonZero<u64>>,
cumulative: bool,
},
CalculatePow {
hardfork: HardFork,
height: usize,
block: Box<Block>,
seed_hash: [u8; 32],
},
ClearAltCache,
AltChains,
AltChainContextCache {
prev_id: [u8; 32],
_token: AltChainRequestToken,
},
AltChainDifficultyCache {
prev_id: [u8; 32],
_token: AltChainRequestToken,
},
AltChainWeightCache {
prev_id: [u8; 32],
_token: AltChainRequestToken,
},
AltChainRxVM {
height: usize,
chain: Chain,
_token: AltChainRequestToken,
},
AddAltChainContextCache {
cache: Box<AltChainContextCache>,
_token: AltChainRequestToken,
},
}Expand description
A request to the blockchain context cache.
Variants§
CurrentRxVms
Gets all the current RandomX VMs.
BatchGetDifficulties(Vec<(u64, HardFork)>)
Get the next difficulties for these blocks.
Inputs: a list of block timestamps and hfs
The number of difficulties returned will be one more than the number of timestamps/ hfs.
NewRXVM(([u8; 32], Arc<RandomXVm>))
Add a VM that has been created outside of the blockchain context service to the blockchain context. This is useful when batch calculating POW as you may need to create a new VM if you batch a lot of blocks together, it would be wasteful to then not give this VM to the context service to then use when it needs to init a VM with the same seed.
This should include the seed used to init this VM and the VM.
Update(NewBlockData)
A request to add a new block to the cache.
PopBlocks
Pop blocks from the cache to the specified height.
Fields
HardForkInfos
Get information on all hardforks.
FeeEstimate
Get the current fee estimate.
RctOutputDistribution
Get the RCT output distribution.
Fields
CalculatePow
Calculate proof-of-work for this block.
Fields
ClearAltCache
Clear the alt chain context caches.
AltChains
Get information on all the current alternate chains.
AltChainContextCache
A request for an alt chain context cache.
This variant is private and is not callable from outside this crate, the block verifier service will handle getting the alt cache.
Fields
prev_id: [u8; 32]The previous block field in a BlockHeader.
_token: AltChainRequestTokenAn internal token to prevent external crates calling this request.
AltChainDifficultyCache
A request for a difficulty cache of an alternative chain.
This variant is private and is not callable from outside this crate, the block verifier service will handle getting the difficulty cache of an alt chain.
Fields
prev_id: [u8; 32]The previous block field in a BlockHeader.
_token: AltChainRequestTokenAn internal token to prevent external crates calling this request.
AltChainWeightCache
A request for a block weight cache of an alternative chain.
This variant is private and is not callable from outside this crate, the block verifier service will handle getting the weight cache of an alt chain.
Fields
prev_id: [u8; 32]The previous block field in a BlockHeader.
_token: AltChainRequestTokenAn internal token to prevent external crates calling this request.
AltChainRxVM
A request for a RX VM for an alternative chain.
Response variant: BlockChainContextResponse::AltChainRxVM.
This variant is private and is not callable from outside this crate, the block verifier service will handle getting the randomX VM of an alt chain.
Fields
chain: ChainThe chain to look in for the seed.
_token: AltChainRequestTokenAn internal token to prevent external crates calling this request.
AddAltChainContextCache
A request to add an alt chain context cache to the context cache.
This variant is private and is not callable from outside this crate, the block verifier service will handle returning the alt cache to the context service.
Trait Implementations§
§impl Clone for BlockChainContextRequest
impl Clone for BlockChainContextRequest
§fn clone(&self) -> BlockChainContextRequest
fn clone(&self) -> BlockChainContextRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for BlockChainContextRequest
impl Debug for BlockChainContextRequest
§impl Service<BlockChainContextRequest> for BlockchainContextService
impl Service<BlockChainContextRequest> for BlockchainContextService
§type Response = BlockChainContextResponse
type Response = BlockChainContextResponse
§type Future = Pin<Box<dyn Future<Output = Result<<BlockchainContextService as Service<BlockChainContextRequest>>::Response, <BlockchainContextService as Service<BlockChainContextRequest>>::Error>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<<BlockchainContextService as Service<BlockChainContextRequest>>::Response, <BlockchainContextService as Service<BlockChainContextRequest>>::Error>> + Send>>
§fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), <BlockchainContextService as Service<BlockChainContextRequest>>::Error>>
fn poll_ready( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), <BlockchainContextService as Service<BlockChainContextRequest>>::Error>>
Poll::Ready(Ok(())) when the service is able to process requests. Read more§fn call(
&mut self,
req: BlockChainContextRequest,
) -> <BlockchainContextService as Service<BlockChainContextRequest>>::Future
fn call( &mut self, req: BlockChainContextRequest, ) -> <BlockchainContextService as Service<BlockChainContextRequest>>::Future
Auto Trait Implementations§
impl Freeze for BlockChainContextRequest
impl RefUnwindSafe for BlockChainContextRequest
impl Send for BlockChainContextRequest
impl Sync for BlockChainContextRequest
impl Unpin for BlockChainContextRequest
impl UnsafeUnpin for BlockChainContextRequest
impl UnwindSafe for BlockChainContextRequest
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
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: 112 bytes
Size for each variant:
CurrentRxVms: 0 bytesBatchGetDifficulties: 24 bytesNewRXVM: 40 bytesUpdate: 112 bytesPopBlocks: 8 bytesHardForkInfos: 0 bytesFeeEstimate: 8 bytesRctOutputDistribution: 24 bytesCalculatePow: 56 bytesClearAltCache: 0 bytesAltChains: 0 bytesAltChainContextCache: 32 bytesAltChainDifficultyCache: 32 bytesAltChainWeightCache: 32 bytesAltChainRxVM: 16 bytesAddAltChainContextCache: 8 bytes