@@ -234,10 +234,7 @@ impl UnifiedAddress {
234
234
self . expiry_height
235
235
. map ( |h| unified:: MetadataItem :: ExpiryHeight ( u32:: from ( h) ) ) ,
236
236
)
237
- . chain (
238
- self . expiry_time
239
- . map ( unified:: MetadataItem :: ExpiryTime ) ,
240
- )
237
+ . chain ( self . expiry_time . map ( unified:: MetadataItem :: ExpiryTime ) )
241
238
. map ( Item :: Metadata ) ;
242
239
243
240
data_items. chain ( meta_items) . collect ( )
@@ -250,26 +247,26 @@ impl UnifiedAddress {
250
247
/// An address that funds can be sent to.
251
248
#[ derive( Debug , PartialEq , Eq , Clone ) ]
252
249
pub enum Address {
253
- Sapling ( PaymentAddress ) ,
254
- Transparent ( TransparentAddress ) ,
255
- Unified ( UnifiedAddress ) ,
250
+ Sapling ( Box < PaymentAddress > ) ,
251
+ Transparent ( Box < TransparentAddress > ) ,
252
+ Unified ( Box < UnifiedAddress > ) ,
256
253
}
257
254
258
255
impl From < PaymentAddress > for Address {
259
256
fn from ( addr : PaymentAddress ) -> Self {
260
- Address :: Sapling ( addr)
257
+ Address :: Sapling ( Box :: new ( addr) )
261
258
}
262
259
}
263
260
264
261
impl From < TransparentAddress > for Address {
265
262
fn from ( addr : TransparentAddress ) -> Self {
266
- Address :: Transparent ( addr)
263
+ Address :: Transparent ( Box :: new ( addr) )
267
264
}
268
265
}
269
266
270
267
impl From < UnifiedAddress > for Address {
271
268
fn from ( addr : UnifiedAddress ) -> Self {
272
- Address :: Unified ( addr)
269
+ Address :: Unified ( Box :: new ( addr) )
273
270
}
274
271
}
275
272
@@ -312,12 +309,12 @@ impl Address {
312
309
313
310
match self {
314
311
Address :: Sapling ( pa) => ZcashAddress :: from_sapling ( net, pa. to_bytes ( ) ) ,
315
- Address :: Transparent ( addr) => match addr {
312
+ Address :: Transparent ( addr) => match * * addr {
316
313
TransparentAddress :: PublicKeyHash ( data) => {
317
- ZcashAddress :: from_transparent_p2pkh ( net, * data)
314
+ ZcashAddress :: from_transparent_p2pkh ( net, data)
318
315
}
319
316
TransparentAddress :: ScriptHash ( data) => {
320
- ZcashAddress :: from_transparent_p2sh ( net, * data)
317
+ ZcashAddress :: from_transparent_p2sh ( net, data)
321
318
}
322
319
} ,
323
320
Address :: Unified ( ua) => ua. to_address ( net) ,
@@ -345,9 +342,9 @@ pub mod testing {
345
342
346
343
pub fn arb_addr ( request : UnifiedAddressRequest ) -> impl Strategy < Value = Address > {
347
344
prop_oneof ! [
348
- arb_payment_address( ) . prop_map( Address :: Sapling ) ,
349
- arb_transparent_addr( ) . prop_map( Address :: Transparent ) ,
350
- arb_unified_addr( Network :: TestNetwork , request) . prop_map( Address :: Unified ) ,
345
+ arb_payment_address( ) . prop_map( Address :: from ) ,
346
+ arb_transparent_addr( ) . prop_map( Address :: from ) ,
347
+ arb_unified_addr( Network :: TestNetwork , request) . prop_map( Address :: from ) ,
351
348
]
352
349
}
353
350
}
@@ -384,7 +381,7 @@ mod tests {
384
381
#[ cfg( not( feature = "orchard" ) ) ]
385
382
let ua = UnifiedAddress :: new ( sapling, transparent, None , None ) . unwrap ( ) ;
386
383
387
- let addr = Address :: Unified ( ua) ;
384
+ let addr = Address :: from ( ua) ;
388
385
let addr_str = addr. encode ( & MAIN_NETWORK ) ;
389
386
assert_eq ! ( Address :: decode( & MAIN_NETWORK , & addr_str) , Some ( addr) ) ;
390
387
}
0 commit comments