Summary
Optimize Bitcoin Relayer to fetch only block headers instead of full blocks, reducing bandwidth consumption. This is a sub-issue of #3922.
Background
After #3923 is implemented, the Move layer will only process block headers and ignore transaction data. However, the Relayer still fetches full blocks from Bitcoin nodes, wasting bandwidth.
Tasks
1. Modify L1BlockWithBody structure
File: crates/rooch-types/src/transaction/ledger_transaction.rs
- Make
block_body field optional: Option<Vec<u8>>
- Add
new_bitcoin_header(height, header) constructor
2. Modify Bitcoin Relayer
File: crates/rooch-relayer/src/actor/bitcoin_relayer.rs
- Add config option
header_only_mode: bool (default: true)
- When enabled, use
get_block_header instead of get_block
- Modify
pop_buffer to create L1BlockWithBody with None body
3. Modify Executor
File: crates/rooch-executor/src/actor/executor.rs
- Handle
block_body: None case in validate_l1_block
- Call appropriate Move function based on whether body is present
Configuration
Add to BitcoinRelayerConfig:
pub struct BitcoinRelayerConfig {
// ... existing fields
/// If true, only fetch block headers (default: true after framework upgrade)
pub header_only_mode: bool,
}
Dependencies
Acceptance Criteria
Parent Issue
#3922