Conflux-Chain / conflux-rust

The official Rust implementation of Conflux protocol. https://doc.confluxnetwork.org
https://doc.confluxnetwork.org
GNU General Public License v3.0
645 stars 196 forks source link

Skipping Catch-up Mode to Access TXPool for Current Block in Full node #2669

Open waelsy123 opened 1 year ago

waelsy123 commented 1 year ago

Issue Description: I am currently setting up a Conflux full node and would like to access the transaction pool (TXPool) for the current last block immediately upon starting the node. However, the catch-up mode is automatically initiated, making it difficult to access the TXPool directly for the current block.

I understand that catch-up mode is essential for syncing the node with the blockchain, but for my some cases, we only need the TXPool information for the most recent block. Therefore, I would like to know if there is a way to skip or bypass the catch-up mode and gain direct access to the TXPool for the current block.

Additional Context: Conflux-rust version: v2.2.3

Expected Behavior: I expect the full node to allow me to access the TXPool for the current block (last) without having to wait for the catch-up mode to complete.

Actual Behavior: The node initiates catch-up mode and syncs with the entire blockchain, causing delays in accessing the TXPool for the current block.

Steps to Reproduce: Start the Conflux full node Observe that the catch-up mode begins Attempt to access the TXPool for the last block

Proposed Solution: If there is a way to skip or bypass the catch-up mode, please provide detailed instructions on how to achieve this. Alternatively, if a configuration option or command-line flag could be added to enable this functionality, it would be greatly appreciated. This would allow users like me to access the TXPool for the most recent block without waiting for the node to sync completely.

peilun-conflux commented 1 year ago

This cannot be achieved in the current version, and implementing it is also a bit tricky.

The main issue is that maintaining the transaction pool requires knowledge of the latest state (like account nonce and balance). If we simply start the transaction pool with an empty state before catching up, it is likely that all received transactions will be dropped directly.