(h uint32)
| 83 | } |
| 84 | |
| 85 | func (n *blockNode) ancestor(h uint32) *blockNode { |
| 86 | if h > n.height { |
| 87 | return nil |
| 88 | } |
| 89 | |
| 90 | ancestor := n |
| 91 | for ancestor != nil && ancestor.height > h { |
| 92 | ancestor = ancestor.parent |
| 93 | } |
| 94 | if ancestor != nil && ancestor.height != h { |
| 95 | ancestor = nil |
| 96 | } |
| 97 | |
| 98 | return ancestor |
| 99 | } |
| 100 | |
| 101 | func (n *blockNode) ancestorByCount(c uint32) *blockNode { |
| 102 | if c > n.count { |
no outgoing calls