MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / lastIrreversible

Method lastIrreversible

blockproducer/blocknode.go:116–124  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

114// from head n. Especially, the block at count 0, also known as the genesis block,
115// is irreversible.
116func (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
126func (n *blockNode) hasAncestor(anc *blockNode) bool {
127 var match = n.ancestorByCount(anc.count)

Callers 2

TestBlockNodeFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestBlockNodeFunction · 0.64