erigon-pulse/core/rawdb/rawdbhelpers/rawdbhelpers.go

21 lines
494 B
Go
Raw Normal View History

2022-12-14 02:50:48 +00:00
package rawdbhelpers
import (
"encoding/binary"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/eth/ethconfig"
)
func IdxStepsCountV3(tx kv.Tx) float64 {
2023-06-11 14:12:05 +00:00
fst, _ := kv.FirstKey(tx, kv.TblTracesToKeys)
lst, _ := kv.LastKey(tx, kv.TblTracesToKeys)
2022-12-14 02:50:48 +00:00
if len(fst) > 0 && len(lst) > 0 {
fstTxNum := binary.BigEndian.Uint64(fst)
lstTxNum := binary.BigEndian.Uint64(lst)
return float64(lstTxNum-fstTxNum) / float64(ethconfig.HistoryV3AggregationStep)
}
return 0
}