@@ -227,18 +227,15 @@ impl ReserveProof for Transaction {
227227 let serialized_tx = serialize ( & self ) ;
228228
229229 // Check that all inputs besides the challenge input are valid
230- prevouts
231- . iter ( )
232- . map ( |( i, prevout) | {
233- bitcoinconsensus:: verify (
234- prevout. script_pubkey . to_bytes ( ) . as_slice ( ) ,
235- prevout. value ,
236- & serialized_tx,
237- * i,
238- )
239- . map_err ( |e| ProofError :: SignatureValidation ( * i, format ! ( "{:?}" , e) ) )
240- } )
241- . collect :: < Result < ( ) , _ > > ( ) ?;
230+ prevouts. iter ( ) . try_for_each ( |( i, prevout) | {
231+ bitcoinconsensus:: verify (
232+ prevout. script_pubkey . to_bytes ( ) . as_slice ( ) ,
233+ prevout. value ,
234+ & serialized_tx,
235+ * i,
236+ )
237+ . map_err ( |e| ProofError :: SignatureValidation ( * i, format ! ( "{:?}" , e) ) )
238+ } ) ?;
242239
243240 // Check that all inputs besides the challenge input actually
244241 // commit to the challenge input by modifying the challenge
@@ -257,23 +254,20 @@ impl ReserveProof for Transaction {
257254 serialize ( & malleated_tx)
258255 } ;
259256
260- prevouts
261- . iter ( )
262- . map ( |( i, prevout) | {
263- match bitcoinconsensus:: verify (
264- prevout. script_pubkey . to_bytes ( ) . as_slice ( ) ,
265- prevout. value ,
266- & serialized_malleated_tx,
257+ prevouts. iter ( ) . try_for_each ( |( i, prevout) | {
258+ match bitcoinconsensus:: verify (
259+ prevout. script_pubkey . to_bytes ( ) . as_slice ( ) ,
260+ prevout. value ,
261+ & serialized_malleated_tx,
262+ * i,
263+ ) {
264+ Ok ( _) => Err ( ProofError :: SignatureValidation (
267265 * i,
268- ) {
269- Ok ( _) => Err ( ProofError :: SignatureValidation (
270- * i,
271- "Does not commit to challenge input" . to_string ( ) ,
272- ) ) ,
273- Err ( _) => Ok ( ( ) ) ,
274- }
275- } )
276- . collect :: < Result < ( ) , _ > > ( ) ?;
266+ "Does not commit to challenge input" . to_string ( ) ,
267+ ) ) ,
268+ Err ( _) => Ok ( ( ) ) ,
269+ }
270+ } ) ?;
277271
278272 Ok ( sum)
279273 }
0 commit comments