-
Notifications
You must be signed in to change notification settings - Fork 124
Labels
good first issueGood for newcomersGood for newcomersrustIssues that affect or pull requests that update Rust codeIssues that affect or pull requests that update Rust code
Milestone
Description
NoteAssets::add_asset recomputes the commitment every time. This currently results in re-hashing the assets whenever an asset is added to a note due to OutputNoteBuilder::add_asset forwarding to NoteAssets::add_asset in the tx host.
To make this a bit more efficient:
- Store assets in a
VecinOutputNoteBuilderand delayNoteAssetscreation untilOutputNoteBuilder::buildis called. - In addition to the above, we can consider making
NoteAssetsimmutable by removingadd_asset. It seems to only exist for the purpose of calling it inOutputNoteBuilder. This is more in line with most other types in protocol, which are immutable. If one wants to mutate an existingNoteAssets, it can be converted (into_vec(self) -> Vec<Asset>) and then rebuilt after one or multiple assets were added to the vec.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomersrustIssues that affect or pull requests that update Rust codeIssues that affect or pull requests that update Rust code