Reorganise modules for multiple database implementations

This commit is contained in:
rishflab 2021-09-22 16:14:49 +10:00
parent 0e4891fcc0
commit a94c320021
15 changed files with 464 additions and 453 deletions

View file

@ -1,5 +1,5 @@
use crate::bitcoin::{parse_rpc_error_code, RpcErrorCode, Txid, Wallet};
use crate::database::{Database, Swap};
use crate::database::{SledDatabase, Swap};
use crate::protocol::bob::BobState;
use anyhow::{bail, Result};
use std::sync::Arc;
@ -8,7 +8,7 @@ use uuid::Uuid;
pub async fn cancel(
swap_id: Uuid,
bitcoin_wallet: Arc<Wallet>,
db: Database,
db: SledDatabase,
) -> Result<(Txid, BobState)> {
let state = db.get_state(swap_id)?.try_into_bob()?.into();

View file

@ -1,11 +1,15 @@
use crate::bitcoin::Wallet;
use crate::database::{Database, Swap};
use crate::database::{SledDatabase, Swap};
use crate::protocol::bob::BobState;
use anyhow::{bail, Result};
use std::sync::Arc;
use uuid::Uuid;
pub async fn refund(swap_id: Uuid, bitcoin_wallet: Arc<Wallet>, db: Database) -> Result<BobState> {
pub async fn refund(
swap_id: Uuid,
bitcoin_wallet: Arc<Wallet>,
db: SledDatabase,
) -> Result<BobState> {
let state = db.get_state(swap_id)?.try_into_bob()?.into();
let state6 = match state {