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

CalculateAndSetFee relies on TransactionWitnessSet to be initialized #93

Open
nothingalike opened this issue Jul 22, 2022 · 1 comment
Assignees

Comments

@nothingalike
Copy link
Member

transaction.TransactionWitnessSet.VKeyWitnesses.CreateMocks(numberOfVKeyWitnessesToMock);

Found a situation where a transaction is intending to calculate with no witnesses and only mocks. At the time of calculate, TransactionWitnessSet is null which causes an exception.

Question: Is this implementation ok and we should expect at least an initialized TransactionWitnessSet. Or should we initialize it in this method?

@lilpaul
Copy link
Collaborator

lilpaul commented Jul 22, 2022

imo the lowest impact way to accommodate this situation would be, if numberOfVKeyWitnessesToMock > 0 and witness set is not there, new it up, add the mocks, do the calc, and then remove it if it wasnt there initially, leave it in but remove the mocks if it was.
presumably there is good reason for the witness set not to be newed up during the transaction ctor, and its up to the dev to manage that, but for this function, we are just looking for a way to calculate and set the fee based on what will be the witness count, i dont think it should be erroring if the witness set hasnt been newed yet

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

No branches or pull requests

5 participants