Struct blockchain::Blockchain
source · pub struct Blockchain {
tip: Arc<Reference>,
heads: LruCache<HeaderId, Arc<Reference>>,
cache: LruCache<HeaderId, Arc<Reference>>,
}
Fields§
§tip: Arc<Reference>
§heads: LruCache<HeaderId, Arc<Reference>>
§cache: LruCache<HeaderId, Arc<Reference>>
Implementations§
source§impl Blockchain
impl Blockchain
sourcepub fn new(configuration: &Configuration, block0: Arc<Reference>) -> Self
pub fn new(configuration: &Configuration, block0: Arc<Reference>) -> Self
start a blockchain with the given block as starting point
pub fn tip(&self) -> Arc<Reference>
sourcepub fn branches(&self) -> Iter<'_, HeaderId, Arc<Reference>>
pub fn branches(&self) -> Iter<'_, HeaderId, Arc<Reference>>
get an iterator for all the branches currently being considered by
the Blockchain
.
The tip
is already included in the list too and it may be that
the some branches in the list are no longer Head
only.
pub fn put(&mut self, block: &Block) -> Result<Event, Error>
fn put_head( &mut self, reference: Arc<Reference>, new_branch: bool, epoch_transition: bool ) -> Event
Auto Trait Implementations§
impl RefUnwindSafe for Blockchain
impl Send for Blockchain
impl Sync for Blockchain
impl Unpin for Blockchain
impl UnwindSafe for Blockchain
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
Mutably borrows from an owned value. Read more