Expand description
Β§Bitcoin Syncer
This module provides common utilities to fetch Bitcoin state. Other modules
can use this module to operate over Bitcoin. Every block starting from
paramset.start_height
is fetched and stored in the database.
StructsΒ§
- A task that syncs Bitcoin blocks from the Bitcoin node to the local database.
- Block
Info πRepresents basic information of a Bitcoin block.
EnumsΒ§
- Events emitted by the Bitcoin syncer. It emits the block_id of the block in the db that was saved.
ConstantsΒ§
TraitsΒ§
- Trait for handling new blocks as they are finalized
FunctionsΒ§
- Fetches the
BlockInfo
for a given height from Bitcoin. - fetch_
new_ πblocks Fetches the next block from Bitcoin, if it exists. Will also fetch previous blocks if the parent is missing, up to 100 blocks. - handle_
reorg_ πevents Marks blocks above the common ancestor as non-canonical and emits reorg events. - process_
new_ πblocks Processes and inserts new blocks into the database, emitting a new block event for each. - save_
block πSaves a Bitcoin blockβs metadata and itβs transactions into the database. - Saves a Bitcoin transaction and its spent UTXOs to the database.
- If no block info exists in the DB, fetches the current block from the RPC and initializes the DB.