pub struct Node {
pub parameters: Parameters,
pub snowball: Snowball,
pub preferences: Cell<[Id; 2]>,
pub bit: Cell<i64>,
pub should_reset: Cell<[bool; 2]>,
pub child0: Option<Box<Node>>,
pub child1: Option<Box<Node>>,
}Expand description
Represents a binary node with either no child, or a single child. It handles the voting on a range of identical, virtuous, snowball instances. ref. “avalanchego/snow/consensus/snowball/tree.go#binaryNode”
Fields§
§parameters: ParametersParameters inherited from the tree.
snowball: SnowballRuns snowball logic.
preferences: Cell<[Id; 2]>The choices preferred at every branch in their sub-tree.
bit: Cell<i64>The index in the Id of the choice that this node is deciding on. Will be in the range [0, 256)
should_reset: Cell<[bool; 2]>Used as an optimization to prevent needless tree traversals. It is the continuation of shouldReset in the Tree struct.
child0: Option<Box<Node>>The child is the potentially none, node that votes on the next bits in the decision.
child1: Option<Box<Node>>Implementations§
Trait Implementations§
Source§impl Display for Node
ref. https://doc.rust-lang.org/std/string/trait.ToString.html
ref. https://doc.rust-lang.org/std/fmt/trait.Display.html
Use “Self.to_string()” to directly invoke this.
impl Display for Node
ref. https://doc.rust-lang.org/std/string/trait.ToString.html ref. https://doc.rust-lang.org/std/fmt/trait.Display.html Use “Self.to_string()” to directly invoke this.