fix: merge fixes

This commit is contained in:
Oleksandr Pravdyvyi 2025-08-11 09:05:18 +03:00
parent 56ac4ab982
commit 8727dabe27
No known key found for this signature in database
GPG Key ID: 9F8955C63C443871

View File

@ -29,7 +29,7 @@ pub mod config;
pub mod helperfunctions; pub mod helperfunctions;
pub struct WalletCore { pub struct WalletCore {
pub storage: Arc<RwLock<WalletChainStore>>, pub storage: WalletChainStore,
pub wallet_config: WalletConfig, pub wallet_config: WalletConfig,
pub sequencer_client: Arc<SequencerClient>, pub sequencer_client: Arc<SequencerClient>,
} }
@ -50,7 +50,7 @@ impl WalletCore {
} }
Ok(Self { Ok(Self {
storage: wrapped_storage, storage,
wallet_config: config.clone(), wallet_config: config.clone(),
sequencer_client: client.clone(), sequencer_client: client.clone(),
}) })
@ -74,11 +74,7 @@ impl WalletCore {
to: AccountAddress, to: AccountAddress,
balance_to_move: u64, balance_to_move: u64,
) -> Result<SendTxResponse, ExecutionFailureKind> { ) -> Result<SendTxResponse, ExecutionFailureKind> {
let public_context = { let public_context = self.storage.produce_context(from);
let read_guard = self.storage.read().await;
read_guard.produce_context(from)
};
let (tweak, secret_r, commitment) = pedersen_commitment_vec( let (tweak, secret_r, commitment) = pedersen_commitment_vec(
//Will not panic, as public context is serializable //Will not panic, as public context is serializable
@ -110,12 +106,9 @@ impl WalletCore {
let signed_transaction = Transaction::new(tx, key_to_sign_transaction); let signed_transaction = Transaction::new(tx, key_to_sign_transaction);
let signed_transaction = Transaction::new(tx, key_to_sign_transaction); Ok(self.sequencer_client.send_tx(signed_transaction).await?)
} else {
Ok(self.sequencer_client.send_tx(signed_transaction).await?) Err(ExecutionFailureKind::AmountMismatchError)
} else {
Err(ExecutionFailureKind::AmountMismatchError)
}
} }
} }
@ -207,7 +200,7 @@ pub async fn execute_subcommand(command: Command) -> Result<()> {
Command::DumpAccountsOnDisc { dump_path } => { Command::DumpAccountsOnDisc { dump_path } => {
let node_config = fetch_config()?; let node_config = fetch_config()?;
let wallet_core = NodeCore::start_from_config_update_chain(node_config).await?; let wallet_core = WalletCore::start_from_config_update_chain(node_config).await?;
wallet_core.store_present_accounts_at_path(dump_path.clone())?; wallet_core.store_present_accounts_at_path(dump_path.clone())?;