get_shared_point_from_transaction

This commit is contained in:
Sosthene00 2024-04-30 11:24:05 +02:00 committed by Sosthene
parent a59c680d0e
commit 932dc0ba55

View File

@ -97,7 +97,15 @@ pub fn create_transaction_for_address_with_shared_secret(
Ok((final_tx, AnkSharedSecret::new(shared_point, true)))
}
// This need to go
pub fn get_shared_point_from_transaction(tx: &Transaction, sp_wallet: &SpWallet, tweak_data: PublicKey) -> Result<[u8;64]> {
let b_scan = sp_wallet.get_client().get_scan_key();
let test = sp_client::bitcoin::secp256k1::ecdh::shared_secret_point(&tweak_data, &b_scan);
let ecdh_shared= sp_client::silentpayments::utils::receiving::calculate_shared_secret(tweak_data, b_scan)?;
let uncompressed = ecdh_shared.serialize_uncompressed();
assert!(test == uncompressed[1..]);
Ok(test)
}
pub fn check_transaction(
tx: &Transaction,
sp_wallet: &mut SpWallet,