Skip to content

Commit

Permalink
zcash_client_backend: Ensure consistency between sent & stored memos.
Browse files Browse the repository at this point in the history
  • Loading branch information
nuttycom committed Aug 2, 2023
1 parent f0b2fc3 commit 110a9b3
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions zcash_client_backend/src/data_api/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,30 +545,29 @@ where
for payment in proposal.transaction_request().payments() {
match &payment.recipient_address {
RecipientAddress::Unified(ua) => {
let memo = payment
.memo

Check warning on line 549 in zcash_client_backend/src/data_api/wallet.rs

View check run for this annotation

Codecov / codecov/patch

zcash_client_backend/src/data_api/wallet.rs#L548-L549

Added lines #L548 - L549 were not covered by tests
.as_ref()
.map_or_else(MemoBytes::empty, |m| m.clone());

Check warning on line 551 in zcash_client_backend/src/data_api/wallet.rs

View check run for this annotation

Codecov / codecov/patch

zcash_client_backend/src/data_api/wallet.rs#L551

Added line #L551 was not covered by tests
builder.add_sapling_output(
external_ovk,
*ua.sapling().expect("TODO: Add Orchard support to builder"),
payment.amount,
payment.memo.clone().unwrap_or_else(MemoBytes::empty),
memo.clone(),

Check warning on line 556 in zcash_client_backend/src/data_api/wallet.rs

View check run for this annotation

Codecov / codecov/patch

zcash_client_backend/src/data_api/wallet.rs#L556

Added line #L556 was not covered by tests
)?;
sapling_output_meta.push((
Recipient::Unified(ua.clone(), PoolType::Shielded(ShieldedProtocol::Sapling)),
payment.amount,
payment.memo.clone(),
Some(memo),

Check warning on line 561 in zcash_client_backend/src/data_api/wallet.rs

View check run for this annotation

Codecov / codecov/patch

zcash_client_backend/src/data_api/wallet.rs#L561

Added line #L561 was not covered by tests
));
}
RecipientAddress::Shielded(addr) => {
builder.add_sapling_output(
external_ovk,
*addr,
payment.amount,
payment.memo.clone().unwrap_or_else(MemoBytes::empty),
)?;
sapling_output_meta.push((
Recipient::Sapling(*addr),
payment.amount,
payment.memo.clone(),
));
let memo = payment
.memo
.as_ref()
.map_or_else(MemoBytes::empty, |m| m.clone());
builder.add_sapling_output(external_ovk, *addr, payment.amount, memo.clone())?;
sapling_output_meta.push((Recipient::Sapling(*addr), payment.amount, Some(memo)));
}
RecipientAddress::Transparent(to) => {
if payment.memo.is_some() {
Expand Down

0 comments on commit 110a9b3

Please sign in to comment.