pub struct RoundContext { /* private fields */ }Expand description
1つのラウンドの投票の数え方。catapult の RoundContext
Implementations§
Source§impl RoundContext
impl RoundContext
Sourcepub fn new(total_weight: u64, threshold: u64) -> Self
pub fn new(total_weight: u64, threshold: u64) -> Self
投票者の重みの合計が total_weight、閾値が threshold のラウンド
pub fn is_empty(&self) -> bool
Sourcepub fn best_prevote(&self) -> Option<Candidate>
pub fn best_prevote(&self) -> Option<Candidate>
prevote が閾値に届いた、いちばん高いブロック
Sourcepub fn best_precommit(&self) -> Option<Candidate>
pub fn best_precommit(&self) -> Option<Candidate>
prevote と precommit の両方が閾値に届いた、いちばん高いブロック
Sourcepub fn estimate(&self) -> Option<Candidate>
pub fn estimate(&self) -> Option<Candidate>
best prevote とその祖先のうち、precommit がまだ閾値に届きうる、いちばん高いブロック
Sourcepub fn is_descendant(&self, parent: Candidate, child: Candidate) -> bool
pub fn is_descendant(&self, parent: Candidate, child: Candidate) -> bool
child が parent 自身か、その子孫か。どちらかに prevote がなければ偽
Sourcepub fn is_completable(&self) -> bool
pub fn is_completable(&self) -> bool
ラウンドの結果がもう変わらないか。catapult の isCompletable
Sourcepub fn accept_prevote(&mut self, height: u64, hashes: &[Hash256], weight: u64)
pub fn accept_prevote(&mut self, height: u64, hashes: &[Hash256], weight: u64)
高さ height から続くブロック hashes への prevote を、重み weight で数える
Sourcepub fn accept_precommit(&mut self, height: u64, hash: Hash256, weight: u64)
pub fn accept_precommit(&mut self, height: u64, hash: Hash256, weight: u64)
ブロック(height、hash)への precommit を、重み weight で数える。prevote がまだなければ取っておく
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RoundContext
impl RefUnwindSafe for RoundContext
impl Send for RoundContext
impl Sync for RoundContext
impl Unpin for RoundContext
impl UnsafeUnpin for RoundContext
impl UnwindSafe for RoundContext
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