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

fix vector length calculation for targets in BlindTransaction #514

Conversation

dgpv
Copy link
Contributor

@dgpv dgpv commented Mar 15, 2019

The size of surjectionTargets and targetAssetGenerator vectors was calculated as tx.vin.size()*3, based on the fact that for each input there might also be up to 2 issuance pseudo-inputs, but did not take into account that the number of auxiliary generators may exceed the number of inputs. This fixes the size calculations by taking into account auxiliary generators supplied beyond vin size.

surjectionTargets.resize(tx.vin.size()*3);
targetAssetGenerators.resize(tx.vin.size()*3);

size_t maxTargets = tx.vin.size()*3;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe note here that this is a strict upper-bound, and the size is likely less(and is shrunk later).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added the comment

@dgpv dgpv force-pushed the fix-blindtransaction-target-array-size branch from a8f5044 to 42a7a34 Compare March 15, 2019 15:10
@instagibbs
Copy link
Collaborator

utACK 42a7a34

@dgpv dgpv force-pushed the fix-blindtransaction-target-array-size branch from 42a7a34 to 045335a Compare March 21, 2019 06:16
the size of surjectionTargets and targetAssetGenerator vectors
was calculated as tx.vin.size()*3, based on the fact that for
each input there might also be up to 2 issuance pseudo-inputs,
but did not take into account that the number of auxiliary generators
may exceed the number of inputs. This fixes the size calculations
by taking into account auxiliary generators supplied beyond vin size.
@dgpv
Copy link
Contributor Author

dgpv commented Mar 21, 2019

Fixed mistype in comment: "The vectors will be srunk" -> "The vectors will be shrunk"

@instagibbs instagibbs added 0.14.1 needs port Needs backport to a different branch labels Mar 25, 2019
@instagibbs
Copy link
Collaborator

utACK 045335a , spurious failure on one test, restarted.

@instagibbs instagibbs merged commit 045335a into ElementsProject:elements-0.14.1 Mar 28, 2019
instagibbs added a commit that referenced this pull request Mar 28, 2019
…tion

045335a fix vector length calculation for targets in BlindTransaction (Dmitry Petukhov)
@instagibbs instagibbs removed the needs port Needs backport to a different branch label Mar 28, 2019
stevenroose added a commit that referenced this pull request Apr 1, 2019
…tion

93f49ed fix vector length calculation for targets in BlindTransaction (Dmitry Petukhov)

Pull request description:

  port of #514

Tree-SHA512: 5e082bb2590c1dde70b67607524d974f435f673777459b638ca10193040b45239fcb4302cc47d4aa7dbd0a25627294e7ca4f11658a4e41cfcd001c8ca51faf3b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants