diff --git a/base_layer/wallet_ffi/src/lib.rs b/base_layer/wallet_ffi/src/lib.rs index 87d5f95715..0f5cfc3933 100644 --- a/base_layer/wallet_ffi/src/lib.rs +++ b/base_layer/wallet_ffi/src/lib.rs @@ -3037,7 +3037,7 @@ pub unsafe extern "C" fn pending_inbound_transaction_destroy(transaction: *mut T /// ----------------------------------- Transport Send Status -----------------------------------/// -/// Encode the transaction send status of a TariTransactionSendStatus +/// Decode the transaction send status of a TariTransactionSendStatus /// /// ## Arguments /// `status` - The pointer to a TariTransactionSendStatus @@ -5480,11 +5480,11 @@ pub unsafe extern "C" fn wallet_import_external_utxo_as_non_rewindable( return 0; } - if source_public_key.is_null() { - error = LibWalletError::from(InterfaceError::NullError("source_public_key".to_string())).code; - ptr::swap(error_out, &mut error as *mut c_int); - return 0; - } + let source_public_key = if source_public_key.is_null() { + TariPublicKey::default() + } else { + (*source_public_key).clone() + }; if metadata_signature.is_null() { error = LibWalletError::from(InterfaceError::NullError("metadata_signature".to_string())).code; @@ -5504,16 +5504,16 @@ pub unsafe extern "C" fn wallet_import_external_utxo_as_non_rewindable( return 0; } - if features.is_null() { - error = LibWalletError::from(InterfaceError::NullError("features".to_string())).code; - ptr::swap(error_out, &mut error as *mut c_int); - return 0; - } + let features = if features.is_null() { + TariOutputFeatures::default() + } else { + (*features).clone() + }; - if covenant.is_null() { - error = LibWalletError::from(InterfaceError::NullError("covenant".to_string())).code; - ptr::swap(error_out, &mut error as *mut c_int); - return 0; + let covenant = if covenant.is_null() { + TariCovenant::default() + } else { + (*covenant).clone() }; let message_string; @@ -5552,14 +5552,14 @@ pub unsafe extern "C" fn wallet_import_external_utxo_as_non_rewindable( &(*spending_key).clone(), script!(Nop), inputs!(public_script_key), - &(*source_public_key).clone(), - (*features).clone(), + &source_public_key, + features, message_string, (*metadata_signature).clone(), &(*script_private_key).clone(), &(*sender_offset_public_key).clone(), 0, - (*covenant).clone(), + covenant, )) { Ok(tx_id) => { if let Err(e) = (*wallet) diff --git a/base_layer/wallet_ffi/wallet.h b/base_layer/wallet_ffi/wallet.h index ea7c332afe..172e95466d 100644 --- a/base_layer/wallet_ffi/wallet.h +++ b/base_layer/wallet_ffi/wallet.h @@ -468,6 +468,19 @@ int pending_inbound_transaction_get_status(struct TariPendingInboundTransaction // Frees memory for a TariPendingInboundTransaction void pending_inbound_transaction_destroy(struct TariPendingInboundTransaction *transaction); +/// -------------------------------- Transport Send Status ------------------------------------------------------ /// + +// Decode the transaction send status of a TariTransactionSendStatus +// !direct_send & !saf_send & queued = 0 +// direct_send & saf_send & !queued = 1 +// direct_send & !saf_send & !queued = 2 +// !direct_send & saf_send & !queued = 3 +// any other combination (is not valid) = 4 +unsigned int fn transaction_send_status_decode(struct TariTransactionSendStatus *status, int *error_out); + +// Frees memory for a TariTransactionSendStatus +void transaction_send_status_destroy(struct TariTransactionSendStatus *status); + /// -------------------------------- InboundTransactions ------------------------------------------------------ /// // Gets the number of elements in a TariPendingInboundTransactions