Page MenuHomePhabricator

[Chronik] Move ffi::Block into chronik-bridge, use CBlockIndex and CBlock
ClosedPublic

Authored by tobias_ruck on Mar 10 2023, 21:14.

Details

Summary
  1. Move ffi::Block from chronik-lib to chronik-bridge. This allows us to use this type in other crates, e.g. chronik-indexer.
  2. Add ffi definitions for CBlockIndex and CBlock so we can use them in Rust.
  3. Expose BridgeBlock through ffi so we can use it in Rust, renamed to bridge_block.
  4. Change handle_block_connected and handle_block_disconnected to take &CBlock and &CBlockIndex.
Test Plan

ninja check-crates && ninja && ./test/functional/test_runner chronik_block

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Also add CBlock, which we will need once we process txs

tobias_ruck retitled this revision from [Chronik] Refactor, move ffi::Block into chronik-bridge, add CBlockIndex to [Chronik] Move ffi::Block into chronik-bridge, add & use CBlockIndex and CBlock.Mar 11 2023, 07:16
tobias_ruck edited the summary of this revision. (Show Details)
tobias_ruck edited the test plan for this revision. (Show Details)
tobias_ruck retitled this revision from [Chronik] Move ffi::Block into chronik-bridge, add & use CBlockIndex and CBlock to [Chronik] Move ffi::Block into chronik-bridge, use CBlockIndex and CBlock.

Move bridge_block below get_chain_tip

[Chronik] Add ChronikBridge::lookup_block_index

This allows us to get a CBlockIndex from a hash.

@bot build-linux64 build-linux-aarch64 build-linux-arm build-osx build-win64

This revision is now accepted and ready to land.Mar 13 2023, 08:22

use ffi namespace for CBlock and CBlockIndex where possible

@bot build-linux64 build-linux-aarch64 build-linux-arm build-osx build-win64