-
Notifications
You must be signed in to change notification settings - Fork 388
Improve elements memory usage #1190
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
Merged
psgreco
merged 16 commits into
ElementsProject:master
from
gwillen:fix-elements-memory-usage
Jan 26, 2023
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
68eb086
Refactor CBlockIndex to make proof and dynafed fields optional.
gwillen 7c55557
Add a flag for header-trimming; clear P2P network feature bits when e…
gwillen eff6be3
Trim headers when loading block index from disk.
gwillen 4f0da3c
Trim headers when flushing to disk, and reduce flush interval from 1h…
gwillen f5c7995
When people ask us for headers we do not have (over REST or RPC), do …
gwillen 7e6fe4a
Don't let header syncing get too far ahead of block syncing
gwillen a2db974
Fix false-positive lint
gwillen 763d298
Fix deserialization issues in certain functional tests
gwillen 394e59d
Politely and safely refuse getheaders requests for headers we have tr…
gwillen fba37b7
Move enough-headers check up, rejecting excess headers when received.
gwillen 29345e9
pgreco's startup crash fix
gwillen b9b7f65
Apply suggestions from code review
gwillen 8cad8cd
Further fixes from code review
gwillen e8475e7
Fix stuck IBD when discarding unwanted headers from peers.
gwillen e622156
Update documentation
gwillen 15dbe64
Remove stray comment
gwillen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
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.
This is not guaranteed to be the max height, correct? This is our best guess of the max height, from a random sample of 10k blocks?
Uh oh!
There was an error while loading. Please reload this page.
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.
Could that be placed into the docstring for this method, since it is public?
Uh oh!
There was an error while loading. Please reload this page.
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.
Also, forgive my ignorance about the bitcoin / elements codebase, but is there no way to get the max height here? Certainly that is stored somewhere, since certain RPCs produce it.
Is it just that accessing it here would require some major refactors which are overkill for this PR? Or... do we actually have to load the block index first in order to get the max height?
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.
We have to load the block index first to get the actual max height, yeah, it's a catch-22 here. This is one of the very first stages of startup. And the headers in the index are stored on disk in hash order, not height order, so we have no idea what the max height is until after we've loaded all of them. (But since hash order is random with respect to height, loading a few gives us a really good guess.)
Also note that this really only tells us the max header height, we don't learn what blocks we actually have until even later in the startup process.
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.
Sounds good. That makes sense, thanks,
What do you think about writing that "this is not guaranteed to be the max height, it's just from a random sample" in the method's doctoring?
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.
Added (hopefully I did the docstring right, there aren't a lot of them around.)