mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-02 13:23:10 +00:00
transfer_utxo_multiple_assets_private add commitments
This commit is contained in:
parent
8a4606f5d3
commit
e9a2cf361d
@ -453,9 +453,9 @@ impl NodeCore {
|
||||
) -> Result<(Transaction, Vec<[u8; 32]>, Vec<[u8; 32]>), ExecutionFailureKind> {
|
||||
let acc_map_read_guard = self.storage.read().await;
|
||||
|
||||
let accout = acc_map_read_guard.acc_map.get(&utxos[0].owner).unwrap();
|
||||
let account = acc_map_read_guard.acc_map.get(&utxos[0].owner).unwrap();
|
||||
|
||||
let nsk = accout
|
||||
let nsk = account
|
||||
.key_holder
|
||||
.utxo_secret_key_holder
|
||||
.nullifier_secret_key
|
||||
@ -481,7 +481,7 @@ impl NodeCore {
|
||||
.map(|utxo| utxo.hash)
|
||||
.collect();
|
||||
|
||||
let ephm_key_holder = &accout.produce_ephemeral_key_holder();
|
||||
let ephm_key_holder = &account.produce_ephemeral_key_holder();
|
||||
ephm_key_holder.log();
|
||||
|
||||
let eph_pub_key =
|
||||
@ -528,6 +528,27 @@ impl NodeCore {
|
||||
|
||||
commitments.extend(commitments_1);
|
||||
|
||||
// TODO: fix address when correspoding method will be added
|
||||
let sc_addr = "";
|
||||
let mut rng = rand::thread_rng();
|
||||
let secret_r: [u8; 32] = rng.gen();
|
||||
|
||||
let sc_state = acc_map_read_guard.block_store.get_sc_sc_state(sc_addr).map_err(ExecutionFailureKind::db_error)?;
|
||||
|
||||
let mut vec_values_u64: Vec<Vec<u64>> = sc_state.into_iter().map(|slice| Self::vec_u8_to_vec_u64(slice.to_vec())).collect();
|
||||
|
||||
let context = acc_map_read_guard.produce_context(account.address);
|
||||
|
||||
let serialized_context = serde_json::to_vec(&context).unwrap();
|
||||
|
||||
let serialized_context_u64 = Self::vec_u8_to_vec_u64(serialized_context);
|
||||
|
||||
vec_values_u64.push(serialized_context_u64);
|
||||
|
||||
let vec_public_info: Vec<u64> = vec_values_u64.into_iter().flatten().collect();
|
||||
|
||||
let (tweak, secret_r, commitment) = new_commitment_vec(vec_public_info, &secret_r);
|
||||
|
||||
Ok((
|
||||
TransactionPayload {
|
||||
tx_kind: TxKind::Private,
|
||||
@ -545,6 +566,9 @@ impl NodeCore {
|
||||
.unwrap(),
|
||||
encoded_data,
|
||||
ephemeral_pub_key: eph_pub_key.to_vec(),
|
||||
commitment,
|
||||
tweak,
|
||||
secret_r: secret_r.try_into().unwrap(),
|
||||
}
|
||||
.into(),
|
||||
utxo_hashes_receiver,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user