Skip to content

Commit 439e470

Browse files
authored
Enable redb quick-repair mode (ordinals#4084)
1 parent b9a4e06 commit 439e470

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mime_guess = "2.0.4"
5050
miniscript = "12.0.0"
5151
mp4 = "0.14.0"
5252
ordinals = { version = "0.0.13", path = "crates/ordinals" }
53-
redb = "2.2.0"
53+
redb = "2.3.0"
5454
ref-cast = "1.0.23"
5555
regex = "1.6.0"
5656
reqwest = { version = "0.11.27", features = ["blocking", "json"] }

src/index.rs

+2
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ impl Index {
303303
let mut tx = database.begin_write()?;
304304

305305
tx.set_durability(durability);
306+
tx.set_quick_repair(true);
306307

307308
tx.open_multimap_table(SAT_TO_SEQUENCE_NUMBER)?;
308309
tx.open_multimap_table(SCRIPT_PUBKEY_TO_OUTPOINT)?;
@@ -773,6 +774,7 @@ impl Index {
773774
fn begin_write(&self) -> Result<WriteTransaction> {
774775
let mut tx = self.database.begin_write()?;
775776
tx.set_durability(self.durability);
777+
tx.set_quick_repair(true);
776778
Ok(tx)
777779
}
778780

src/wallet.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,8 @@ impl Wallet {
664664
{
665665
let database = Database::builder().create(&path)?;
666666

667-
let tx = database.begin_write()?;
667+
let mut tx = database.begin_write()?;
668+
tx.set_quick_repair(true);
668669

669670
tx.open_table(RUNE_TO_ETCHING)?;
670671

@@ -688,7 +689,8 @@ impl Wallet {
688689
reveal: &Transaction,
689690
output: batch::Output,
690691
) -> Result {
691-
let wtx = self.database.begin_write()?;
692+
let mut wtx = self.database.begin_write()?;
693+
wtx.set_quick_repair(true);
692694

693695
wtx.open_table(RUNE_TO_ETCHING)?.insert(
694696
rune.0,
@@ -717,7 +719,8 @@ impl Wallet {
717719
}
718720

719721
pub(crate) fn clear_etching(&self, rune: Rune) -> Result {
720-
let wtx = self.database.begin_write()?;
722+
let mut wtx = self.database.begin_write()?;
723+
wtx.set_quick_repair(true);
721724

722725
wtx.open_table(RUNE_TO_ETCHING)?.remove(rune.0)?;
723726
wtx.commit()?;

0 commit comments

Comments
 (0)