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: loosen ffi import utxo requirements #4126

Merged
Show file tree
Hide file tree
Changes from all commits
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
36 changes: 18 additions & 18 deletions base_layer/wallet_ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions base_layer/wallet_ffi/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down