mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-08 00:03:09 +00:00
fix: fmt
This commit is contained in:
parent
66def746e6
commit
9d3bda9bce
@ -2,7 +2,7 @@ use std::path::Path;
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use common::block::Block;
|
||||
use log::warn;
|
||||
use log::{error, warn};
|
||||
use storage::sc_db_utils::{DataBlob, DataBlobChangeVariant};
|
||||
use storage::RocksDBIO;
|
||||
|
||||
@ -66,23 +66,24 @@ impl NodeBlockStore {
|
||||
txs_ser: Vec<u8>,
|
||||
nullifiers_ser: Vec<u8>,
|
||||
) -> Result<()> {
|
||||
//Error notification for writing into DB error
|
||||
self.dbio
|
||||
.put_snapshot_block_id_db(id)
|
||||
.inspect_err(|err| warn!("Failed to store snapshot block id with error {err:#?}"))?;
|
||||
.inspect_err(|err| error!("Failed to store snapshot block id with error {err:#?}"))?;
|
||||
self.dbio
|
||||
.put_snapshot_account_db(accounts_ser)
|
||||
.inspect_err(|err| warn!("Failed to store snapshot accounts with error {err:#?}"))?;
|
||||
.inspect_err(|err| error!("Failed to store snapshot accounts with error {err:#?}"))?;
|
||||
self.dbio
|
||||
.put_snapshot_commitement_db(comm_ser)
|
||||
.inspect_err(|err| warn!("Failed to store snapshot commitments with error {err:#?}"))?;
|
||||
.inspect_err(|err| error!("Failed to store snapshot commitments with error {err:#?}"))?;
|
||||
self.dbio
|
||||
.put_snapshot_transaction_db(txs_ser)
|
||||
.inspect_err(|err| {
|
||||
warn!("Failed to store snapshot transactions with error {err:#?}")
|
||||
error!("Failed to store snapshot transactions with error {err:#?}")
|
||||
})?;
|
||||
self.dbio
|
||||
.put_snapshot_account_db(nullifiers_ser)
|
||||
.inspect_err(|err| warn!("Failed to store snapshot nullifiers with error {err:#?}"))?;
|
||||
.inspect_err(|err| error!("Failed to store snapshot nullifiers with error {err:#?}"))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
use std::{
|
||||
collections::{BTreeMap, HashMap, HashSet},
|
||||
path::Path,
|
||||
};
|
||||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
|
||||
use accounts::account_core::{Account, AccountAddress};
|
||||
use anyhow::Result;
|
||||
@ -145,48 +142,40 @@ impl NodeChainStore {
|
||||
if block_id % self.node_config.shapshot_frequency_in_blocks == 0 {
|
||||
//Serializing all important data structures
|
||||
|
||||
//If we fail snapshot, it is not the reason to stop running
|
||||
//If we fail serialization, it is not the reason to stop running
|
||||
//Logging on warn level in this cases
|
||||
|
||||
let accounts_ser = serde_json::to_vec(&self.acc_map).inspect_err(|err| {
|
||||
if let Ok(accounts_ser) = serde_json::to_vec(&self.acc_map).inspect_err(|err| {
|
||||
warn!("Failed to serialize accounts data {err:#?}");
|
||||
});
|
||||
}) {
|
||||
if let Ok(comm_ser) =
|
||||
serde_json::to_vec(&self.utxo_commitments_store).inspect_err(|err| {
|
||||
warn!("Failed to serialize commitments {err:#?}");
|
||||
})
|
||||
{
|
||||
if let Ok(txs_ser) = serde_json::to_vec(&self.pub_tx_store).inspect_err(|err| {
|
||||
warn!("Failed to serialize transactions {err:#?}");
|
||||
}) {
|
||||
if let Ok(nullifiers_ser) = serde_json::to_vec(&self.nullifier_store)
|
||||
.inspect_err(|err| {
|
||||
warn!("Failed to serialize nullifiers {err:#?}");
|
||||
})
|
||||
{
|
||||
let snapshot_trace = self.block_store.put_snapshot_at_block_id(
|
||||
block_id,
|
||||
accounts_ser,
|
||||
comm_ser,
|
||||
txs_ser,
|
||||
nullifiers_ser,
|
||||
);
|
||||
|
||||
let comm_tree_serialized = serde_json::to_vec(&self.utxo_commitments_store)
|
||||
.inspect_err(|err| {
|
||||
warn!("Failed to serialize commitments {err:#?}");
|
||||
});
|
||||
|
||||
let tx_tree_serialized = serde_json::to_vec(&self.pub_tx_store).inspect_err(|err| {
|
||||
warn!("Failed to serialize transactions {err:#?}");
|
||||
});
|
||||
|
||||
let nullifiers_serialized =
|
||||
serde_json::to_vec(&self.nullifier_store).inspect_err(|err| {
|
||||
warn!("Failed to serialize nullifiers {err:#?}");
|
||||
});
|
||||
|
||||
match (
|
||||
accounts_ser,
|
||||
comm_tree_serialized,
|
||||
tx_tree_serialized,
|
||||
nullifiers_serialized,
|
||||
) {
|
||||
(Ok(accounts_ser), Ok(comm_ser), Ok(txs_ser), Ok(nullifiers_ser)) => {
|
||||
let snapshot_trace = self.block_store.put_snapshot_at_block_id(
|
||||
block_id,
|
||||
accounts_ser,
|
||||
comm_ser,
|
||||
txs_ser,
|
||||
nullifiers_ser,
|
||||
);
|
||||
|
||||
info!(
|
||||
"Snapshot executed at {:?} with results {snapshot_trace:#?}",
|
||||
block_id
|
||||
);
|
||||
info!(
|
||||
"Snapshot executed at {:?} with results {snapshot_trace:#?}",
|
||||
block_id
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => warn!("Failed to serialize node data for snapshot"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user