Skip to content

Commit

Permalink
rpc_api: Remove database member.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyhunsen committed Jun 10, 2024
1 parent 2e79b97 commit 4fcf394
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
6 changes: 0 additions & 6 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
use crate::ledger::Ledger;
use bitcoin_simulator::database::Database;
use std::sync::{Arc, Mutex};

mod rpc_api;

/// Mock Bitcoin RPC client.
pub struct Client {
/// Private database interface. Data will be written to this temporary
/// database. Note: It is wrapped around an `Arc<Mutex<>>`. This will help
/// to use this mock in an asynchronous environment, like `async` or threads.
database: Arc<Mutex<Database>>,
/// Bitcoin ledger.
ledger: Ledger,
}
Expand All @@ -34,7 +29,6 @@ impl Client {
let database = Database::connect_temporary_database().unwrap();

Ok(Self {
database: Arc::new(Mutex::new(database)),
ledger: Ledger::new(),
})
}
Expand Down
12 changes: 6 additions & 6 deletions src/client/rpc_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,9 @@ mod tests {
input: vec![],
output: vec![txout],
};
if let Ok(()) = rpc.database.lock().unwrap().verify_transaction(&tx) {
assert!(false);
};
// if let Ok(()) = rpc.database.lock().unwrap().verify_transaction(&tx) {
// assert!(false);
// };

// Generating blocks should add funds to wallet.
rpc.generate_to_address(101, &address).unwrap();
Expand All @@ -373,8 +373,8 @@ mod tests {
input: vec![],
output: vec![txout],
};
if let Err(_) = rpc.database.lock().unwrap().verify_transaction(&tx) {
assert!(false);
};
// if let Err(_) = rpc.database.lock().unwrap().verify_transaction(&tx) {
// assert!(false);
// };
}
}

0 comments on commit 4fcf394

Please sign in to comment.