Fix bug with processes mutex in process_transaction
This commit is contained in:
parent
0c5ddefc4b
commit
d121e8f7b2
@ -537,7 +537,7 @@ fn handle_transaction(
|
|||||||
}) {
|
}) {
|
||||||
let prd = Prd::extract_from_message_with_commitment(&plaintext, &commitment)?;
|
let prd = Prd::extract_from_message_with_commitment(&plaintext, &commitment)?;
|
||||||
|
|
||||||
let proof_key = prd.proof.unwrap().get_key();
|
let proof_key = prd.proof.ok_or(AnyhowError::msg("Missing proof"))?.get_key();
|
||||||
let mut actual_sender = String::default();
|
let mut actual_sender = String::default();
|
||||||
for sp_address in serde_json::from_str::<Member>(&prd.sender)?.get_addresses() {
|
for sp_address in serde_json::from_str::<Member>(&prd.sender)?.get_addresses() {
|
||||||
if proof_key
|
if proof_key
|
||||||
@ -557,7 +557,8 @@ fn handle_transaction(
|
|||||||
let outpoint = OutPoint::from_str(&prd.root_commitment)?;
|
let outpoint = OutPoint::from_str(&prd.root_commitment)?;
|
||||||
|
|
||||||
let updated_process: Process;
|
let updated_process: Process;
|
||||||
if let Some(process) = lock_processes()?.get_mut(&outpoint) {
|
let mut processes = lock_processes()?;
|
||||||
|
if let Some(process) = processes.get_mut(&outpoint) {
|
||||||
process.insert_shared_secret(
|
process.insert_shared_secret(
|
||||||
SilentPaymentAddress::try_from(actual_sender.as_str()).unwrap(),
|
SilentPaymentAddress::try_from(actual_sender.as_str()).unwrap(),
|
||||||
shared_secret,
|
shared_secret,
|
||||||
@ -570,7 +571,7 @@ fn handle_transaction(
|
|||||||
shared_secret,
|
shared_secret,
|
||||||
);
|
);
|
||||||
let new_process = Process::new(vec![], shared_secrets, vec![]);
|
let new_process = Process::new(vec![], shared_secrets, vec![]);
|
||||||
lock_processes()?.insert(outpoint, new_process.clone());
|
processes.insert(outpoint, new_process.clone());
|
||||||
updated_process = new_process;
|
updated_process = new_process;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user