fix: call waku_setup when instantiating waku_new

This commit is contained in:
Richard Ramos 2024-10-28 15:32:50 -04:00
parent 0cf27d112c
commit 44ad6804ae
No known key found for this signature in database
GPG Key ID: 1CE87DB518195760
1 changed files with 5 additions and 1 deletions

View File

@ -15,8 +15,12 @@ use crate::utils::{get_trampoline, handle_json_response, handle_no_response, han
/// Instantiates a Waku node
/// as per the [specification](https://rfc.vac.dev/spec/36/#extern-char-waku_newchar-jsonconfig)
pub fn waku_new(config: Option<WakuNodeConfig>) -> Result<WakuNodeContext> {
let config = config.unwrap_or_default();
unsafe {
waku_sys::waku_setup();
}
let config = config.unwrap_or_default();
let config_ptr = CString::new(
serde_json::to_string(&config)
.expect("Serialization from properly built NodeConfig should never fail"),