mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
core/rawdb: use help functions on ancients
This commit is contained in:
parent
102bd99560
commit
809f2e140f
1 changed files with 3 additions and 3 deletions
|
|
@ -193,7 +193,7 @@ func (f *chainFreezer) freeze(db ethdb.KeyValueStore) {
|
||||||
log.Debug("Current full block not old enough to freeze", "err", err)
|
log.Debug("Current full block not old enough to freeze", "err", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
frozen, _ := f.ancients.Ancients() // no error will occur, safe to ignore
|
frozen, _ := f.Ancients() // no error will occur, safe to ignore
|
||||||
|
|
||||||
// Short circuit if the blocks below threshold are already frozen.
|
// Short circuit if the blocks below threshold are already frozen.
|
||||||
if frozen != 0 && frozen-1 >= threshold {
|
if frozen != 0 && frozen-1 >= threshold {
|
||||||
|
|
@ -236,7 +236,7 @@ func (f *chainFreezer) freeze(db ethdb.KeyValueStore) {
|
||||||
|
|
||||||
// Wipe out side chains also and track dangling side chains
|
// Wipe out side chains also and track dangling side chains
|
||||||
var dangling []common.Hash
|
var dangling []common.Hash
|
||||||
frozen, _ = f.ancients.Ancients() // Needs reload after during freezeRange
|
frozen, _ = f.Ancients() // Needs reload after during freezeRange
|
||||||
for number := first; number < frozen; number++ {
|
for number := first; number < frozen; number++ {
|
||||||
// Always keep the genesis block in active database
|
// Always keep the genesis block in active database
|
||||||
if number != 0 {
|
if number != 0 {
|
||||||
|
|
@ -308,7 +308,7 @@ func (f *chainFreezer) freeze(db ethdb.KeyValueStore) {
|
||||||
func (f *chainFreezer) freezeRange(nfdb *nofreezedb, number, limit uint64) (hashes []common.Hash, err error) {
|
func (f *chainFreezer) freezeRange(nfdb *nofreezedb, number, limit uint64) (hashes []common.Hash, err error) {
|
||||||
hashes = make([]common.Hash, 0, limit-number+1)
|
hashes = make([]common.Hash, 0, limit-number+1)
|
||||||
|
|
||||||
_, err = f.ancients.ModifyAncients(func(op ethdb.AncientWriteOp) error {
|
_, err = f.ModifyAncients(func(op ethdb.AncientWriteOp) error {
|
||||||
for ; number <= limit; number++ {
|
for ; number <= limit; number++ {
|
||||||
// Retrieve all the components of the canonical block.
|
// Retrieve all the components of the canonical block.
|
||||||
hash := ReadCanonicalHash(nfdb, number)
|
hash := ReadCanonicalHash(nfdb, number)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue