@@ -257,7 +257,8 @@ impl RctPrunable {
257
257
258
258
pub fn read < R : Read > (
259
259
rct_type : RctType ,
260
- decoys : & [ usize ] ,
260
+ ring_length : usize ,
261
+ inputs : usize ,
261
262
outputs : usize ,
262
263
r : & mut R ,
263
264
) -> io:: Result < RctPrunable > {
@@ -268,19 +269,19 @@ impl RctPrunable {
268
269
// src/ringct/rctSigs.cpp#L609
269
270
// And then for RctNull, that's only allowed for miner TXs which require one input of
270
271
// Input::Gen
271
- if decoys . is_empty ( ) {
272
+ if inputs == 0 {
272
273
Err ( io:: Error :: other ( "transaction had no inputs" ) ) ?;
273
274
}
274
275
275
276
Ok ( match rct_type {
276
277
RctType :: Null => RctPrunable :: Null ,
277
278
RctType :: MlsagAggregate => RctPrunable :: AggregateMlsagBorromean {
278
279
borromean : read_raw_vec ( BorromeanRange :: read, outputs, r) ?,
279
- mlsag : Mlsag :: read ( decoys [ 0 ] , decoys . len ( ) + 1 , r) ?,
280
+ mlsag : Mlsag :: read ( ring_length , inputs + 1 , r) ?,
280
281
} ,
281
282
RctType :: MlsagIndividual => RctPrunable :: MlsagBorromean {
282
283
borromean : read_raw_vec ( BorromeanRange :: read, outputs, r) ?,
283
- mlsags : decoys . iter ( ) . map ( |d | Mlsag :: read ( * d , 2 , r) ) . collect :: < Result < _ , _ > > ( ) ?,
284
+ mlsags : ( 0 .. inputs ) . map ( |_ | Mlsag :: read ( ring_length , 2 , r) ) . collect :: < Result < _ , _ > > ( ) ?,
284
285
} ,
285
286
RctType :: Bulletproofs | RctType :: BulletproofsCompactAmount => {
286
287
RctPrunable :: MlsagBulletproofs {
@@ -295,8 +296,10 @@ impl RctPrunable {
295
296
}
296
297
Bulletproofs :: read ( r) ?
297
298
} ,
298
- mlsags : decoys. iter ( ) . map ( |d| Mlsag :: read ( * d, 2 , r) ) . collect :: < Result < _ , _ > > ( ) ?,
299
- pseudo_outs : read_raw_vec ( read_point, decoys. len ( ) , r) ?,
299
+ mlsags : ( 0 .. inputs)
300
+ . map ( |_| Mlsag :: read ( ring_length, 2 , r) )
301
+ . collect :: < Result < _ , _ > > ( ) ?,
302
+ pseudo_outs : read_raw_vec ( read_point, inputs, r) ?,
300
303
}
301
304
}
302
305
RctType :: Clsag | RctType :: BulletproofsPlus => RctPrunable :: Clsag {
@@ -308,8 +311,8 @@ impl RctPrunable {
308
311
r,
309
312
) ?
310
313
} ,
311
- clsags : ( 0 .. decoys . len ( ) ) . map ( |o | Clsag :: read ( decoys [ o ] , r) ) . collect :: < Result < _ , _ > > ( ) ?,
312
- pseudo_outs : read_raw_vec ( read_point, decoys . len ( ) , r) ?,
314
+ clsags : ( 0 .. inputs ) . map ( |_ | Clsag :: read ( ring_length , r) ) . collect :: < Result < _ , _ > > ( ) ?,
315
+ pseudo_outs : read_raw_vec ( read_point, inputs , r) ?,
313
316
} ,
314
317
} )
315
318
}
@@ -382,8 +385,16 @@ impl RctSignatures {
382
385
serialized
383
386
}
384
387
385
- pub fn read < R : Read > ( decoys : & [ usize ] , outputs : usize , r : & mut R ) -> io:: Result < RctSignatures > {
386
- let base = RctBase :: read ( decoys. len ( ) , outputs, r) ?;
387
- Ok ( RctSignatures { base : base. 0 , prunable : RctPrunable :: read ( base. 1 , decoys, outputs, r) ? } )
388
+ pub fn read < R : Read > (
389
+ ring_length : usize ,
390
+ inputs : usize ,
391
+ outputs : usize ,
392
+ r : & mut R ,
393
+ ) -> io:: Result < RctSignatures > {
394
+ let base = RctBase :: read ( inputs, outputs, r) ?;
395
+ Ok ( RctSignatures {
396
+ base : base. 0 ,
397
+ prunable : RctPrunable :: read ( base. 1 , ring_length, inputs, outputs, r) ?,
398
+ } )
388
399
}
389
400
}
0 commit comments