pub trait TestCache {
type BsError: Debug;
type BlockSource: BlockSource<Error = Self::BsError>;
type InsertResult;
// Required methods
fn block_source(&self) -> &Self::BlockSource;
fn insert(&mut self, cb: &CompactBlock) -> Self::InsertResult;
fn truncate_to_height(&mut self, height: BlockHeight);
}
Available on crate feature
test-dependencies
only.Expand description
Trait used by tests that require a block cache.
Required Associated Types§
type BsError: Debug
type BlockSource: BlockSource<Error = Self::BsError>
type InsertResult
Required Methods§
Sourcefn block_source(&self) -> &Self::BlockSource
fn block_source(&self) -> &Self::BlockSource
Exposes the block cache as a BlockSource
.
Sourcefn insert(&mut self, cb: &CompactBlock) -> Self::InsertResult
fn insert(&mut self, cb: &CompactBlock) -> Self::InsertResult
Inserts a CompactBlock into the cache DB.
Sourcefn truncate_to_height(&mut self, height: BlockHeight)
fn truncate_to_height(&mut self, height: BlockHeight)
Deletes block data from the cache, retaining blocks at heights less than or equal to the specified height.