tip: 285
title: Optimize transaction cache initialization logic
author: lucas.wu@tron.network
discussions to: https://github.com/tronprotocol/TIPs/issues/285
status: Final
category: Core
created: 2021-06-21
This TIP is to optimize transaction cache initialization logic to improve the speed of node startup.
The transaction cache is initialized during the node startup process. The initialization logic is like this. The system will load the transactions in the latest 65536 blocks into the cache. This will involve 65536 DB queries. The entire process will take three minutes. This article details the optimization of the transaction cache initialization logic.
The node starts slowly, causing a lot of bad experience for users. In order to solve this problem, it is necessary to speed up the node startup speed.
TODO
When the node starts, the transaction cache data will be loaded, so there is no need to load from the block later, the initialization transaction cache code is as follows.