diff --git a/src/builder.rs b/src/builder.rs index 39af8eb3..f3e09f12 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -86,7 +86,7 @@ impl RecipientInfo { RecipientInfo { ovk: None, recipient, - value: NoteValue::default(), + value: NoteValue::zero(), memo: None, } } @@ -280,7 +280,7 @@ impl Builder { // Determine the value balance for this bundle, ensuring it is valid. let value_balance: ValueSum = pre_actions .iter() - .fold(Ok(ValueSum::default()), |acc, action| { + .fold(Ok(ValueSum::zero()), |acc, action| { acc? + action.value_sum()? })?; diff --git a/src/value.rs b/src/value.rs index 2f1ede92..c636d173 100644 --- a/src/value.rs +++ b/src/value.rs @@ -80,6 +80,11 @@ impl Sub for NoteValue { pub struct ValueSum(i64); impl ValueSum { + pub(crate) fn zero() -> Self { + // Default for i64 is zero. + Default::default() + } + /// Creates a value sum from its raw numeric value. /// /// This only enforces that the value is a signed 63-bit integer. Callers should