Skip to content

Conversation

@vsubhuman
Copy link
Member

@vsubhuman vsubhuman commented Oct 19, 2021

  1. Added a new flag field prefer_pure_change to the tx-builder, default set to false, but can be set true via a new setter
  2. When calculating dirty change with some assets - only in case the flag is true - added a check if the remaining pure value of Coin (after adding asset outputs) is greater than the minimal required utxo value plus additional fee for adding a new output, if so - the pure ADA is added as a separate change output.

The change purification is made optional for cases when someone might have had any kind of business logic dependent on the file that some input marker tokens would always go back along with the main change Coin. So enabling the purification like that should be an explicit decision in any user project.

Added test cases for scenarios:

  1. Dirty change has enough Coin so it gets split into another output
  2. Dirty change has more Coin than minimal utxo value but it's not enough to cover additional fees, so no purification

@vsubhuman vsubhuman added this to the 9.2.0 milestone Oct 19, 2021
Copy link
Contributor

@pedromtcosta pedromtcosta left a comment

Choose a reason for hiding this comment

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

LGTM!

@vsubhuman vsubhuman merged commit 86dd1df into master Oct 22, 2021
@vsubhuman vsubhuman deleted the ruslan/purify-change branch October 22, 2021 08:53
@vsubhuman vsubhuman mentioned this pull request Feb 6, 2022
40 tasks
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.

3 participants