MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / queryTimeIsExpired

Method queryTimeIsExpired

sqlchain/runtime.go:155–170  ·  view source on GitHub ↗
(t time.Time)

Source from the content-addressed store, hash-verified

153}
154
155func (r *runtime) queryTimeIsExpired(t time.Time) bool {
156 // Checking query expiration for the pending block, whose height is c.rt.NextHeight:
157 //
158 // TimeLived = r.NextTurn - r.GetHeightFromTime(t)
159 //
160 // Return true if: QueryTTL < TimeLived.
161 //
162 // NOTE(leventeliu): as a result, a TTL=1 requires any query to be acknowledged and received
163 // immediately.
164 // Consider the case that a query has happened right before period h, which has height h.
165 // If its ACK+Roundtrip time>0, it will be seemed as acknowledged in period h+1, or even later.
166 // So, period h+1 has NextHeight h+2, and TimeLived of this query will be 2 at that time - it
167 // has expired.
168 //
169 return r.getHeightFromTime(t) < r.getMinValidHeight()
170}
171
172// updateTime updates the current coodinated chain time.
173func (r *runtime) updateTime(now time.Time) {

Callers 1

Calls 2

getHeightFromTimeMethod · 0.95
getMinValidHeightMethod · 0.95

Tested by

no test coverage detected