@@ -13,7 +13,8 @@ use crate::{
1313 constants:: GROTH_PROOF_SIZE ,
1414 note:: ExtractedNoteCommitment ,
1515 note_encryption:: {
16- CompactOutputDescription , SaplingDomain , COMPACT_NOTE_SIZE , ENC_CIPHERTEXT_SIZE ,
16+ CompactEncCiphertext , CompactOutputDescription , EncCiphertext , SaplingDomain ,
17+ COMPACT_NOTE_SIZE , ENC_CIPHERTEXT_SIZE ,
1718 } ,
1819 value:: ValueCommitment ,
1920 Nullifier ,
@@ -433,12 +434,14 @@ impl<A> ShieldedOutput<SaplingDomain> for OutputDescription<A> {
433434 self . cmu . to_bytes ( )
434435 }
435436
436- fn enc_ciphertext ( & self ) -> Option < & NoteBytesData < { ENC_CIPHERTEXT_SIZE } > > {
437+ fn enc_ciphertext ( & self ) -> Option < & EncCiphertext > {
437438 Some ( & self . enc_ciphertext )
438439 }
439440
440- fn enc_ciphertext_compact ( & self ) -> NoteBytesData < { COMPACT_NOTE_SIZE } > {
441- unimplemented ! ( "This function is not required for sapling" )
441+ fn enc_ciphertext_compact ( & self ) -> CompactEncCiphertext {
442+ let mut data = [ 0u8 ; COMPACT_NOTE_SIZE ] ;
443+ data. copy_from_slice ( & self . enc_ciphertext . as_ref ( ) [ ..COMPACT_NOTE_SIZE ] ) ;
444+ NoteBytesData ( data)
442445 }
443446}
444447
@@ -498,12 +501,12 @@ impl OutputDescriptionV5 {
498501
499502impl < A > From < OutputDescription < A > > for CompactOutputDescription {
500503 fn from ( out : OutputDescription < A > ) -> CompactOutputDescription {
504+ let enc_ciphertext = out. enc_ciphertext_compact ( ) . 0 ;
505+
501506 CompactOutputDescription {
502507 ephemeral_key : out. ephemeral_key ,
503508 cmu : out. cmu ,
504- enc_ciphertext : out. enc_ciphertext . as_ref ( ) [ ..COMPACT_NOTE_SIZE ]
505- . try_into ( )
506- . unwrap ( ) ,
509+ enc_ciphertext,
507510 }
508511 }
509512}
0 commit comments