mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-10 17:23:07 +00:00
fix: fix 2
This commit is contained in:
parent
ca61183993
commit
637adf9d22
@ -398,7 +398,7 @@ impl NodeCore {
|
||||
|
||||
let accout = acc_map_read_guard.acc_map.get(&utxo.owner).unwrap();
|
||||
|
||||
generate_nullifiers(
|
||||
let nullifier = generate_nullifiers(
|
||||
&utxo,
|
||||
&accout
|
||||
.key_holder
|
||||
@ -406,20 +406,19 @@ impl NodeCore {
|
||||
.nullifier_secret_key
|
||||
.to_bytes()
|
||||
.to_vec(),
|
||||
)
|
||||
};
|
||||
);
|
||||
|
||||
let (resulting_balances, receipt) = prove_send_utxo_deshielded(utxo, receivers);
|
||||
|
||||
TransactionPayload {
|
||||
tx_kind: TxKind::Deshielded,
|
||||
execution_input: vec![],
|
||||
execution_output: serde_json::to_vec(&ActionData::SendMoneyDeshieldedTx(
|
||||
execution_input: serde_json::to_vec(&ActionData::SendMoneyDeshieldedTx(
|
||||
SendMoneyDeshieldedTx {
|
||||
receiver_data: resulting_balances,
|
||||
},
|
||||
))
|
||||
.unwrap(),
|
||||
execution_output: vec![],
|
||||
utxo_commitments_spent_hashes: vec![commitment_in],
|
||||
utxo_commitments_created_hashes: vec![],
|
||||
nullifier_created_hashes: vec![nullifier.try_into().unwrap()],
|
||||
|
||||
@ -19,6 +19,8 @@ use storage::{
|
||||
};
|
||||
use utxo::utxo_core::UTXO;
|
||||
|
||||
use crate::ActionData;
|
||||
|
||||
pub mod accounts_store;
|
||||
pub mod block_store;
|
||||
|
||||
@ -54,7 +56,37 @@ impl NodeChainStore {
|
||||
|
||||
pub fn dissect_insert_block(&mut self, block: Block) -> Result<()> {
|
||||
for tx in &block.transactions {
|
||||
// let public_action = serde_json::from_slice(tx.execution_output);
|
||||
if !tx.execution_input.is_empty() {
|
||||
let public_action = serde_json::from_slice::<ActionData>(&tx.execution_input);
|
||||
|
||||
if let Ok(public_action) = public_action {
|
||||
match public_action {
|
||||
ActionData::MintMoneyPublicTx(action) => {
|
||||
let acc_mut = self.acc_map.get_mut(&action.acc);
|
||||
|
||||
if let Some(acc_mut) = acc_mut {
|
||||
acc_mut.balance += action.amount as u64;
|
||||
}
|
||||
},
|
||||
ActionData::SendMoneyDeshieldedTx(action) => {
|
||||
for (balance, acc_addr) in action.receiver_data {
|
||||
let acc_mut = self.acc_map.get_mut(&acc_addr);
|
||||
|
||||
if let Some(acc_mut) = acc_mut {
|
||||
acc_mut.balance += balance as u64;
|
||||
}
|
||||
}
|
||||
},
|
||||
ActionData::SendMoneyShieldedTx(action) => {
|
||||
let acc_mut = self.acc_map.get_mut(&action.acc_sender);
|
||||
|
||||
if let Some(acc_mut) = acc_mut {
|
||||
acc_mut.balance = acc_mut.balance.saturating_sub(action.amount as u64);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.utxo_commitments_store.add_tx_multiple(
|
||||
tx.utxo_commitments_created_hashes
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user