Skip to content

Commit

Permalink
Add wallet FFI backup peers
Browse files Browse the repository at this point in the history
  • Loading branch information
hansieodendaal committed Oct 1, 2024
1 parent 6d998c7 commit 030f457
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion base_layer/wallet_ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6906,10 +6906,20 @@ pub unsafe extern "C" fn wallet_set_base_node_peer(
}
};

let peer_manager = (*wallet).wallet.comms.peer_manager();
let query = PeerQuery::new().select_where(|p| p.is_seed());
let backup_peers = match (*wallet)
.runtime
.block_on(async move { Result::<_, WalletError>::Ok(peer_manager.perform_query(query).await?) })
{
Ok(peers) => Some(peers),
Err(_) => None,
};

if let Err(e) = (*wallet).runtime.block_on((*wallet).wallet.set_base_node_peer(
(*public_key).clone(),
parsed_addr,
None,
backup_peers,
)) {
error = LibWalletError::from(e).code;
ptr::swap(error_out, &mut error as *mut c_int);
Expand Down

0 comments on commit 030f457

Please sign in to comment.