Skip to content

Commit 363b8d2

Browse files
committed
core/rawdb: remove method
1 parent 4ef5a1c commit 363b8d2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

core/rawdb/accessors_chain.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -836,10 +836,6 @@ type badBlock struct {
836836
Body *types.Body
837837
}
838838

839-
func (b *badBlock) Less(other *badBlock) bool {
840-
return b.Header.Number.Uint64() < other.Header.Number.Uint64()
841-
}
842-
843839
// ReadBadBlock retrieves the bad block with the corresponding block hash.
844840
func ReadBadBlock(db ethdb.Reader, hash common.Hash) *types.Block {
845841
blob, err := db.Get(badBlockKey)
@@ -900,7 +896,8 @@ func WriteBadBlock(db ethdb.KeyValueStore, block *types.Block) {
900896
Body: block.Body(),
901897
})
902898
slices.SortFunc(badBlocks, func(a, b *badBlock) bool {
903-
return !a.Less(b) // Sort reverse order
899+
// Note: sorting in ascending order.
900+
return a.Header.Number.Uint64() >= b.Header.Number.Uint64()
904901
})
905902
if len(badBlocks) > badBlockToKeep {
906903
badBlocks = badBlocks[:badBlockToKeep]

0 commit comments

Comments
 (0)