Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tree ¶
type Tree interface { // Add places the block in the tree Add(snowman.Block) // Get returns the block that was added to this tree whose parent and ID // match the provided block. If non-exists, then false will be returned. Get(snowman.Block) (snowman.Block, bool) // Accept marks the provided block as accepted and rejects every conflicting // block. Accept(context.Context, snowman.Block) error }
Tree handles the propagation of block acceptance and rejection to inner blocks.
The Tree is needed because: 1. The consensus engine guarantees that for each verified block, either Accept() or Reject() are eventually called, and they are called only once. The proposervm must maintain these invariants for the wrapped VM. 2. A given inner block may be wrapped into multiple different proposervm blocks (e.g. same inner block generated by two validators).
The Tree prevents Accept() and Reject() from being called multiple times on the same inner block by: 1. tracking inner blocks in a tree-like structure, to be able to easily spot siblings 2. rejecting an inner block only when one of the siblings is accepted. Rejection of a proposervm block does not imply its inner block rejection (it may be held by a different proposervm block).