Skip to content

Commit 3dfc208

Browse files
authored
Merge pull request #1992 from CortexFoundation/dev
current header type
2 parents 750bb79 + 9857a79 commit 3dfc208

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/headerchain.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ type HeaderChain struct {
5454
chainDb ctxcdb.Database
5555
genesisHeader *types.Header
5656

57-
currentHeader atomic.Value // Current head of the header chain (may be above the block chain!)
58-
currentHeaderHash common.Hash // Hash of the current head of the header chain (prevent recomputing all the time)
57+
currentHeader atomic.Pointer[types.Header] // Current head of the header chain (maybe above the block chain!)
58+
currentHeaderHash common.Hash // Hash of the current head of the header chain (prevent recomputing all the time)
5959

6060
headerCache *lru.Cache[common.Hash, *types.Header]
6161
tdCache *lru.Cache[common.Hash, *big.Int] // most recent total difficulties
@@ -560,7 +560,7 @@ func (hc *HeaderChain) GetCanonicalHash(number uint64) common.Hash {
560560
// CurrentHeader retrieves the current head header of the canonical chain. The
561561
// header is retrieved from the HeaderChain's internal cache.
562562
func (hc *HeaderChain) CurrentHeader() *types.Header {
563-
return hc.currentHeader.Load().(*types.Header)
563+
return hc.currentHeader.Load()
564564
}
565565

566566
// SetCurrentHeader sets the current head header of the canonical chain.

0 commit comments

Comments
 (0)