Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Daira Emma Hopwood <[email protected]>
  • Loading branch information
nuttycom and daira authored Oct 11, 2023
1 parent ad7117e commit 5ef8687
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions zcash_client_backend/src/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ impl ChangeValue {
ChangeValue::Sapling { value, .. } => *value,
}
}
pub fn memo(&self) -> MemoBytes {
match self {
ChangeValue::Sapling { memo, .. } =>
memo.as_ref().map_or_else(MemoBytes::empty, |m| m.clone())

Check warning on line 42 in zcash_client_backend/src/fees.rs

View check run for this annotation

Codecov / codecov/patch

zcash_client_backend/src/fees.rs#L39-L42

Added lines #L39 - L42 were not covered by tests
}
}
}

/// The amount of change and fees required to make a transaction's inputs and
Expand Down
3 changes: 2 additions & 1 deletion zcash_client_backend/src/fees/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ pub struct SingleOutputChangeStrategy {
}

impl SingleOutputChangeStrategy {
/// Constructs a new [`SingleOutputChangeStrategy`] with the specified fee rule.
/// Constructs a new [`SingleOutputChangeStrategy`] with the specified fee rule
/// and change memo.
pub fn new(fee_rule: FixedFeeRule, change_memo: Option<MemoBytes>) -> Self {
Self {
fee_rule,
Expand Down
2 changes: 1 addition & 1 deletion zcash_client_backend/src/fees/zip317.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub struct SingleOutputChangeStrategy {

impl SingleOutputChangeStrategy {
/// Constructs a new [`SingleOutputChangeStrategy`] with the specified ZIP 317
/// fee parameters.
/// fee parameters and change memo.
pub fn new(fee_rule: Zip317FeeRule, change_memo: Option<MemoBytes>) -> Self {
Self {
fee_rule,
Expand Down

0 comments on commit 5ef8687

Please sign in to comment.