Skip to content
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: change ffi wallet recovery interface #6636

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions base_layer/wallet_ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8955,7 +8955,7 @@ pub unsafe extern "C" fn wallet_is_recovery_in_progress(wallet: *mut TariWallet,
#[no_mangle]
pub unsafe extern "C" fn wallet_start_recovery(
wallet: *mut TariWallet,
base_node_public_key: *mut TariPublicKey,
base_node_public_keys: *mut TariPublicKeys,
hansieodendaal marked this conversation as resolved.
Show resolved Hide resolved
recovery_progress_callback: unsafe extern "C" fn(context: *mut c_void, u8, u64, u64),
recovered_output_message: *const c_char,
error_out: *mut c_int,
Expand All @@ -8968,9 +8968,14 @@ pub unsafe extern "C" fn wallet_start_recovery(
ptr::swap(error_out, &mut error as *mut c_int);
return false;
}
if base_node_public_keys.is_null() {
error = LibWalletError::from(InterfaceError::NullError("base_node_public_keys".to_string())).code;
ptr::swap(error_out, &mut error as *mut c_int);
return false;
}

let shutdown_signal = (*wallet).shutdown.to_signal();
let peer_public_keys: Vec<TariPublicKey> = vec![(*base_node_public_key).clone()];
let peer_public_keys = (*base_node_public_keys).0.clone();
let mut recovery_task_builder = UtxoScannerService::<WalletSqliteDatabase, WalletConnectivityHandle>::builder();

if !recovered_output_message.is_null() {
Expand Down
2 changes: 1 addition & 1 deletion base_layer/wallet_ffi/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -4021,7 +4021,7 @@ bool wallet_is_recovery_in_progress(struct TariWallet *wallet,
* None
*/
bool wallet_start_recovery(struct TariWallet *wallet,
TariPublicKey *base_node_public_key,
struct TariPublicKeys *base_node_public_keys,
void (*recovery_progress_callback)(void *context,
uint8_t,
uint64_t,
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/src/ffi/ffi_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ extern "C" {
pub fn wallet_is_recovery_in_progress(wallet: *mut TariWallet, error_out: *mut c_int) -> bool;
pub fn wallet_start_recovery(
wallet: *mut TariWallet,
base_node_public_key: *mut TariPublicKey,
base_node_public_keys: *mut TariPublicKeys,
recovery_progress_callback: unsafe extern "C" fn(context: *mut c_void, u8, u64, u64),
recovered_output_message: *const c_char,
error_out: *mut c_int,
Expand Down
Loading