-
Notifications
You must be signed in to change notification settings - Fork 573
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
chore: Ironfish rust refactor add change #4572
Conversation
400e0e4
to
018a4a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add_change_notes
ever be called outside of build
?
Can we add a test for the behavior of calling build
incorrectly without an address for change?
6207043
to
fcd5183
Compare
Good call! It shouldn't ever be called outside of build, so I will just make the method private, also I will add a test to verify an invalid balance is returned when change notes are not passed when they should be (ie a standard transaction post where change is present) |
fcd5183
to
12f12dd
Compare
The most canonical use case of a transaction is |
12f12dd
to
8e21ed9
Compare
Ok so I decided the most full proof method is determining if we should add the change note based on whether the transaction is a miners fee transaction (which can be determined by the outputs). This way it is impossible to call the method incorrectly. Miners fee with a |
…edTransaction`. Makes it so no new method is required for build layer
8e21ed9
to
9cf1c78
Compare
@@ -191,7 +191,7 @@ impl ProposedTransaction { | |||
Ok(()) | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should never be called outside of this file.
Summary
Adds change notes as a method that is executed if the transaction is a miners fee (only special type of transaction that doesn't balance). The only reason this method exists is so that no change notes are added for miner fee transactions, otherwise it would always be run inside the
build()
method.Testing Plan
tests pass
Documentation
Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference)? If yes, link a
related documentation pull request for the website.
Breaking Change
Is this a breaking change? If yes, add notes below on why this is breaking and
what additional work is required, if any.