Skip to content

Commit 68dff90

Browse files
authored
chore: revert "feat(ffi): add dash_spv_ffi_config_clear_peers (#591)" (#593)
* chore: revert "feat(ffi): add dash_spv_ffi_config_clear_peers (#591)" This reverts commit 472131a. * ffi docs
1 parent be8ddf0 commit 68dff90

3 files changed

Lines changed: 2 additions & 69 deletions

File tree

dash-spv-ffi/FFI_API.md

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This document provides a comprehensive reference for all FFI (Foreign Function I
44

55
**Auto-generated**: This documentation is automatically generated from the source code. Do not edit manually.
66

7-
**Total Functions**: 40
7+
**Total Functions**: 39
88

99
## Table of Contents
1010

@@ -31,13 +31,12 @@ Functions: 3
3131

3232
### Configuration
3333

34-
Functions: 16
34+
Functions: 15
3535

3636
| Function | Description | Module |
3737
|----------|-------------|--------|
3838
| `dash_spv_ffi_client_update_config` | Update the running client's configuration | client |
3939
| `dash_spv_ffi_config_add_peer` | Adds a peer address to the configuration Accepts socket addresses with or... | config |
40-
| `dash_spv_ffi_config_clear_peers` | Removes all configured peers from the configuration This is useful when the... | config |
4140
| `dash_spv_ffi_config_destroy` | Destroys an FFIClientConfig and frees its memory # Safety - `config` must... | config |
4241
| `dash_spv_ffi_config_get_network` | Gets the network type from the configuration # Safety - `config` must be a... | config |
4342
| `dash_spv_ffi_config_mainnet` | No description | config |
@@ -201,22 +200,6 @@ Adds a peer address to the configuration Accepts socket addresses with or witho
201200
202201
---
203202
204-
#### `dash_spv_ffi_config_clear_peers`
205-
206-
```c
207-
dash_spv_ffi_config_clear_peers(config: *mut FFIClientConfig) -> i32
208-
```
209-
210-
**Description:**
211-
Removes all configured peers from the configuration This is useful when the caller wants to start with a clean slate before adding custom peers via `dash_spv_ffi_config_add_peer`. # Safety - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet - The caller must ensure the config pointer remains valid for the duration of this call
212-
213-
**Safety:**
214-
- `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet - The caller must ensure the config pointer remains valid for the duration of this call
215-
216-
**Module:** `config`
217-
218-
---
219-
220203
#### `dash_spv_ffi_config_destroy`
221204
222205
```c

dash-spv-ffi/src/config.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -166,23 +166,6 @@ pub unsafe extern "C" fn dash_spv_ffi_config_add_peer(
166166
}
167167
}
168168

169-
/// Removes all configured peers from the configuration
170-
///
171-
/// This is useful when the caller wants to start with a clean slate
172-
/// before adding custom peers via `dash_spv_ffi_config_add_peer`.
173-
///
174-
/// # Safety
175-
/// - `config` must be a valid pointer to an FFIClientConfig created by dash_spv_ffi_config_new/mainnet/testnet
176-
/// - The caller must ensure the config pointer remains valid for the duration of this call
177-
#[no_mangle]
178-
pub unsafe extern "C" fn dash_spv_ffi_config_clear_peers(config: *mut FFIClientConfig) -> i32 {
179-
null_check!(config);
180-
181-
let cfg = unsafe { &mut *((*config).inner as *mut ClientConfig) };
182-
cfg.peers.clear();
183-
FFIErrorCode::Success as i32
184-
}
185-
186169
/// Sets the user agent string to advertise in the P2P handshake
187170
///
188171
/// # Safety

dash-spv-ffi/tests/test_config.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -94,39 +94,6 @@ mod tests {
9494
}
9595
}
9696

97-
#[test]
98-
#[serial]
99-
fn test_config_clear_peers() {
100-
unsafe {
101-
let config = dash_spv_ffi_config_new(FFINetwork::Testnet);
102-
103-
// Add peers
104-
let peer1 = CString::new("127.0.0.1:9999").unwrap();
105-
let peer2 = CString::new("127.0.0.2:9999").unwrap();
106-
dash_spv_ffi_config_add_peer(config, peer1.as_ptr());
107-
dash_spv_ffi_config_add_peer(config, peer2.as_ptr());
108-
109-
// Clear all peers
110-
let result = dash_spv_ffi_config_clear_peers(config);
111-
assert_eq!(result, FFIErrorCode::Success as i32);
112-
113-
// Clear on already-empty should still succeed
114-
let result = dash_spv_ffi_config_clear_peers(config);
115-
assert_eq!(result, FFIErrorCode::Success as i32);
116-
117-
dash_spv_ffi_config_destroy(config);
118-
}
119-
}
120-
121-
#[test]
122-
#[serial]
123-
fn test_config_clear_peers_null() {
124-
unsafe {
125-
let result = dash_spv_ffi_config_clear_peers(std::ptr::null_mut());
126-
assert_eq!(result, FFIErrorCode::NullPointer as i32);
127-
}
128-
}
129-
13097
#[test]
13198
#[serial]
13299
fn test_config_user_agent() {

0 commit comments

Comments
 (0)