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(wallet_ffi): add coin join and split #4218

Merged
merged 10 commits into from
Jun 29, 2022

Conversation

agubarev
Copy link
Contributor

Description

Adding new FFI wallet_coin_join() function and working on unit tests for wallet_coin_join() and an already existing wallet_coin_split()

Motivation and Context

To enable users to join (collapse) UTXOs depending on the selected strategy, with default behavior to join outputs selected by the user.

How Has This Been Tested?

unit tests (WIP)

@stringhandler stringhandler changed the title feat(coin_join+coin_split) feat(wallet_ffi): add coin join and split Jun 22, 2022
})
}

fn to_string_vec(&self) -> Result<Vec<String>, InterfaceError> {
Copy link
Member

@sdbondi sdbondi Jun 22, 2022

Choose a reason for hiding this comment

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

The to_* functions should be marked as unsafe because they do not provide any additional safety guarantees than from_raw_parts (which is unsafe). If the data that TariVector points to is null/deallocated the Vec will be invalid and the program will crash. Moreover if the vector is mutated (as you are free to do with an owned Vec, it could be reallocated and the pointer is no longer valid.

I think the method signature should be:
unsafe fn as_string_slice(&self) -> Result<&[&str], InterfaceError>
wont work

agubarev and others added 7 commits June 26, 2022 13:54
added a simple output querying function

Signed-off-by: Andrey Gubarev <agubarev@protonmail.com>
added a simple output querying function.
added an output database shortcut for easier access from the wallet context, circumventing hops through async fall-through constructs; updated all usages - `cargo test` passing.

Signed-off-by: Andrey Gubarev <agubarev@protonmail.com>
Co-authored-by: stringhandler <stringhandler@gmail.com>
Co-authored-by: stringhandler <stringhandler@gmail.com>
fixed TariVector conversion bug
found a problem in the coin_join approach, need reconsideration

this commit is for review only before the final brushing/wrap-up

Signed-off-by: Andrei Gubarev <agubarev@users.noreply.github.com>
stringhandler
stringhandler previously approved these changes Jun 28, 2022
Copy link
Collaborator

@stringhandler stringhandler left a comment

Choose a reason for hiding this comment

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

I would have preferred less duplication of code, but I'm not sure how often this functionality is actually going to be used, so let's try it and we can DRY it up later

Signed-off-by: Andrei Gubarev <agubarev@users.noreply.github.com>
Signed-off-by: Andrei Gubarev <agubarev@users.noreply.github.com>
Signed-off-by: Andrei Gubarev <agubarev@users.noreply.github.com>
@aviator-app aviator-app bot removed the mq-failed label Jun 29, 2022
@aviator-app aviator-app bot merged commit af6c834 into tari-project:testnet-dibbler Jun 29, 2022
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