-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix externalcl integration for erigon3 #12906
Conversation
@@ -37,7 +37,7 @@ func NewTemporaryMdbx(ctx context.Context, tempdir string) (kv.RwDB, error) { | |||
return &TemporaryMdbx{}, err | |||
} | |||
|
|||
db, err := New(kv.ChainDB, log.Root()).InMem(path).Open(ctx) | |||
db, err := New(kv.ChainDB, log.Root()).InMem(path).GrowthStep(64 * datasize.MB).Open(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes we get MDBX_MAP_FULL
error if there are lots of blocks to hold temporarily, this is to fix it
@@ -58,37 +56,7 @@ func (bd *BodyDownload) UpdateFromDb(db kv.Tx) (headHeight, headTime uint64, hea | |||
clear(bd.requests) | |||
clear(bd.peerMap) | |||
bd.ClearBodyCache() | |||
headHeight = bodyProgress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following code was removed since it computes values that are never used. Also this code was actually producing error messages canonical marker not found
specified in the issue
@@ -79,9 +80,17 @@ func (e *EngineBlockDownloader) download(ctx context.Context, hashToDownload lib | |||
memoryMutation := membatchwithdb.NewMemoryBatchWithCustomDB(tx, tmpDb, tmpTx) | |||
defer memoryMutation.Rollback() | |||
|
|||
if block != nil { | |||
err = rawdb.WriteCanonicalHash(memoryMutation, block.Hash(), block.NumberU64()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
downloading of headers backwards starts with the parent of the block
, so the block
itself did not get its canonical hash written down. This addition fixes it
@@ -235,7 +234,7 @@ func saveHeader(db kv.RwTx, header *types.Header, hash libcommon.Hash) error { | |||
return fmt.Errorf("[saveHeader] failed to WriteTd: %w", err) | |||
} | |||
if err = rawdb.WriteCanonicalHash(db, hash, blockHeight); err != nil { | |||
return fmt.Errorf("[saveHeader] failed to canonical hash: %w", err) | |||
return fmt.Errorf("[saveHeader] failed to save canonical hash: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo fix
startBlock, endBlock, startHash, err := e.loadDownloadedHeaders(memoryMutation) | ||
if err != nil { | ||
e.logger.Warn("[EngineBlockDownloader] Could load headers", "err", err) | ||
e.logger.Warn("[EngineBlockDownloader] Could not load headers", "err", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo fix
Fixes #12225