mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-20 09:21:11 +00:00
21 lines
387 B
Go
21 lines
387 B
Go
package bor
|
|
|
|
const (
|
|
spanLength = 6400 // Number of blocks in a span
|
|
zerothSpanEnd = 255 // End block of 0th span
|
|
)
|
|
|
|
func SpanIDAt(number uint64) uint64 {
|
|
if number > zerothSpanEnd {
|
|
return 1 + (number-zerothSpanEnd-1)/spanLength
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func SpanEndBlockNum(spanID uint64) uint64 {
|
|
if spanID > 0 {
|
|
return spanID*spanLength + zerothSpanEnd
|
|
}
|
|
return zerothSpanEnd
|
|
}
|