mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-28 22:57:16 +00:00
565a4250d6
* save state * snapshot update works * save state * snapshot migrator * tx test * save state * migrations stages refactor * refactor snapshot migrator * compilation fixed * integrate snapshot migrator * goerli sync headers * debug async snapshotter on goerly * move verify headers, remove experiments, fix remove old snapshot * save state * refactor snapshotsync injection * fix deadlock * replace snapshot generation stage logic to migrate method * change done for body snapshot * clean * clean&&change deleted value * clean * fix hash len * fix hash len * remove one of wrap methods, add remove snapshots on start * add err check * fix shadowing * stages unwind order debug * matryoshka experiments * steam test * fix build * fix test * fix lint * fix test * fix test datarace * add get test * return timeout * fix mdbx overlap * fix after merge * change epoch size * clean todo * fix * return testdata * added return from sndownloader gorutine * fix review comments * Fix * More info Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
32 lines
739 B
Go
32 lines
739 B
Go
package clique
|
|
|
|
import (
|
|
"encoding/binary"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/common"
|
|
)
|
|
|
|
// SnapshotFullKey = SnapshotBucket + num (uint64 big endian) + hash
|
|
func SnapshotFullKey(number uint64, hash common.Hash) []byte {
|
|
return append(EncodeBlockNumber(number), hash.Bytes()...)
|
|
}
|
|
|
|
// SnapshotKey = SnapshotBucket + num (uint64 big endian)
|
|
func SnapshotKey(number uint64) []byte {
|
|
return EncodeBlockNumber(number)
|
|
}
|
|
|
|
// SnapshotKey = SnapshotBucket + '0'
|
|
func LastSnapshotKey() []byte {
|
|
return []byte{0}
|
|
}
|
|
|
|
const NumberLength = 8
|
|
|
|
// EncodeBlockNumber encodes a block number as big endian uint64
|
|
func EncodeBlockNumber(number uint64) []byte {
|
|
enc := make([]byte, NumberLength)
|
|
binary.BigEndian.PutUint64(enc, number)
|
|
return enc
|
|
}
|