Context: Right now, when the client downloads a block which contains a "previous" block that is not known by the client, it keeps requesting them until he finds a block he knows, or he arrives to the genesis block. All these blocks are stored in a table in-memory, and the UTXO list is reconstructed using this table.
The problem: For very large blockchains, the size of this table will exceed the computer RAM and the program will crash.
Proposed solution: A solution is to store the blocks on disk and access them using the usual methods on storage.lua. We only keep the uuids of the blocks to verify on the in-memory table (Will this solve the memory problem...?). If something goes wrong, then using the storage.deleteBlock(uuid) function we can clear the blocks and discard the UTXO we have calculated until that moment.
Context: Right now, when the client downloads a block which contains a "previous" block that is not known by the client, it keeps requesting them until he finds a block he knows, or he arrives to the genesis block. All these blocks are stored in a table in-memory, and the UTXO list is reconstructed using this table.
The problem: For very large blockchains, the size of this table will exceed the computer RAM and the program will crash.
Proposed solution: A solution is to store the blocks on disk and access them using the usual methods on storage.lua. We only keep the uuids of the blocks to verify on the in-memory table (Will this solve the memory problem...?). If something goes wrong, then using the storage.deleteBlock(uuid) function we can clear the blocks and discard the UTXO we have calculated until that moment.