Skip to content

Block manager remembers more blocks and uses less memory

Christopher Schinnerl requested to merge blockmanager into master

Created by: JoshVorick

In order to reduce the miner's memory usage, the map of headers to blocks is now a map of header to block references and a map of headers to random transactions.

This way, the miner can create multiple headers for work for each block it stores in memory. Because blocks are can be over a megabyte, this greatly reduces the amount of memory used by the miner.

Every headersPerBlockMemory calls to getHeaderForWork(), a new block is generated. Then for the next headersPerBlockMemory blocks, the same block is used, but with a different random transaction. This gives the block a unique header for mining. In total, the miner now stores headerForWorkMemory / headersPerBlockMemory blocks.

Merge request reports