Skip to content

Commit afe76d9

Browse files
chore(key-wallet-ffi): regenerate FFI docs + reorder cfg attribute
- Move `#[cfg(feature = "keep-finalized-transactions")]` to before the doc comment on the three gated FFI accessors. The `contrib/verify_ffi.py` doc-extractor walks back from `#[no_mangle]` collecting `///` lines and stops at the first non-doc, non-blank line — putting `#[cfg]` between the doc and `#[no_mangle]` made the docstrings invisible. - Regenerate `key-wallet-ffi/FFI_API.md` with the updated descriptions for `managed_core_account_get_transaction_count`, `managed_core_account_get_transactions`, and `managed_core_account_free_transactions`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4fcbd4e commit afe76d9

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

key-wallet-ffi/FFI_API.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ Functions: 109
231231
| `managed_account_collection_summary_data` | Get structured account collection summary data for managed collection ... | managed_account_collection |
232232
| `managed_account_collection_summary_free` | Free a managed account collection summary and all its allocated memory #... | managed_account_collection |
233233
| `managed_core_account_free` | Free a managed account handle # Safety - `account` must be a valid pointer... | managed_account |
234-
| `managed_core_account_free_transactions` | Free transactions array returned by managed_core_account_get_transactions #... | managed_account |
234+
| `managed_core_account_free_transactions` | Free transactions array returned by managed_core_account_get_transactions | managed_account |
235235
| `managed_core_account_get_account_type` | Get the account type of a managed account # Safety - `account` must be a... | managed_account |
236236
| `managed_core_account_get_address_pool` | Get an address pool from a managed account by type This function returns... | managed_account |
237237
| `managed_core_account_get_balance` | Get the balance of a managed account # Safety - `account` must be a valid... | managed_account |
@@ -240,8 +240,8 @@ Functions: 109
240240
| `managed_core_account_get_internal_address_pool` | Get the internal address pool from a managed account This function returns... | managed_account |
241241
| `managed_core_account_get_is_watch_only` | Check if a managed account is watch-only # Safety - `account` must be a... | managed_account |
242242
| `managed_core_account_get_network` | Get the network of a managed account # Safety - `account` must be a valid... | managed_account |
243-
| `managed_core_account_get_transaction_count` | Get the number of transactions in a managed account # Safety - `account`... | managed_account |
244-
| `managed_core_account_get_transactions` | Get all transactions from a managed account Returns an array of... | managed_account |
243+
| `managed_core_account_get_transaction_count` | Get the number of transactions in a managed account | managed_account |
244+
| `managed_core_account_get_transactions` | Get all transactions from a managed account | managed_account |
245245
| `managed_core_account_get_utxo_count` | Get the number of UTXOs in a managed account # Safety - `account` must be... | managed_account |
246246
| `managed_platform_account_free` | Free a managed platform account handle # Safety - `account` must be a... | managed_account |
247247
| `managed_platform_account_get_account_index` | Get the account index of a managed platform account # Safety - `account`... | managed_account |
@@ -3065,7 +3065,7 @@ managed_core_account_free_transactions(transactions: *mut FFITransactionRecord,
30653065
```
30663066

30673067
**Description:**
3068-
Free transactions array returned by managed_core_account_get_transactions # Safety - `transactions` must be a pointer returned by `managed_core_account_get_transactions` - `count` must be the count returned by `managed_core_account_get_transactions` - This function must only be called once per allocation
3068+
Free transactions array returned by managed_core_account_get_transactions. Only available when the `keep-finalized-transactions` Cargo feature is enabled (matches the visibility of `managed_core_account_get_transactions`). # Safety - `transactions` must be a pointer returned by `managed_core_account_get_transactions` - `count` must be the count returned by `managed_core_account_get_transactions` - This function must only be called once per allocation
30693069

30703070
**Safety:**
30713071
- `transactions` must be a pointer returned by `managed_core_account_get_transactions` - `count` must be the count returned by `managed_core_account_get_transactions` - This function must only be called once per allocation
@@ -3209,7 +3209,7 @@ managed_core_account_get_transaction_count(account: *const FFIManagedCoreAccount
32093209
```
32103210

32113211
**Description:**
3212-
Get the number of transactions in a managed account # Safety - `account` must be a valid pointer to an FFIManagedCoreAccount instance
3212+
Get the number of transactions in a managed account. Only available when the `keep-finalized-transactions` Cargo feature is enabled. With the feature on, every processed transaction (including finalized ones) lives in the in-memory map for the wallet's lifetime and this count reflects the full history. With the feature off (the default), records of finalized transactions (IS-locked or chainlocked) are dropped from the map immediately to bound memory growth — exposing the resulting partial count via the FFI would be misleading, so the accessor isn't compiled in. # Safety - `account` must be a valid pointer to an FFIManagedCoreAccount instance
32133213

32143214
**Safety:**
32153215
- `account` must be a valid pointer to an FFIManagedCoreAccount instance
@@ -3225,7 +3225,7 @@ managed_core_account_get_transactions(account: *const FFIManagedCoreAccount, tra
32253225
```
32263226

32273227
**Description:**
3228-
Get all transactions from a managed account Returns an array of FFITransactionRecord structures. # Safety - `account` must be a valid pointer to an FFIManagedCoreAccount instance - `transactions_out` must be a valid pointer to receive the transactions array pointer - `count_out` must be a valid pointer to receive the count - The caller must free the returned array using `managed_core_account_free_transactions`
3228+
Get all transactions from a managed account. Only available when the `keep-finalized-transactions` Cargo feature is enabled. With the feature on, every processed transaction (including finalized ones) lives in the in-memory map and this returns the full history. With the feature off (the default), finalized records (IS-locked or chainlocked txs) are dropped from the map immediately to bound memory growth — exposing the resulting partial array via the FFI would be misleading, so the accessor isn't compiled in. Returns an array of FFITransactionRecord structures. # Safety - `account` must be a valid pointer to an FFIManagedCoreAccount instance - `transactions_out` must be a valid pointer to receive the transactions array pointer - `count_out` must be a valid pointer to receive the count - The caller must free the returned array using `managed_core_account_free_transactions`
32293229

32303230
**Safety:**
32313231
- `account` must be a valid pointer to an FFIManagedCoreAccount instance - `transactions_out` must be a valid pointer to receive the transactions array pointer - `count_out` must be a valid pointer to receive the count - The caller must free the returned array using `managed_core_account_free_transactions`

key-wallet-ffi/src/managed_account.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ pub unsafe extern "C" fn managed_core_account_get_balance(
645645
true
646646
}
647647

648+
#[cfg(feature = "keep-finalized-transactions")]
648649
/// Get the number of transactions in a managed account.
649650
///
650651
/// Only available when the `keep-finalized-transactions` Cargo feature
@@ -659,7 +660,6 @@ pub unsafe extern "C" fn managed_core_account_get_balance(
659660
/// # Safety
660661
///
661662
/// - `account` must be a valid pointer to an FFIManagedCoreAccount instance
662-
#[cfg(feature = "keep-finalized-transactions")]
663663
#[no_mangle]
664664
pub unsafe extern "C" fn managed_core_account_get_transaction_count(
665665
account: *const FFIManagedCoreAccount,
@@ -955,6 +955,7 @@ impl Drop for FFITransactionRecord {
955955
}
956956
}
957957

958+
#[cfg(feature = "keep-finalized-transactions")]
958959
/// Get all transactions from a managed account.
959960
///
960961
/// Only available when the `keep-finalized-transactions` Cargo feature
@@ -974,7 +975,6 @@ impl Drop for FFITransactionRecord {
974975
/// - `transactions_out` must be a valid pointer to receive the transactions array pointer
975976
/// - `count_out` must be a valid pointer to receive the count
976977
/// - The caller must free the returned array using `managed_core_account_free_transactions`
977-
#[cfg(feature = "keep-finalized-transactions")]
978978
#[no_mangle]
979979
pub unsafe extern "C" fn managed_core_account_get_transactions(
980980
account: *const FFIManagedCoreAccount,
@@ -1002,6 +1002,7 @@ pub unsafe extern "C" fn managed_core_account_get_transactions(
10021002
true
10031003
}
10041004

1005+
#[cfg(feature = "keep-finalized-transactions")]
10051006
/// Free transactions array returned by managed_core_account_get_transactions.
10061007
///
10071008
/// Only available when the `keep-finalized-transactions` Cargo feature
@@ -1013,7 +1014,6 @@ pub unsafe extern "C" fn managed_core_account_get_transactions(
10131014
/// - `transactions` must be a pointer returned by `managed_core_account_get_transactions`
10141015
/// - `count` must be the count returned by `managed_core_account_get_transactions`
10151016
/// - This function must only be called once per allocation
1016-
#[cfg(feature = "keep-finalized-transactions")]
10171017
#[no_mangle]
10181018
pub unsafe extern "C" fn managed_core_account_free_transactions(
10191019
transactions: *mut FFITransactionRecord,

0 commit comments

Comments
 (0)