-
Notifications
You must be signed in to change notification settings - Fork 0
PathToLeaf1
ratranqu edited this page Apr 7, 2021
·
2 revisions
PathToLeaf represents an inner path to a leaf node. Note that the nodes are ordered such that the last one is closest to the root of the tree.
public struct PathToLeaf1<Node: NodeProtocol>: Codable
Codable
public typealias Hash = Node.Hasher.Hash
public init(_ array: [ProofInnerNode<Node>] = [])
var isLeftmost: Bool
var isRightmost: Bool
var count: Int
var last: ProofInnerNode<Node>?
var index: Int64
verify
checks that the leaf node's hash + the inner nodes merkle-izes to
the given root. If it returns an error, it means the leafHash or the
PathToLeaf is incorrect.
public func verify(_ leafHash: Hash, _ root: Node) -> Bool
computeRootHash
computes the root hash assuming some leaf hash.
Does not verify the root hash.
public func computeRootHash(_ leafHash: Hash) -> Hash
public func dropLast() -> PathToLeaf1
public mutating func append(_ element: ProofInnerNode<Node>)
public func dropRoot() throws -> PathToLeaf1
public func hasCommonRoot(_ with: Self) -> Bool
public func isLeftAdjacent(_: PathToLeaf1) throws -> Bool
Generated at 2021-04-20T11:34:45+0000 using swift-doc 1.0.0-beta.5.