-
Notifications
You must be signed in to change notification settings - Fork 8
fix: FFIArray metadata, pointer-based getters; wallet mempool API update #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
821130c
37278b2
2c7517b
290591b
8cb60a0
2e58f57
ad3ba8f
1709656
cce215f
bf0ab36
d9e6ead
e1fea31
fcf86c0
51aa741
749805e
4529dcd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -32,13 +32,13 @@ typedef enum FFIValidationMode { | |||||||||||||||||||||||||||||||||||||||||||||||||
| Full = 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } FFIValidationMode; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| typedef struct FFIClientConfig FFIClientConfig; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * FFIDashSpvClient structure | ||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| typedef struct FFIDashSpvClient FFIDashSpvClient; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| typedef ClientConfig FFIClientConfig; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| typedef struct FFIString { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| char *ptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uintptr_t length; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -100,6 +100,8 @@ typedef struct FFIArray { | |||||||||||||||||||||||||||||||||||||||||||||||||
| void *data; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uintptr_t len; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uintptr_t capacity; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uintptr_t elem_size; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uintptr_t elem_align; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } FFIArray; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| typedef void (*BlockCallback)(uint32_t height, const uint8_t (*hash)[32], void *user_data); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -209,7 +211,7 @@ typedef struct FFIUnconfirmedTransaction { | |||||||||||||||||||||||||||||||||||||||||||||||||
| uintptr_t addresses_len; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } FFIUnconfirmedTransaction; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIDashSpvClient *dash_spv_ffi_client_new(const struct FFIClientConfig *config); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIDashSpvClient *dash_spv_ffi_client_new(const FFIClientConfig *config); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_client_start(struct FFIDashSpvClient *client); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -315,10 +317,10 @@ bool dash_spv_ffi_client_is_filter_sync_available(struct FFIDashSpvClient *clien | |||||||||||||||||||||||||||||||||||||||||||||||||
| FFIBalance *dash_spv_ffi_client_get_address_balance(struct FFIDashSpvClient *client, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const char *address); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIArray dash_spv_ffi_client_get_utxos(struct FFIDashSpvClient *client); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIArray *dash_spv_ffi_client_get_utxos(struct FFIDashSpvClient *client); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIArray dash_spv_ffi_client_get_utxos_for_address(struct FFIDashSpvClient *client, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const char *address); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIArray *dash_spv_ffi_client_get_utxos_for_address(struct FFIDashSpvClient *client, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const char *address); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+320
to
324
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainAPI surface changes to pointer-returning arrays look coherent Signatures align with Rust. Once owned/typed destroyers are added and documented, this is good. Run to ensure Swift header sync is updated after regen: Also applies to: 509-511, 535-537, 746-748 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Public header decls for new owned/typed destroyers:"
rg -n 'dash_spv_ffi_(array_destroy_owned|string_array_destroy_owned|utxo_array_destroy)' dash-spv-ffi/include/dash_spv_ffi.h || true
echo
echo "Swift SDK header sync check:"
# Expect these to exist after sync if SDK mirrors FFI header
rg -n 'dash_spv_ffi_(array_destroy_owned|string_array_destroy_owned|utxo_array_destroy)' swift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h || trueLength of output: 501 Add missing owned/typed destroyers and sync Swift header It looks like the new destroyer functions aren’t present in either the C public header or its Swift mirror. These are critical for FFI memory safety and must be added before merging. Locations needing updates:
Suggested additions to dash-spv-ffi/include/dash_spv_ffi.h: /// Releases ownership of an FFIArray returned from the FFI.
/// Caller must invoke this to avoid leaks.
void dash_spv_ffi_array_destroy_owned(struct FFIArray *array);
/// Releases ownership of a string-array returned from the FFI.
/// Caller must invoke this to avoid leaks.
void dash_spv_ffi_string_array_destroy_owned(struct FFIArray *array);
/// Releases ownership of a UTXO-array returned from the FFI.
/// Caller must invoke this to avoid leaks.
void dash_spv_ffi_utxo_array_destroy(struct FFIArray *array);After adding these to the C header, regenerate and commit the synced header in the Swift SDK at: so it mirrors the updated declarations. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_client_set_event_callbacks(struct FFIDashSpvClient *client, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIEventCallbacks callbacks); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -337,18 +339,18 @@ int32_t dash_spv_ffi_client_watch_script(struct FFIDashSpvClient *client, const | |||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_client_unwatch_script(struct FFIDashSpvClient *client, const char *script_hex); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIArray dash_spv_ffi_client_get_address_history(struct FFIDashSpvClient *client, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const char *address); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIArray *dash_spv_ffi_client_get_address_history(struct FFIDashSpvClient *client, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const char *address); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFITransaction *dash_spv_ffi_client_get_transaction(struct FFIDashSpvClient *client, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const char *txid); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_client_broadcast_transaction(struct FFIDashSpvClient *client, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const char *tx_hex); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIArray dash_spv_ffi_client_get_watched_addresses(struct FFIDashSpvClient *client); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIArray *dash_spv_ffi_client_get_watched_addresses(struct FFIDashSpvClient *client); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIArray dash_spv_ffi_client_get_watched_scripts(struct FFIDashSpvClient *client); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIArray *dash_spv_ffi_client_get_watched_scripts(struct FFIDashSpvClient *client); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+351
to
354
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Clarify element type for watched addresses/scripts and required destructor Document these as arrays of FFIString* and point to dash_spv_ffi_string_array_destroy_owned(). -struct FFIArray *dash_spv_ffi_client_get_watched_addresses(struct FFIDashSpvClient *client);
+/* Returns an FFIArray of FFIString* (addresses). Free with dash_spv_ffi_string_array_destroy_owned(). */
+struct FFIArray *dash_spv_ffi_client_get_watched_addresses(struct FFIDashSpvClient *client);
@@
-struct FFIArray *dash_spv_ffi_client_get_watched_scripts(struct FFIDashSpvClient *client);
+/* Returns an FFIArray of FFIString* (hex scripts). Free with dash_spv_ffi_string_array_destroy_owned(). */
+struct FFIArray *dash_spv_ffi_client_get_watched_scripts(struct FFIDashSpvClient *client);Also applies to: 740-742 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
| FFIBalance *dash_spv_ffi_client_get_total_balance(struct FFIDashSpvClient *client); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -363,8 +365,8 @@ int32_t dash_spv_ffi_client_is_transaction_confirmed(struct FFIDashSpvClient *cl | |||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void dash_spv_ffi_transaction_destroy(struct FFITransaction *tx); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIArray dash_spv_ffi_client_get_address_utxos(struct FFIDashSpvClient *client, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const char *address); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIArray *dash_spv_ffi_client_get_address_utxos(struct FFIDashSpvClient *client, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const char *address); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_client_enable_mempool_tracking(struct FFIDashSpvClient *client, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| enum FFIMempoolStrategy strategy); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -378,57 +380,54 @@ int32_t dash_spv_ffi_client_record_send(struct FFIDashSpvClient *client, const c | |||||||||||||||||||||||||||||||||||||||||||||||||
| FFIBalance *dash_spv_ffi_client_get_mempool_balance(struct FFIDashSpvClient *client, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const char *address); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIClientConfig *dash_spv_ffi_config_new(enum FFINetwork network); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| FFIClientConfig *dash_spv_ffi_config_new(enum FFINetwork network); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIClientConfig *dash_spv_ffi_config_mainnet(void); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| FFIClientConfig *dash_spv_ffi_config_mainnet(void); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIClientConfig *dash_spv_ffi_config_testnet(void); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| FFIClientConfig *dash_spv_ffi_config_testnet(void); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_data_dir(struct FFIClientConfig *config, const char *path); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_data_dir(FFIClientConfig *config, const char *path); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_validation_mode(struct FFIClientConfig *config, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_validation_mode(FFIClientConfig *config, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| enum FFIValidationMode mode); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_max_peers(struct FFIClientConfig *config, uint32_t max_peers); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_max_peers(FFIClientConfig *config, uint32_t max_peers); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_add_peer(struct FFIClientConfig *config, const char *addr); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_add_peer(FFIClientConfig *config, const char *addr); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_user_agent(struct FFIClientConfig *config, const char *user_agent); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_user_agent(FFIClientConfig *config, const char *user_agent); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_relay_transactions(struct FFIClientConfig *config, bool _relay); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_relay_transactions(FFIClientConfig *config, bool _relay); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_filter_load(struct FFIClientConfig *config, bool load_filters); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_filter_load(FFIClientConfig *config, bool load_filters); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| enum FFINetwork dash_spv_ffi_config_get_network(const struct FFIClientConfig *config); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| enum FFINetwork dash_spv_ffi_config_get_network(const FFIClientConfig *config); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIString dash_spv_ffi_config_get_data_dir(const struct FFIClientConfig *config); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIString dash_spv_ffi_config_get_data_dir(const FFIClientConfig *config); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void dash_spv_ffi_config_destroy(struct FFIClientConfig *config); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| void dash_spv_ffi_config_destroy(FFIClientConfig *config); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_mempool_tracking(struct FFIClientConfig *config, bool enable); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_mempool_tracking(FFIClientConfig *config, bool enable); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_mempool_strategy(struct FFIClientConfig *config, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_mempool_strategy(FFIClientConfig *config, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| enum FFIMempoolStrategy strategy); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_max_mempool_transactions(struct FFIClientConfig *config, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_max_mempool_transactions(FFIClientConfig *config, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uint32_t max_transactions); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_mempool_timeout(struct FFIClientConfig *config, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uint64_t timeout_secs); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_mempool_timeout(FFIClientConfig *config, uint64_t timeout_secs); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_fetch_mempool_transactions(struct FFIClientConfig *config, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| bool fetch); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_fetch_mempool_transactions(FFIClientConfig *config, bool fetch); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_persist_mempool(struct FFIClientConfig *config, bool persist); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_persist_mempool(FFIClientConfig *config, bool persist); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| bool dash_spv_ffi_config_get_mempool_tracking(const struct FFIClientConfig *config); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| bool dash_spv_ffi_config_get_mempool_tracking(const FFIClientConfig *config); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| enum FFIMempoolStrategy dash_spv_ffi_config_get_mempool_strategy(const struct FFIClientConfig *config); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| enum FFIMempoolStrategy dash_spv_ffi_config_get_mempool_strategy(const FFIClientConfig *config); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_start_from_height(struct FFIClientConfig *config, uint32_t height); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_start_from_height(FFIClientConfig *config, uint32_t height); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_wallet_creation_time(struct FFIClientConfig *config, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uint32_t timestamp); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| int32_t dash_spv_ffi_config_set_wallet_creation_time(FFIClientConfig *config, uint32_t timestamp); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| const char *dash_spv_ffi_get_last_error(void); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -490,6 +489,16 @@ void dash_spv_ffi_string_destroy(struct FFIString s); | |||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| void dash_spv_ffi_array_destroy(struct FFIArray *arr); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * Destroy an array of FFIString pointers (Vec<*mut FFIString>) and their contents. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * This function: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * - Iterates the array elements as pointers to FFIString and destroys each via dash_spv_ffi_string_destroy | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * - Frees the underlying vector buffer stored in FFIArray | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * - Does not free the FFIArray struct itself (safe for both stack- and heap-allocated structs) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| void dash_spv_ffi_string_array_destroy(struct FFIArray *arr); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+492
to
+501
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing owned and typed array destroyers in public header Add owned variants and a typed UTXO array destroyer to prevent leaks of FFIArray and inner FFIString fields. void dash_spv_ffi_string_array_destroy(struct FFIArray *arr);
+
+// Owned/typed destroyers for heap-allocated arrays returned by the FFI
+void dash_spv_ffi_array_destroy_owned(struct FFIArray *arr);
+void dash_spv_ffi_string_array_destroy_owned(struct FFIArray *arr);
+void dash_spv_ffi_utxo_array_destroy(struct FFIArray *arr);
+void dash_spv_ffi_utxo_array_destroy_owned(struct FFIArray *arr);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * Destroys the raw transaction bytes allocated for an FFIUnconfirmedTransaction | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C typedef is invalid: ClientConfig is unknown in C
Revert to an opaque forward-declared struct. Current typedef will break all C consumers.
📝 Committable suggestion
🤖 Prompt for AI Agents