Repository navigation
Conversation
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
LoadRecords reuses its key and value streams between cursor calls. Record loaders may leave optional suffix fields unread, which BerkeleyROCursor currently appends to the next record. This can cause valid legacy wallets to fail migration with a deserialization error. Clear both streams before writing the next record, matching SQLiteCursor. Document the cursor's replacement contract, add a BerkeleyRO regression that leaves part of both streams unread, and reuse unread streams in the SQLite prefix tests to cover the same contract.
jaromil
force-pushed
the
fix/bdb-cursor-stream-reset
branch
from
November 14, 2026 17:06
2b6ae9b to
00bb61e
Compare
Contributor
|
🐙 This pull request conflicts with the target branch and needs rebase. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This fixes a case where migratewallet can reject an old wallet as corrupt, i.e. this occurs on wallets used in Bitcoin Knots. The v2 key metadata may include an extra flag byte that Core’s metadata loader leaves unread.
LoadRecords reuses its key and value streams between records. BerkeleyROCursor::Next() appends to those streams, so unread bytes from one record become part of the next and can cause a deserialization error.
Clear both streams before copying the next record, matching SQLiteCursor::Next(). This keeps the existing metadata parsing and migration code.
The regression test reads two records while leaving part of the first key and value unread, then checks that the second record replaces both outputs.
Testing on Linux: