diff --git a/dash-spv-ffi/FFI_API.md b/dash-spv-ffi/FFI_API.md index d87b92a76..59a7fd3ea 100644 --- a/dash-spv-ffi/FFI_API.md +++ b/dash-spv-ffi/FFI_API.md @@ -4,7 +4,7 @@ This document provides a comprehensive reference for all FFI (Foreign Function I **Auto-generated**: This documentation is automatically generated from the source code. Do not edit manually. -**Total Functions**: 67 +**Total Functions**: 66 ## Table of Contents @@ -34,11 +34,10 @@ Functions: 4 ### Configuration -Functions: 25 +Functions: 24 | Function | Description | Module | |----------|-------------|--------| -| `dash_spv_ffi_client_update_config` | Update the running client's configuration | client | | `dash_spv_ffi_config_add_peer` | Adds a peer address to the configuration Accepts socket addresses with or... | config | | `dash_spv_ffi_config_destroy` | Destroys an FFIClientConfig and frees its memory # Safety - `config` must... | config | | `dash_spv_ffi_config_get_data_dir` | Gets the data directory path from the configuration # Safety - `config`... | config | @@ -228,22 +227,6 @@ Stop the SPV client. # Safety - `client` must be a valid, non-null pointer to a ### Configuration - Detailed -#### `dash_spv_ffi_client_update_config` - -```c -dash_spv_ffi_client_update_config(client: *mut FFIDashSpvClient, config: *const FFIClientConfig,) -> i32 -``` - -**Description:** -Update the running client's configuration. # Safety - `client` must be a valid pointer to an `FFIDashSpvClient`. - `config` must be a valid pointer to an `FFIClientConfig`. - The network in `config` must match the client's network; changing networks at runtime is not supported. - -**Safety:** -- `client` must be a valid pointer to an `FFIDashSpvClient`. - `config` must be a valid pointer to an `FFIClientConfig`. - The network in `config` must match the client's network; changing networks at runtime is not supported. - -**Module:** `client` - ---- - #### `dash_spv_ffi_config_add_peer` ```c diff --git a/dash-spv-ffi/include/dash_spv_ffi.h b/dash-spv-ffi/include/dash_spv_ffi.h index 4fcf2e12d..af53fc92e 100644 --- a/dash-spv-ffi/include/dash_spv_ffi.h +++ b/dash-spv-ffi/include/dash_spv_ffi.h @@ -293,19 +293,6 @@ struct FFIArray dash_spv_ffi_checkpoints_between_heights(FFINetwork network, */ int32_t dash_spv_ffi_client_drain_events(struct FFIDashSpvClient *client) ; -/** - * Update the running client's configuration. - * - * # Safety - * - `client` must be a valid pointer to an `FFIDashSpvClient`. - * - `config` must be a valid pointer to an `FFIClientConfig`. - * - The network in `config` must match the client's network; changing networks at runtime is not supported. - */ - -int32_t dash_spv_ffi_client_update_config(struct FFIDashSpvClient *client, - const struct FFIClientConfig *config) -; - /** * Start the SPV client. * diff --git a/dash-spv-ffi/src/client.rs b/dash-spv-ffi/src/client.rs index 8848d188b..cf76e7cb8 100644 --- a/dash-spv-ffi/src/client.rs +++ b/dash-spv-ffi/src/client.rs @@ -417,52 +417,6 @@ fn stop_client_internal(client: &mut FFIDashSpvClient) -> Result<(), dash_spv::S result } -/// Update the running client's configuration. -/// -/// # Safety -/// - `client` must be a valid pointer to an `FFIDashSpvClient`. -/// - `config` must be a valid pointer to an `FFIClientConfig`. -/// - The network in `config` must match the client's network; changing networks at runtime is not supported. -#[no_mangle] -pub unsafe extern "C" fn dash_spv_ffi_client_update_config( - client: *mut FFIDashSpvClient, - config: *const FFIClientConfig, -) -> i32 { - null_check!(client); - null_check!(config); - - let client = &(*client); - let new_config = (&*config).clone_inner(); - - let result = client.runtime.block_on(async { - // Take client without holding the lock across await - let mut spv_client = { - let mut guard = client.inner.lock().unwrap(); - match guard.take() { - Some(client) => client, - None => { - return Err(dash_spv::SpvError::Config("Client not initialized".to_string())) - } - } - }; - - let res = spv_client.update_config(new_config).await; - - // Put client back - let mut guard = client.inner.lock().unwrap(); - *guard = Some(spv_client); - res - }); - - match result { - Ok(()) => FFIErrorCode::Success as i32, - Err(e) => { - set_last_error(&e.to_string()); - FFIErrorCode::from(e) as i32 - } - } -} - /// Start the SPV client. /// /// # Safety diff --git a/dash-spv/src/client/core.rs b/dash-spv/src/client/core.rs index b41a7aeae..3f3795c45 100644 --- a/dash-spv/src/client/core.rs +++ b/dash-spv/src/client/core.rs @@ -264,24 +264,6 @@ impl DashSpvClient Result<()> { - // Validate new configuration - new_config.validate().map_err(SpvError::Config)?; - - // Ensure network hasn't changed - if new_config.network != self.config.network { - return Err(SpvError::Config("Cannot change network on running client".to_string())); - } - - // Update configuration - self.config = new_config; - - Ok(()) - } - // ============ Terminal UI ============ /// Enable terminal UI for status display.