diff --git a/base_layer/wallet/src/output_manager_service/recovery/standard_outputs_recoverer.rs b/base_layer/wallet/src/output_manager_service/recovery/standard_outputs_recoverer.rs index f3386a30eac..9945e5d0d4c 100644 --- a/base_layer/wallet/src/output_manager_service/recovery/standard_outputs_recoverer.rs +++ b/base_layer/wallet/src/output_manager_service/recovery/standard_outputs_recoverer.rs @@ -23,13 +23,17 @@ use std::sync::Arc; use log::*; -use tari_crypto::{inputs, keys::PublicKey as PublicKeyTrait, tari_utilities::hex::Hex}; - -use tari_common_types::types::PublicKey; +use rand::rngs::OsRng; +use tari_common_types::types::{PrivateKey, PublicKey}; use tari_core::transactions::{ transaction::{TransactionOutput, UnblindedOutput}, CryptoFactories, }; +use tari_crypto::{ + inputs, + keys::{PublicKey as PublicKeyTrait, SecretKey}, + tari_utilities::hex::Hex, +}; use crate::output_manager_service::{ error::{OutputManagerError, OutputManagerStorageError}, @@ -91,13 +95,17 @@ where TBackend: OutputManagerBackend + 'static }) .map( |(output, features, script, sender_offset_public_key, metadata_signature)| { + // Todo we need to look here that we might want to fail a spesific output and not recover it as this + // will only work if the script is a Nop script. If this is not a Nop script the recovered input + // will not be spendable. + let script_key = PrivateKey::random(&mut OsRng); UnblindedOutput::new( output.committed_value, output.blinding_factor.clone(), features, script, - inputs!(PublicKey::from_secret_key(&output.blinding_factor)), - output.blinding_factor, + inputs!(PublicKey::from_secret_key(&script_key)), + script_key, sender_offset_public_key, metadata_signature, )