From bca951bf44c9a9bd34c5436a787378da09388a1b Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Tue, 6 Jun 2023 08:41:54 -0600 Subject: [PATCH 1/2] doc-only: Document ZIP 321 error variants. Fixes #499 --- zcash_client_backend/src/zip321.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zcash_client_backend/src/zip321.rs b/zcash_client_backend/src/zip321.rs index 271632846..a0549b97f 100644 --- a/zcash_client_backend/src/zip321.rs +++ b/zcash_client_backend/src/zip321.rs @@ -26,12 +26,22 @@ use crate::address::RecipientAddress; /// Errors that may be produced in decoding of payment requests. #[derive(Debug)] pub enum Zip321Error { + /// A memo field in the ZIP 321 URI was not properly base-64 encoded InvalidBase64(base64::DecodeError), + /// A memo value exceeded 512 bytes in length or could not be interpreted as a UTF-8 string + /// when using a valid UTF-8 lead byte. MemoBytesError(memo::Error), + /// The ZIP 321 request included more payments than can be created within a single Zcash + /// transaction. TooManyPayments(usize), + /// Parsing encountered a duplicate ZIP 321 URI parameter for the returned payment index. DuplicateParameter(parse::Param, usize), + /// The payment at the wrapped index attempted to include a memo when sending to a + /// transparent recipient address, which is not supported by the protocol. TransparentMemo(usize), + /// The payment at the wrapped index did not include a recipient address. RecipientMissing(usize), + /// The ZIP 321 URI was malformed and failed to parse. ParseError(String), } From 0b126a107cad0c29531c20e2106278d7eed33924 Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Tue, 6 Jun 2023 09:29:43 -0600 Subject: [PATCH 2/2] Clarify `Zip321Error::TooManyPayments` documentation. Co-authored-by: Daira Hopwood --- zcash_client_backend/src/zip321.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zcash_client_backend/src/zip321.rs b/zcash_client_backend/src/zip321.rs index a0549b97f..a26c3cdf4 100644 --- a/zcash_client_backend/src/zip321.rs +++ b/zcash_client_backend/src/zip321.rs @@ -32,7 +32,7 @@ pub enum Zip321Error { /// when using a valid UTF-8 lead byte. MemoBytesError(memo::Error), /// The ZIP 321 request included more payments than can be created within a single Zcash - /// transaction. + /// transaction. The wrapped value is the number of payments in the request. TooManyPayments(usize), /// Parsing encountered a duplicate ZIP 321 URI parameter for the returned payment index. DuplicateParameter(parse::Param, usize),