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): allow UTXO selection by specific outputs and by token #4227

Merged

Conversation

sdbondi
Copy link
Member

@sdbondi sdbondi commented Jun 23, 2022

Description

  • adds UtxoSelectionCriteria param to select_utxos
  • removes unique_id and parent_public_key utxo fetching
  • adds UtxoSelectionCriteria::TokenOutputs to allow db-level filtering for unique_id
  • adds UtxoSelectionCriteria::SpecificOutputs to allow spendin specific utxos
  • always sort (secondary to first sort) from most to least mature if tip_height is not known
  • remove some commented out and deprecated logic
  • remove MaturityThenSmallest ordering

Motivation and Context

The previous logic of UTXO selection has been kept equivalent (no utxo selection tests needed to be changed), but extended to allow Tokens and specific UTXOs to be selected at the db-level

  • Aurora wallet will need to spend specific utxos.
  • MaturityThenSmallest is redundant because it is only applicable if the tip height is not known, which is now handled independently of the ordering. i.e. if you dont know the tip height (pretty rare) you always want to select the most mature utxos first to reduce chances of it not being spendable regardless of selected value ordering
  • UtxoSelectionCriteria::TokenOutputs does db-level querying which is more performant, and will be chaned on development branch to ContractOutputs (so was worth doing)

How Has This Been Tested?

Existing tests for coin split and utxo selection
Manually, running soin split and make it rain

@aviator-app aviator-app bot merged commit f2a7e18 into tari-project:testnet-dibbler Jun 23, 2022
@sdbondi sdbondi deleted the wallet-input-selection branch June 23, 2022 11:15
sdbondi added a commit to sdbondi/tari that referenced this pull request Jun 23, 2022
* testnet-dibbler:
  feat(wallet): allow UTXO selection by specific outputs and by token (tari-project#4227)
  feat(ci): build both x86/arm64 docker images from GHA  (tari-project#4204)
stringhandler pushed a commit that referenced this pull request Nov 7, 2022
…issue #4811] (#4854)

Description
---
Added UtxoSelectionMode to enable output listing, unrestricted by `script_lock_height` or `maturity`, it has two modes at the moment: `Safe` and `ListingOnly`: 
- `Safe` is supposed to be used when payment is expected,
- `ListingOnly` is to have an option to view existing outputs e.g., to see received, but yet to be matured outputs.

And brushed up a little for easier readability.

Motivation and Context
---
Under certain conditions the function select_utxos selects utxo's which it cannot spend yet due to the timelocks.
Since PR #4227, the wallet can under certain conditions (not default) select UTXOs that have not yet been matured.
The Wallet should ALWAYS look to only select utxos that have matured on script_lock_height and maturity

#4811

How Has This Been Tested?
---
existing unit tests
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.

2 participants