Protocol
BlockSource
A source of Bitcoin blockchain data for driving a ChainstateManager.
protocol BlockSource : Sendable
Mentioned In
Overview
Hash-addressed per LDK’s lightning-block-sync convention and Bitcoin Core’s own internal interfaces::Chain API: every block lookup uses the block’s 32-byte hash, not its height. Height lookup (blockHash(atHeight:)) is reserved for the one place the sync engine genuinely needs it — computing the fork point when resuming a partially synced chainstate — because height is a reorg hazard everywhere else.
Conformers deliver blocks via whatever transport they like: HTTP (EsploraBlockSource), a bundled test fixture (in-memory mocks), or — in a future phase — a direct Bitcoin P2P peer over swift-event. The BlockchainSync engine treats all conformers identically.
Hash orientation
All Data hashes crossing this protocol are in internal (kernel) byte order — matching hash and hash throughout BitcoinKernel. Implementations speaking to external services that use display-order hex (Esplora, most block explorer APIs) are responsible for reversing bytes at the HTTP boundary.
Threading
Conformers are Sendable so they can be shared across tasks and actors. Individual methods are async and may suspend on network I/O; conformers should not hold locks across suspension points.
Topics
Instance Methods
Relationships
Conforming Types