lastIrreversible returns the last irreversible block node with the given confirmations from head n. Especially, the block at count 0, also known as the genesis block, is irreversible.
(confirm uint32)
| 114 | // from head n. Especially, the block at count 0, also known as the genesis block, |
| 115 | // is irreversible. |
| 116 | func (n *blockNode) lastIrreversible(confirm uint32) (irr *blockNode) { |
| 117 | var count uint32 |
| 118 | if n.count > confirm { |
| 119 | count = n.count - confirm |
| 120 | } |
| 121 | for irr = n; irr.count > count; irr = irr.parent { |
| 122 | } |
| 123 | return |
| 124 | } |
| 125 | |
| 126 | func (n *blockNode) hasAncestor(anc *blockNode) bool { |
| 127 | var match = n.ancestorByCount(anc.count) |
no outgoing calls