Skip to content

chore(dash-spv-ffi): drop unused ffi#449

Open
ZocoLini wants to merge 1 commit intov0.42-devfrom
chore/drop-unused-ffi
Open

chore(dash-spv-ffi): drop unused ffi#449
ZocoLini wants to merge 1 commit intov0.42-devfrom
chore/drop-unused-ffi

Conversation

@ZocoLini
Copy link
Collaborator

@ZocoLini ZocoLini commented Feb 17, 2026

Summary by CodeRabbit

  • Breaking Changes

    • Removed checkpoint query operations from the public API
    • Removed client stop and tip retrieval functions
    • Public API surface reduced from 54 to 48 functions
  • Refactor

    • Client cleanup mechanism updated to use cancel_sync instead of stop

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

📝 Walkthrough

Walkthrough

This change removes six public FFI functions from the Dash SPV library (three checkpoint-related and three client-related), eliminates the checkpoints module from the public API, and systematically replaces dash_spv_ffi_client_stop with dash_spv_ffi_client_cancel_sync across test and CLI code.

Changes

Cohort / File(s) Summary
API Surface & Documentation
FFI_API.md, include/dash_spv_ffi.h
Removed declarations and documentation for checkpoint functions (latest, before_height, before_timestamp) and client functions (stop, get_tip_hash, get_tip_height).
Checkpoint Module Removal
src/checkpoints.rs
Deleted entire module containing FFI checkpoint struct and three checkpoint query functions with error handling and pointer validation logic.
Client Function Removal
src/client.rs
Removed three public FFI functions (stop, get_tip_hash, get_tip_height) and removed Hash import.
Module Reexports
src/lib.rs
Removed public module declaration and reexport of checkpoints module from public API surface.
API Migration
src/bin/ffi_cli.rs, tests/test_client.rs, tests/unit/test_async_operations.rs, tests/unit/test_client_lifecycle.rs
Updated all usages of dash_spv_ffi_client_stop to dash_spv_ffi_client_cancel_sync in cleanup and test teardown paths.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hop, skip, and sip as the APIs fade,
Checkpoint queries banished to the shade,
Stop becomes cancel in tests anew,
A cleaner FFI surface shines through!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore(dash-spv-ffi): drop unused ffi' accurately describes the main change: removal of unused FFI functions (checkpoint functions, client stop, tip retrieval) from the dash-spv-ffi module.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/drop-unused-ffi

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
dash-spv-ffi/FFI_API.md (1)

767-767: ⚠️ Potential issue | 🟡 Minor

Stale reference to removed stop() API in documentation.

The workflow description for dash_spv_ffi_client_run still says "Call stop() when done" in step 4, but dash_spv_ffi_client_stop has been removed. This should reference cancel_sync().

📝 Suggested fix
-Start the SPV client and begin syncing in the background.  This is the streamlined entry point that combines `start()` and continuous monitoring into a single non-blocking call. Use event callbacks (set via `set_sync_event_callbacks`, `set_network_event_callbacks`, `set_wallet_event_callbacks`) to receive notifications about sync progress, peer connections, and wallet activity.  Workflow: 1. Configure event callbacks before calling `run()` 2. Call `run()` - it returns immediately after spawning background sync threads 3. Receive notifications via callbacks as sync progresses 4. Call `stop()` when done  # Safety - `client` must be a valid, non-null pointer to a created client.  # Returns 0 on success, error code on failure.
+Start the SPV client and begin syncing in the background.  This is the streamlined entry point that combines `start()` and continuous monitoring into a single non-blocking call. Use event callbacks (set via `set_sync_event_callbacks`, `set_network_event_callbacks`, `set_wallet_event_callbacks`) to receive notifications about sync progress, peer connections, and wallet activity.  Workflow: 1. Configure event callbacks before calling `run()` 2. Call `run()` - it returns immediately after spawning background sync threads 3. Receive notifications via callbacks as sync progresses 4. Call `cancel_sync()` when done  # Safety - `client` must be a valid, non-null pointer to a created client.  # Returns 0 on success, error code on failure.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@dash-spv-ffi/FFI_API.md` at line 767, Update the documentation for
dash_spv_ffi_client_run to replace the stale reference to the removed stop()
API: change step 4 of the workflow from "Call `stop()` when done" to "Call
`cancel_sync()` when done" and ensure surrounding text references the correct
API names (e.g., `set_sync_event_callbacks`, `set_network_event_callbacks`,
`set_wallet_event_callbacks`, `cancel_sync`) so readers know to call
cancel_sync() to stop background syncing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@dash-spv-ffi/FFI_API.md`:
- Line 767: Update the documentation for dash_spv_ffi_client_run to replace the
stale reference to the removed stop() API: change step 4 of the workflow from
"Call `stop()` when done" to "Call `cancel_sync()` when done" and ensure
surrounding text references the correct API names (e.g.,
`set_sync_event_callbacks`, `set_network_event_callbacks`,
`set_wallet_event_callbacks`, `cancel_sync`) so readers know to call
cancel_sync() to stop background syncing.

xdustinface
xdustinface previously approved these changes Feb 17, 2026
@xdustinface xdustinface dismissed their stale review February 17, 2026 22:16

Actually, i think this might be a reasonable thing to adjust

Stale reference to removed stop() API in documentation.

The workflow description for dash_spv_ffi_client_run still says "Call stop() when done" in step 4, but dash_spv_ffi_client_stop has been removed. This should reference cancel_sync().
@xdustinface xdustinface reopened this Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants