From e8770d03c3023d536f0d44d5d871b4f85ffea449 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Tue, 31 Mar 2026 16:39:02 +0300 Subject: [PATCH 1/2] feat(dash-spv-ffi): expose MasternodeListEngine accessor on FFIDashSpvClient Adds two public methods to FFIDashSpvClient: - masternode_list_engine() -> Option>> - network() -> Network This allows Rust crates in the same binary (e.g., rs-sdk-ffi) to access the masternode list engine directly without going through C-style FFI functions, enabling zero-FFI context providers. Closes #607 Co-Authored-By: Claude Opus 4.6 --- dash-spv-ffi/src/client.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dash-spv-ffi/src/client.rs b/dash-spv-ffi/src/client.rs index b588a5bb7..53590d25d 100644 --- a/dash-spv-ffi/src/client.rs +++ b/dash-spv-ffi/src/client.rs @@ -30,6 +30,20 @@ pub struct FFIDashSpvClient { shutdown_token: CancellationToken, } +impl FFIDashSpvClient { + /// Returns the shared masternode list engine, if initialized. + pub fn masternode_list_engine( + &self, + ) -> Option>> { + self.inner.masternode_list_engine().ok() + } + + /// Returns the network this client is configured for. + pub fn network(&self) -> dashcore::Network { + self.runtime.block_on(async { self.inner.network().await }) + } +} + /// Create a new SPV client and return an opaque pointer. /// /// # Safety From 4ad645399e36f27ddc536b5b6a8893283ae0cf54 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Tue, 31 Mar 2026 16:48:41 +0300 Subject: [PATCH 2/2] fix: remove network() method per review feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sync block_on wrapper is unsafe to call from async contexts. The masternode_list_engine accessor is the only thing needed — network can be obtained through other means by the caller. Co-Authored-By: Claude Opus 4.6 --- dash-spv-ffi/src/client.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/dash-spv-ffi/src/client.rs b/dash-spv-ffi/src/client.rs index 53590d25d..4c5545927 100644 --- a/dash-spv-ffi/src/client.rs +++ b/dash-spv-ffi/src/client.rs @@ -37,11 +37,6 @@ impl FFIDashSpvClient { ) -> Option>> { self.inner.masternode_list_engine().ok() } - - /// Returns the network this client is configured for. - pub fn network(&self) -> dashcore::Network { - self.runtime.block_on(async { self.inner.network().await }) - } } /// Create a new SPV client and return an opaque pointer.