Skip to content

fix: preserve wallet height read errors - #21

Merged
3esmit merged 1 commit into
mainfrom
fix/height-error-sentinel
Aug 1, 2026
Merged

fix: preserve wallet height read errors#21
3esmit merged 1 commit into
mainfrom
fix/height-error-sentinel

Conversation

@3esmit

@3esmit 3esmit commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Fixes #20.

Wallet FFI failures during current-height or last-synced-height reads now return -1 through the existing int64_t API. Non-negative values remain real block heights, so consumers can distinguish an unavailable read from a valid height of zero.

Tests:

  • nix build --no-link .#checks.x86_64-linux.unit-tests

Copilot AI review requested due to automatic review settings August 1, 2026 11:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates the execution-zone core module’s wallet height-read APIs to return a distinguishable negative sentinel on Wallet FFI failures, preventing callers from confusing an error with a valid genesis-height value.

Changes:

  • Return -1 from LEZCoreModule::get_last_synced_block() when the underlying Wallet FFI call fails.
  • Return -1 from LEZCoreModule::get_current_block_height() when the underlying Wallet FFI call fails.
  • Update/add unit tests to cover both error paths using the new sentinel behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/lez_core_module.cpp Changes height-read error paths to return -1 instead of 0 on Wallet FFI failure.
tests/test_lez_core.cpp Updates/extends unit coverage to assert -1 is returned on height-read FFI errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lez_core_module.cpp
Comment on lines 483 to 487
const WalletFfiError error = wallet_ffi_get_last_synced_block(walletHandle, &block_id);
if (error != SUCCESS) {
fprintf(stderr, "get_last_synced_block: wallet FFI error %d\n", error);
return 0;
return -1;
}
@3esmit
3esmit merged commit e50f162 into main Aug 1, 2026
6 checks passed
@3esmit
3esmit deleted the fix/height-error-sentinel branch August 1, 2026 11:44
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.

Return a distinguishable error sentinel for wallet height reads

2 participants