Skip to content

Conversation

@random-zebra
Copy link

@random-zebra random-zebra commented Apr 6, 2020

This completes the work started in #1338 and bumps the version to 4.0.99.2.

It gives a dramatic improvement in memory usage.
On mainnet synced up to block 2281117, it takes ~926 Mb in total (a 59% reduction over the 2.261 Gb of v4.0.99.1, and 64% overall reduction over the 2.570 Gb of v4.0.2).

Changes:
mapZerocoinSupply and moneySupply are removed from the block index serialization and replaced with a single cached map/value updated in ConnectBlock/DisconnectBlock and databased independently.

To avoid reindex on upgrade, a utility class CLegacyBlockIndex is introduced, in order to marshall old (removed) block index members directly from disk.

@random-zebra random-zebra added this to the 4.1.0 milestone Apr 6, 2020
@random-zebra random-zebra self-assigned this Apr 6, 2020
@random-zebra random-zebra force-pushed the 202004_chainIndex_round2 branch 4 times, most recently from bb048d2 to 30989eb Compare April 7, 2020 10:21
@random-zebra random-zebra force-pushed the 202004_chainIndex_round2 branch 2 times, most recently from 85f2c0f to adfcd45 Compare April 9, 2020 14:21
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking great 👌 .


Two more things:

What commented about the mapZerocoinSupply applies to the nMoneySupply global object too.

And would be nice to have a reorg functional test verifying that the nMoneySupply and the mapZerocoinSupply gets disconnected/updated properly . We could add it to the mining_pos_reorg.py test.

@random-zebra
Copy link
Author

Updated as per feedback.

@random-zebra random-zebra changed the title [Core] Reduce CBlockIndex RAM consumption [Core] Reduce CBlockIndex RAM usage Apr 9, 2020
@random-zebra random-zebra force-pushed the 202004_chainIndex_round2 branch from 851b66a to d565a73 Compare April 9, 2020 22:58
@random-zebra random-zebra force-pushed the 202004_chainIndex_round2 branch from d565a73 to e4fdba3 Compare April 10, 2020 10:29
@random-zebra random-zebra force-pushed the 202004_chainIndex_round2 branch from e4fdba3 to 2b31bf4 Compare April 10, 2020 10:54
@Fuzzbawls
Copy link
Collaborator

So far, so good
ScreenShot_20200410042245

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 2b31bf4

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 2b31bf4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants