/// Attempt to rewind all of the given transaction outputs into unblinded outputs. If they can be rewound then add
/// them to the database and increment the key manager index
Attempt to rewind all of the given transaction outputs into unblinded outputs. If they can be rewound then add
them to the database and increment the key manager index
Attempt to rewind all of the given transaction outputs into unblinded outputs . If they can be rewound then add them to the database and increment the key manager index
pub async fn scan_and_recover_outputs(
        &mut self,
        outputs: Vec<TransactionOutput>,
    ) -> Result<Vec<UnblindedOutput>, OutputManagerError> {
        let mut rewound_outputs: Vec<UnblindedOutput> = outputs
            .into_iter()
            .filter_map(|output| {
                output
                    .full_rewind_range_proof(
                        &self.factories.range_proof,
                        &self.master_key_manager.rewind_data().rewind_key,
                        &self.master_key_manager.rewind_data().rewind_blinding_key,
                    )
                    .ok()
                    .map(|v| {
                        (
                            v,
                            output.features,
                            output.script,
                            output.sender_offset_public_key,
                            output.metadata_signature,
                        )
                    })
            })
            .map(
                |(output, features, script, sender_offset_public_key, metadata_signature)| {
                    UnblindedOutput::new(
                        output.committed_value,
                        output.blinding_factor.clone(),
                        Some(features),
                        script,
                        inputs!(PublicKey::from_secret_key(&output.blinding_factor)),
                        output.blinding_factor,
                        sender_offset_public_key,
                        metadata_signature,
                    )
                },
            )
            .collect();
        for output in rewound_outputs.iter_mut() {
            self.update_outputs_script_private_key_and_update_key_manager_index(output)
                .await?;
            let db_output = DbUnblindedOutput::from_unblinded_output(output.clone(), &self.factories)?;
            self.db.add_unspent_output(db_output).await?;
            trace!(
                target: LOG_TARGET,
                "Output {} with value {} with {} recovered",
                output
                    .as_transaction_input(&self.factories.commitment)?
                    .commitment
                    .to_hex(),
                output.value,
                output.features,
            );
        }
        Ok(rewound_outputs)
    }
pub async fn scan_and_recover_outputs ( & mut self , outputs : Vec < TransactionOutput > , ) -> Result < Vec < UnblindedOutput > , OutputManagerError > { let mut rewound_outputs : Vec < UnblindedOutput > = outputs . into_iter ( ) . filter_map ( | output | { output . full_rewind_range_proof ( & self . factories . range_proof , & self . master_key_manager . rewind_data ( ) . rewind_key , & self . master_key_manager . rewind_data ( ) . rewind_blinding_key , ) . ok ( ) . map ( | v | { ( v , output . features , output . script , output . sender_offset_public_key , output . metadata_signature , ) } ) } ) . map ( | ( output , features , script , sender_offset_public_key , metadata_signature ) | { UnblindedOutput :: new ( output . committed_value , output . blinding_factor . clone ( ) , Some ( features ) , script , inputs ! ( PublicKey from_secret_key ( output blinding_factor ) ) , output . blinding_factor , sender_offset_public_key , metadata_signature , ) } , ) . collect ( ) ; for output in rewound_outputs . iter_mut ( ) { self . update_outputs_script_private_key_and_update_key_manager_index ( output ) . await ? ; let db_output = DbUnblindedOutput :: from_unblinded_output ( output . clone ( ) , & self . factories ) ? ; self . db . add_unspent_output ( db_output ) . await ? ; trace ! ( target LOG_TARGET " " output as_transaction_input ( self factories commitment ) commitment to_hex ( ) output value output features ) ; } Ok ( rewound_outputs ) }
Attempt to rewind all of the given transaction outputs into unblinded outputs.
Attempt to rewind all of the given transaction outputs into unblinded outputs .
&mut self
outputs
Vec<TransactionOutput>