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

fix: fix ffi import external utxo from faucet #3956

Merged

Conversation

hansieodendaal
Copy link
Contributor

@hansieodendaal hansieodendaal commented Mar 24, 2022

Description

  • Fixed importing external UTXOs via the FFI by changing the philosophy about having inconsistent recovery byte data in the wallet database
  • Renamed import UTXO methods to be more descriptive
  • Added a unit test to test importing external UTXOs via the FFI

Note: The FFI import UTXO method was renamed; this is a breaking change on the FFI interface.

Motivation and Context

See above

How Has This Been Tested?

Added a new unit test that test the import UTXO interface

SWvheerden
SWvheerden previously approved these changes Mar 24, 2022
Copy link
Collaborator

@SWvheerden SWvheerden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

ptr::swap(error_out, &mut error as *mut c_int);
return 0;
}
let mut updated_features = if features.is_null() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong. It should error

// On the blockchain, 'V0' of the output features encode and decode without the recovery byte, whereas 'V1' onwards
// adds it in, however, for the wallet, the recovery byte must be consistent with the value commitment to be
// accepted in the wallet irrespective if it is 'V0' or 'V1'
let recovery_byte =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be calculated. It should be imported as provided

return 0;
},
};
updated_features.set_recovery_byte(recovery_byte);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change the data here, the hash will change

- Fixed importing external UTXOs via the FFI; changed the philosophy
  about having inconsistent recovery byte data in the wallet database.
- Renamed import UTXO methods to be more descriptive
- Added a unit test to test importing external UTXOs via the FFI
@hansieodendaal
Copy link
Contributor Author

Changed the philosophy about having inconsistent recovery byte data in the wallet database

@stringhandler stringhandler changed the title fix!: fix ffi import external utxo from faucet fix: fix ffi import external utxo from faucet Mar 28, 2022
@stringhandler stringhandler merged commit 3480323 into tari-project:development Mar 28, 2022
@hansieodendaal hansieodendaal deleted the ho_fix_ffi_import_utxo branch March 30, 2022 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants