mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
636586c1b5
draft for now to get some early feedback on approach
23 lines
435 B
Go
23 lines
435 B
Go
package rawdb
|
|
|
|
import (
|
|
"encoding/binary"
|
|
|
|
"github.com/ledgerwatch/erigon-lib/kv"
|
|
)
|
|
|
|
func GetStateVersion(tx kv.Tx) (uint64, error) {
|
|
val, err := tx.GetOne(kv.Sequence, kv.PlainStateVersion)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
if len(val) == 0 {
|
|
return 0, nil
|
|
}
|
|
return binary.BigEndian.Uint64(val), nil
|
|
}
|
|
|
|
func IncrementStateVersion(tx kv.RwTx) (uint64, error) {
|
|
return tx.IncrementSequence(string(kv.PlainStateVersion), 1)
|
|
}
|