fix(asb): Allow history command to be run while asb is running (#1724)

Co-authored-by: einliterflasche <einliterflasche@pm.me>
This commit is contained in:
binarybaron 2024-07-23 14:52:01 +02:00 committed by GitHub
parent ef49b471d8
commit c80bdb2d8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 55 additions and 18 deletions

View file

@ -16,7 +16,7 @@ use std::sync::Arc;
use std::time::Duration;
use swap::asb::FixedRate;
use swap::bitcoin::{CancelTimelock, PunishTimelock, TxCancel, TxPunish, TxRedeem, TxRefund};
use swap::database::SqliteDatabase;
use swap::database::{AccessMode, SqliteDatabase};
use swap::env::{Config, GetConfig};
use swap::fs::ensure_directory_exists;
use swap::network::rendezvous::XmrBtcNamespace;
@ -231,7 +231,11 @@ async fn start_alice(
if !&db_path.exists() {
tokio::fs::File::create(&db_path).await.unwrap();
}
let db = Arc::new(SqliteDatabase::open(db_path.as_path()).await.unwrap());
let db = Arc::new(
SqliteDatabase::open(db_path.as_path(), AccessMode::ReadWrite)
.await
.unwrap(),
);
let min_buy = bitcoin::Amount::from_sat(u64::MIN);
let max_buy = bitcoin::Amount::from_sat(u64::MAX);
@ -433,7 +437,7 @@ impl BobParams {
if !self.db_path.exists() {
tokio::fs::File::create(&self.db_path).await?;
}
let db = Arc::new(SqliteDatabase::open(&self.db_path).await?);
let db = Arc::new(SqliteDatabase::open(&self.db_path, AccessMode::ReadWrite).await?);
let (event_loop, handle) = self.new_eventloop(swap_id, db.clone()).await?;
@ -463,7 +467,7 @@ impl BobParams {
if !self.db_path.exists() {
tokio::fs::File::create(&self.db_path).await?;
}
let db = Arc::new(SqliteDatabase::open(&self.db_path).await?);
let db = Arc::new(SqliteDatabase::open(&self.db_path, AccessMode::ReadWrite).await?);
let (event_loop, handle) = self.new_eventloop(swap_id, db.clone()).await?;