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

wallet-core: Fix pick_notes function for selecting the input-notes for a transaction #2852

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

moCello
Copy link
Member

@moCello moCello commented Nov 5, 2024

The function pick_notes selects up to 4 input notes to be included in a phoenix-transaction.

With a spendable value lower than the total value of the notes, and the transaction target value higher than the spendable, pick_notes still returned 4 input-notes even though the transaction-costs weren't covered with those four notes.

To give an example:
Let's assume we have 5 unspent notes each with a value of 2 DUSK.
This means the max spendable is 8 DUSK (4 * 2).
For a transaction that costs 9 DUSK, pick_notes should return an empty list indicating that there is no combination of the input-notes where the transaction-costs is covered.
The old behavior of pick_notes however was to still return a list of 4 input-notes, even though the values of those notes combined was lower than the transaction-cost.

Such a transaction isn't spendable (its circuit is invalid) so no harm was done, but the behavior is still not desirable.

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.

rusk-wallet: Transferring equivalent to the Phoenix spendable results in replay error
1 participant