removed redundant adapter::new() constructor call

This commit is contained in:
rachel-rose
2021-06-27 10:04:36 +02:00
parent c78ec2edf3
commit c4851233ac
3 changed files with 6 additions and 5 deletions

View File

@@ -244,8 +244,9 @@ fn main() -> Result<()> {
])
.unwrap();
let adapter = RpcAdapter::new("wallet.db")?;
debug!(target: "DARKFID", "main() [ADAPTER CREATED]");
let ex2 = ex.clone();
let adapter = RpcAdapter::new("wallet.db")?;
let (_, result) = Parallel::new()
// Run four executor threads.

View File

@@ -11,6 +11,7 @@ pub struct RpcAdapter {
impl RpcAdapter {
pub fn new(dbname: &str) -> Result<Self> {
debug!(target: "ADAPTER", "new() [CREATING NEW WALLET]");
let wallet = WalletDB::new(dbname)?;
Ok(Self { wallet })
}

View File

@@ -74,9 +74,9 @@ pub async fn listen(
pub async fn start(
executor: Arc<Executor<'_>>,
options: Arc<ClientProgramOptions>,
_adapter: RpcAdapter,
adapter: RpcAdapter,
) -> Result<()> {
let rpc = RpcInterface::new()?;
let rpc = RpcInterface::new(adapter)?;
let http = listen(
executor.clone(),
rpc.clone(),
@@ -104,9 +104,8 @@ pub struct RpcInterface {
}
impl RpcInterface {
pub fn new() -> Result<Arc<Self>> {
pub fn new(adapter: RpcAdapter) -> Result<Arc<Self>> {
let (stop_send, stop_recv) = async_channel::unbounded::<()>();
let adapter = RpcAdapter::new("wallet.db")?;
Ok(Arc::new(Self {
//p2p,
started: Mutex::new(false),