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

Method ancestorByCount

sqlchain/blockindex.go:83–96  ·  view source on GitHub ↗
(count int32)

Source from the content-addressed store, hash-verified

81}
82
83func (n *blockNode) ancestorByCount(count int32) (ancestor *blockNode) {
84 if count < 0 || count > n.count {
85 return nil
86 }
87
88 for ancestor = n; ancestor != nil && ancestor.count > count; ancestor = ancestor.parent {
89 }
90
91 if ancestor != nil && ancestor.count < count {
92 ancestor = nil
93 }
94
95 return
96}
97
98func (n *blockNode) indexKey() (key []byte) {
99 key = make([]byte, hash.HashSize+4)

Callers 1

FetchBlockByCountMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected