Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ impl Builder {
&self.outputs
}

/// The net value of the bundle to be built. The value of all spends,
/// The net native (ZEC) value of the bundle to be built. The value of all spends,
/// minus the value of all outputs.
///
/// Useful for balancing a transaction, as the value balance of an individual bundle
Expand All @@ -633,10 +633,12 @@ impl Builder {
let value_balance = self
.spends
.iter()
.filter(|spend| spend.note.asset().is_native().into())
.map(|spend| spend.note.value() - NoteValue::zero())
.chain(
self.outputs
.iter()
.filter(|output| output.asset.is_native().into())
.map(|output| NoteValue::zero() - output.value),
)
.try_fold(ValueSum::zero(), |acc, note_value| acc + note_value)
Expand Down