- 
                Notifications
    
You must be signed in to change notification settings  - Fork 3
 
feat: small fixes #155
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
feat: small fixes #155
Changes from all commits
97ff4a6
              165c578
              af64bc4
              8547d5c
              53a7cde
              5df4609
              40cea47
              827ae97
              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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 
          
            
          
           | 
    @@ -531,27 +531,35 @@ int32_t dash_spv_ffi_client_enable_mempool_tracking(struct FFIDashSpvClient *cli | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Get the wallet manager from the SPV client | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Returns an opaque pointer to FFIWalletManager that contains a cloned Arc reference to the wallet manager. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * This allows direct interaction with the wallet manager without going through the client. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Returns a pointer to an `FFIWalletManager` wrapper that clones the underlying | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * `Arc<RwLock<WalletManager>>`. This allows direct interaction with the wallet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * manager without going back through the client for each call. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * # Safety | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The caller must ensure that: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * - The client pointer is valid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * - The returned pointer is freed using `wallet_manager_free` from key-wallet-ffi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * - The returned pointer is released exactly once using | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * `dash_spv_ffi_wallet_manager_free` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * # Returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * An opaque pointer (void*) to the wallet manager, or NULL if the client is not initialized. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Swift should treat this as an OpaquePointer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Get a handle to the wallet manager owned by this client. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * A pointer to the wallet manager wrapper, or NULL if the client is not initialized. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FFIWalletManager *dash_spv_ffi_client_get_wallet_manager(struct FFIDashSpvClient *client) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
     | 
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
         
      Comment on lines
    
      +534
     to 
      +550
    
   
  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. Blocker: FFIWalletManager not declared in this header — switch prototypes to struct-qualified to avoid compile error FFIWalletManager is used but no typedef/forward-declaration exists in this file. C/Swift consumers will see “unknown type name ‘FFIWalletManager’”. Fix locally by using struct-qualified pointers in the signatures. Apply: - FFIWalletManager *dash_spv_ffi_client_get_wallet_manager(struct FFIDashSpvClient *client) ;
+ struct FFIWalletManager *dash_spv_ffi_client_get_wallet_manager(struct FFIDashSpvClient *client) ;Optionally, also re-export the type in dash-spv-ffi (e.g.,   | 
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Release a wallet manager obtained from `dash_spv_ffi_client_get_wallet_manager`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * This simply forwards to `wallet_manager_free` in key-wallet-ffi so that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * lifetime management is consistent between direct key-wallet usage and the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * SPV client pathway. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * # Safety | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * - `client` must be a valid, non-null pointer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * - `manager` must either be null or a pointer previously returned by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * `dash_spv_ffi_client_get_wallet_manager`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
     | 
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void *dash_spv_ffi_client_get_wallet_manager(struct FFIDashSpvClient *client) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void dash_spv_ffi_wallet_manager_free(FFIWalletManager *manager) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
     | 
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
         
      Comment on lines
    
      +551
     to 
      563
    
   
  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. 🧩 Analysis chainMake free signature struct-qualified as well for consistency and C-compat Mirror the change in the free function to avoid the same undefined type: - void dash_spv_ffi_wallet_manager_free(FFIWalletManager *manager) ;
+ void dash_spv_ffi_wallet_manager_free(struct FFIWalletManager *manager) ;Also re-run header generation and sync to SDK after adjusting. Based on learnings. Run to verify header health: 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Check FFIWalletManager usage:"
rg -n "FFIWalletManager" dash-spv-ffi/dash_spv_ffi.h | sed -n '1,200p'
echo "Ensure a declaration exists (typedef or struct-qualified usage):"
rg -nP 'typedef\s+struct\s+FFIWalletManager|struct\s+FFIWalletManager\s*\*' dash-spv-ffi/dash_spv_ffi.h
echo "Check FFINetwork is declared (required by many functions):"
rg -nP 'typedef\s+enum\s+FFINetwork|enum\s+FFINetwork\b' dash-spv-ffi/dash_spv_ffi.hLength of output: 348 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Search for inline struct definition in header:"
rg -nP 'struct\s+FFIWalletManager\s*\{' dash-spv-ffi/dash_spv_ffi.h || echo "No inline struct definition found."
echo
echo "Search for typedef alias in header:"
rg -nP 'typedef\s+struct\s+FFIWalletManager\s+FFIWalletManager' dash-spv-ffi/dash_spv_ffi.h || echo "No typedef alias found."
echo
echo "Search entire dash-spv-ffi directory for any struct/typedef of FFIWalletManager:"
rg -nH -n 'FFIWalletManager' -C2 dash-spv-ffiLength of output: 10333 Qualify  In  - void dash_spv_ffi_wallet_manager_free(FFIWalletManager *manager);
+ void dash_spv_ffi_wallet_manager_free(struct FFIWalletManager *manager);After applying this, re-generate the C header and re-run  📝 Committable suggestion
 
        Suggested change
       
    
 🤖 Prompt for AI Agents | 
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| struct FFIClientConfig *dash_spv_ffi_config_new(FFINetwork network) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
     | 
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
          
            
          
           | 
    ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Example leaks the wallet manager; add a free call.
The “Basic SPV Client Usage” example obtains
FFIWalletManager*but never frees it. This encourages leaks in client code. Adddash_spv_ffi_wallet_manager_free(wallet_manager);(before destroying the client or right after use).Apply this diff to the example:
📝 Committable suggestion
🤖 Prompt for AI Agents