mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-08 22:28:12 -05:00
src/error: renamed RusqliteError into DatabaseError for generic usage and removed rusqlite crate dep entirely
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -1984,7 +1984,6 @@ dependencies = [
|
||||
"randomx",
|
||||
"rcgen",
|
||||
"regex",
|
||||
"rusqlite",
|
||||
"rustls-pemfile",
|
||||
"semver 1.0.23",
|
||||
"serde",
|
||||
|
||||
@@ -118,7 +118,6 @@ wasmer-compiler-singlepass = {version = "4.3.4", optional = true}
|
||||
wasmer-middlewares = {version = "4.3.4", optional = true}
|
||||
|
||||
# SQLite stuff
|
||||
rusqlite = {version = "0.31.0", features = ["sqlcipher"], optional = true}
|
||||
libsqlite3-sys = {version = "0.28.0", features = ["sqlcipher"], optional = true}
|
||||
|
||||
# Blockchain store
|
||||
|
||||
@@ -10,7 +10,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# Darkfi
|
||||
darkfi = {path = "../../", features = ["async-daemonize", "bs58", "rpc", "rusqlite"]}
|
||||
darkfi = {path = "../../", features = ["async-daemonize", "bs58", "rpc"]}
|
||||
darkfi_money_contract = {path = "../../src/contract/money", features = ["no-entrypoint", "client"]}
|
||||
darkfi_dao_contract = {path = "../../src/contract/dao", features = ["no-entrypoint", "client"]}
|
||||
darkfi_deployooor_contract = {path = "../../src/contract/deployooor", features = ["no-entrypoint", "client"]}
|
||||
|
||||
@@ -411,7 +411,7 @@ impl Drk {
|
||||
let row = match self.wallet.query_single(&DAO_TREES_TABLE, &[], &[]) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_dao_trees] Trees retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -496,7 +496,7 @@ impl Drk {
|
||||
let rows = match self.wallet.query_multiple(&DAO_DAOS_TABLE, &[], &[]) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!("[get_daos] DAOs retrieval failed: {e:?}")))
|
||||
return Err(Error::DatabaseError(format!("[get_daos] DAOs retrieval failed: {e:?}")))
|
||||
}
|
||||
};
|
||||
|
||||
@@ -607,7 +607,7 @@ impl Drk {
|
||||
/// Fetch all known DAO proposals from the wallet given a DAO name.
|
||||
pub async fn get_dao_proposals(&self, name: &str) -> Result<Vec<ProposalRecord>> {
|
||||
let Ok(dao) = self.get_dao_by_name(name).await else {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_dao_proposals] DAO with name {name} not found in wallet"
|
||||
)))
|
||||
};
|
||||
@@ -619,7 +619,7 @@ impl Drk {
|
||||
) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_dao_proposals] Proposals retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -659,12 +659,12 @@ impl Drk {
|
||||
|
||||
// Update wallet data
|
||||
if let Err(e) = self.put_dao_trees(&daos_tree, &proposals_tree).await {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[apply_dao_mint_data] Put DAO tree failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
if let Err(e) = self.confirm_dao(&dao_to_confirm).await {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[apply_dao_mint_data] Confirm DAO failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -723,12 +723,12 @@ impl Drk {
|
||||
};
|
||||
|
||||
if let Err(e) = self.put_dao_trees(&daos_tree, &proposals_tree).await {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[apply_dao_propose_data] Put DAO tree failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
if let Err(e) = self.put_dao_proposal(&our_proposal).await {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[apply_dao_propose_data] Put DAO proposals failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -756,7 +756,7 @@ impl Drk {
|
||||
let dao = match self.get_dao_by_bulla(&proposal.proposal.dao_bulla).await {
|
||||
Ok(d) => d,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[apply_dao_vote_data] Couldn't find proposal {} DAO {}: {e}",
|
||||
proposal.bulla(),
|
||||
proposal.proposal.dao_bulla,
|
||||
@@ -768,7 +768,7 @@ impl Drk {
|
||||
let note = match params.note.decrypt_unsafe(&dao.params.secret_key) {
|
||||
Ok(n) => n,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[apply_dao_vote_data] Couldn't decrypt proposal {} vote with DAO {} keys: {e}",
|
||||
proposal.bulla(),
|
||||
proposal.proposal.dao_bulla,
|
||||
@@ -779,7 +779,7 @@ impl Drk {
|
||||
// Create the DAO vote record
|
||||
let vote_option = fp_to_u64(note[0]).unwrap();
|
||||
if vote_option > 1 {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[apply_dao_vote_data] Malformed vote for proposal {}: {vote_option}",
|
||||
proposal.bulla(),
|
||||
)))
|
||||
@@ -802,7 +802,7 @@ impl Drk {
|
||||
};
|
||||
|
||||
if let Err(e) = self.put_dao_vote(&v).await {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[apply_dao_vote_data] Put DAO votes failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -824,7 +824,7 @@ impl Drk {
|
||||
// Update its exec transaction hash
|
||||
proposal.exec_tx_hash = Some(tx_hash);
|
||||
if let Err(e) = self.put_dao_proposal(&proposal).await {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[apply_dao_exec_data] Put DAO proposal failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -920,7 +920,7 @@ impl Drk {
|
||||
/// Import given DAO proposal into the wallet.
|
||||
pub async fn put_dao_proposal(&self, proposal: &ProposalRecord) -> Result<()> {
|
||||
if let Err(e) = self.get_dao_by_bulla(&proposal.proposal.dao_bulla).await {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[put_dao_proposal] Couldn't find proposal {} DAO {}: {e}",
|
||||
proposal.bulla(),
|
||||
proposal.proposal.dao_bulla
|
||||
@@ -987,7 +987,7 @@ impl Drk {
|
||||
exec_tx_hash,
|
||||
],
|
||||
) {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[put_dao_proposal] Proposal insert failed: {e:?}"
|
||||
)))
|
||||
};
|
||||
@@ -1115,7 +1115,7 @@ impl Drk {
|
||||
pub async fn import_dao(&self, name: &str, params: DaoParams) -> Result<()> {
|
||||
// First let's check if we've imported this DAO with the given name before.
|
||||
if self.get_dao_by_name(name).await.is_ok() {
|
||||
return Err(Error::RusqliteError(
|
||||
return Err(Error::DatabaseError(
|
||||
"[import_dao] This DAO has already been imported".to_string(),
|
||||
))
|
||||
}
|
||||
@@ -1134,7 +1134,7 @@ impl Drk {
|
||||
serialize_async(¶ms).await,
|
||||
],
|
||||
) {
|
||||
return Err(Error::RusqliteError(format!("[import_dao] DAO insert failed: {e:?}")))
|
||||
return Err(Error::DatabaseError(format!("[import_dao] DAO insert failed: {e:?}")))
|
||||
};
|
||||
|
||||
Ok(())
|
||||
@@ -1149,7 +1149,7 @@ impl Drk {
|
||||
) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_dao_by_bulla] DAO retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -1167,7 +1167,7 @@ impl Drk {
|
||||
) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_dao_by_name] DAO retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -1226,7 +1226,7 @@ impl Drk {
|
||||
let rows = match self.wallet.query_multiple(&DAO_PROPOSALS_TABLE, &[], &[]) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_proposals] DAO proposalss retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -1253,7 +1253,7 @@ impl Drk {
|
||||
) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_dao_proposal_by_bulla] DAO proposal retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -1275,7 +1275,7 @@ impl Drk {
|
||||
) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_dao_proposal_votes] Votes retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -1403,7 +1403,7 @@ impl Drk {
|
||||
|
||||
let Some(dao_mint_zkbin) = zkas_bins.iter().find(|x| x.0 == DAO_CONTRACT_ZKAS_DAO_MINT_NS)
|
||||
else {
|
||||
return Err(Error::RusqliteError("[dao_mint] DAO Mint circuit not found".to_string()))
|
||||
return Err(Error::DatabaseError("[dao_mint] DAO Mint circuit not found".to_string()))
|
||||
};
|
||||
|
||||
let dao_mint_zkbin = ZkBinary::decode(&dao_mint_zkbin.1)?;
|
||||
@@ -1544,7 +1544,7 @@ impl Drk {
|
||||
};
|
||||
|
||||
if let Err(e) = self.put_dao_proposal(&proposal_record).await {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[dao_propose_transfer] Put DAO proposal failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ impl Drk {
|
||||
let rows = match self.wallet.query_multiple(&DEPLOY_AUTH_TABLE, &[], &[]) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[list_deploy_auth] Deploy auth retrieval failed: {e:?}",
|
||||
)))
|
||||
}
|
||||
@@ -118,7 +118,7 @@ impl Drk {
|
||||
) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[deploy_contract] Failed to retrieve deploy authority keypair: {e:?}"
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ impl Drk {
|
||||
) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[default_secret] Default secret key retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -225,7 +225,7 @@ impl Drk {
|
||||
) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[default_address] Default address retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -260,7 +260,7 @@ impl Drk {
|
||||
let rows = match self.wallet.query_multiple(&MONEY_KEYS_TABLE, &[], &[]) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[addresses] Addresses retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -304,7 +304,7 @@ impl Drk {
|
||||
match self.wallet.query_multiple(&MONEY_KEYS_TABLE, &[MONEY_KEYS_COL_SECRET], &[]) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_money_secrets] Secret keys retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -356,7 +356,7 @@ impl Drk {
|
||||
if let Err(e) =
|
||||
self.wallet.exec_sql(&query, rusqlite::params![is_default, public, secret])
|
||||
{
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[import_money_secrets] Inserting new address failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -403,7 +403,7 @@ impl Drk {
|
||||
let rows = match query {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_coins] Coins retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -428,7 +428,7 @@ impl Drk {
|
||||
let rows = match query {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_token_coins] Coins retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -458,7 +458,7 @@ impl Drk {
|
||||
let rows = match query {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_contract_token_coins] Coins retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -580,7 +580,7 @@ impl Drk {
|
||||
let rows = match self.wallet.query_multiple(&MONEY_ALIASES_TABLE, &[], &[]) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_aliases] Aliases retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -671,7 +671,7 @@ impl Drk {
|
||||
let row = match self.wallet.query_single(&MONEY_TREE_TABLE, &[MONEY_TREE_COL_TREE], &[]) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_money_tree] Tree retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -689,7 +689,7 @@ impl Drk {
|
||||
let rows = match self.wallet.query_multiple(&MONEY_SMT_TABLE, &[], &[]) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_nullifiers_smt] SMT records retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -853,7 +853,7 @@ impl Drk {
|
||||
}
|
||||
|
||||
if let Err(e) = self.put_money_tree(&tree).await {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[apply_tx_money_data] Put Money tree failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -898,7 +898,7 @@ impl Drk {
|
||||
];
|
||||
|
||||
if let Err(e) = self.wallet.exec_sql(&query, params) {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[apply_tx_money_data] Inserting Money coin failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -913,7 +913,7 @@ impl Drk {
|
||||
if let Err(e) =
|
||||
self.wallet.exec_sql(&query, rusqlite::params![serialize_async(&token_id).await])
|
||||
{
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[apply_tx_money_data] Inserting Money coin failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ impl Drk {
|
||||
for (coin, _, _) in self.get_coins(false).await? {
|
||||
if nullifiers.contains(&coin.nullifier()) {
|
||||
if let Err(e) = self.mark_spent_coin(&coin.coin, spent_tx_hash).await {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[mark_spent_coins] Marking spent coin failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ impl Drk {
|
||||
let last_scanned = match self.last_scanned_block() {
|
||||
Ok(l) => l,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[subscribe_blocks] Retrieving last scanned block failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -71,7 +71,7 @@ impl Drk {
|
||||
if last_known != last_scanned {
|
||||
eprintln!("Warning: Last scanned block is not the last known block.");
|
||||
eprintln!("You should first fully scan the blockchain, and then subscribe");
|
||||
return Err(Error::RusqliteError(
|
||||
return Err(Error::DatabaseError(
|
||||
"[subscribe_blocks] Blockchain not fully scanned".to_string(),
|
||||
))
|
||||
}
|
||||
@@ -140,14 +140,14 @@ impl Drk {
|
||||
let block_data: BlockInfo = deserialize_async(&bytes).await?;
|
||||
println!("Deserialized successfully. Scanning block...");
|
||||
if let Err(e) = self.scan_block(&block_data).await {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[subscribe_blocks] Scanning block failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
let txs_hashes = match self.insert_tx_history_records(&block_data.txs).await {
|
||||
Ok(hashes) => hashes,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[subscribe_blocks] Inserting transaction history records failed: {e:?}"
|
||||
)))
|
||||
},
|
||||
@@ -155,7 +155,7 @@ impl Drk {
|
||||
if let Err(e) =
|
||||
self.update_tx_history_records_status(&txs_hashes, "Finalized")
|
||||
{
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[subscribe_blocks] Update transaction history record status failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -223,7 +223,7 @@ impl Drk {
|
||||
let query =
|
||||
format!("UPDATE {} SET {} = ?1;", *MONEY_INFO_TABLE, MONEY_INFO_COL_LAST_SCANNED_BLOCK);
|
||||
if let Err(e) = self.wallet.exec_sql(&query, rusqlite::params![block.header.height]) {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[scan_block] Update last scanned block failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -324,7 +324,7 @@ impl Drk {
|
||||
|
||||
// Store transactions history record
|
||||
if let Err(e) = self.insert_tx_history_record(tx).await {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[broadcast_tx] Inserting transaction history record failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ impl Drk {
|
||||
is_frozen,
|
||||
],
|
||||
) {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[import_mint_authority] Inserting mint authority failed: {e:?}"
|
||||
)))
|
||||
};
|
||||
@@ -157,7 +157,7 @@ impl Drk {
|
||||
let rows = match self.wallet.query_multiple(&MONEY_TOKENS_TABLE, &[], &[]) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_mint_authorities] Tokens mint autorities retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
@@ -183,7 +183,7 @@ impl Drk {
|
||||
) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_token_mint_authority] Token mint autority retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ impl Drk {
|
||||
) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
return Err(Error::RusqliteError(format!(
|
||||
return Err(Error::DatabaseError(format!(
|
||||
"[get_tx_history_record] Transaction history record retrieval failed: {e:?}"
|
||||
)))
|
||||
}
|
||||
|
||||
12
src/error.rs
12
src/error.rs
@@ -327,9 +327,8 @@ pub enum Error {
|
||||
// ===============
|
||||
// Database errors
|
||||
// ===============
|
||||
#[cfg(feature = "rusqlite")]
|
||||
#[error("rusqlite error: {0}")]
|
||||
RusqliteError(String),
|
||||
#[error("Database error: {0}")]
|
||||
DatabaseError(String),
|
||||
|
||||
#[cfg(feature = "sled")]
|
||||
#[error(transparent)]
|
||||
@@ -702,13 +701,6 @@ impl From<log::SetLoggerError> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "rusqlite")]
|
||||
impl From<rusqlite::Error> for Error {
|
||||
fn from(err: rusqlite::Error) -> Self {
|
||||
Self::RusqliteError(err.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "halo2_proofs")]
|
||||
impl From<halo2_proofs::plonk::Error> for Error {
|
||||
fn from(err: halo2_proofs::plonk::Error) -> Self {
|
||||
|
||||
Reference in New Issue
Block a user