()
| 8 | } |
| 9 | |
| 10 | func (b BranchNode) ToNodeArray() []NodeData { |
| 11 | if b.Left == nil && b.Right == nil { |
| 12 | return []NodeData{b.Hash} |
| 13 | } |
| 14 | left := b.Left.ToNodeArray() |
| 15 | right := b.Right.ToNodeArray() |
| 16 | if b.ElementOnTheLeft { |
| 17 | return append(left, right...) |
| 18 | } else { |
| 19 | return append(right, left...) |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | // explain the operation |
| 24 | func AcceptLeftSibling(b *BranchNode, h NodeData) *BranchNode { |
no outgoing calls
no test coverage detected