Drop header references from persistent links (#1991)

Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
This commit is contained in:
ledgerwatch 2021-05-22 12:03:53 +01:00 committed by GitHub
parent 5655409616
commit 6a19321d82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -596,6 +596,7 @@ func (hd *HeaderDownload) InsertHeaders(hf func(header *types.Header, blockHeigh
hd.highestInDb = link.blockHeight
}
link.persisted = true
link.header = nil // Drop header reference to free memory, as we won't need it anymore
heap.Push(hd.persistedLinkQueue, link)
if len(link.next) > 0 {
hd.insertList = append(hd.insertList, link.next...)