Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

fix: simple transaction do not have any 4 inputs limitation #158

Merged
merged 8 commits into from
Jun 30, 2020

Conversation

Alex-Werner
Copy link
Contributor

@Alex-Werner Alex-Werner commented Jun 29, 2020

Issue being fixed or feature implemented

As reported in #157, the SimpleTransactionOptimizedAccumulator strategy was optimising for a maximum of 4 inputs to ensure they get locked. By default, this was the transaction strategy that were being used, so anyone that will try to spend using default options would encounter that case (if using small inputs), and the documentation would not explained the why.
As this rules actually is not in place anymore, we can safely modify the strategy to not put this limitation anymore.

What was done?

  • Remove 4 inputs limitation for the defaut accumulator used.
  • Switched to simpleDescendingStrategy
  • Improve documentation on strategy usage.

How Has This Been Tested?

Rely on differents UTXO selection test we have + additional test in coinSelection file (was already tested in Account.createTransaction)

Breaking Changes

N/A (but won't cause the issue again)

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

@Alex-Werner Alex-Werner marked this pull request as ready for review June 29, 2020 22:14
@Alex-Werner Alex-Werner requested review from shumkov and thephez June 29, 2020 22:15
Copy link
Contributor

@Cofresi Cofresi left a comment

Choose a reason for hiding this comment

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

typo

src/CONSTANTS.js Outdated Show resolved Hide resolved
Co-authored-by: Cofresi <cofresi@dash.org>
@Alex-Werner Alex-Werner requested a review from Cofresi June 29, 2020 23:12
Copy link
Contributor

@thephez thephez left a comment

Choose a reason for hiding this comment

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

Concept ACK

src/utils/coinSelection.spec.js Outdated Show resolved Hide resolved
shumkov
shumkov previously approved these changes Jun 30, 2020
Copy link
Member

@shumkov shumkov left a comment

Choose a reason for hiding this comment

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

👍

shumkov and others added 2 commits June 30, 2020 15:34
Co-authored-by: thephez <thephez@users.noreply.github.com>
@Alex-Werner Alex-Werner requested a review from shumkov June 30, 2020 12:38
@shumkov shumkov added this to the v0.13 milestone Jun 30, 2020
Copy link
Member

@shumkov shumkov left a comment

Choose a reason for hiding this comment

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

Looks good )

@@ -331,7 +331,7 @@ describe('Utils - coinSelection', function suite() {

while(inputValue<outputValue){
if(copiedUtxos.length === 0){
throw new Error('Not enought utxo');
throw new Error('Not enought UTXOs');
Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, missed this the first time 🙈

Suggested change
throw new Error('Not enought UTXOs');
throw new Error('Not enough UTXOs');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's already merged, but I do will update that on another PR, I've taken note of it on my todo :) Thank you :)

@shumkov shumkov merged commit 11d8d01 into master Jun 30, 2020
@shumkov shumkov deleted the fix/islock-rules branch June 30, 2020 13:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants