Skip to content

Commit

Permalink
Add --ignore-cursed flag to treat all cursed inscriptions as regula…
Browse files Browse the repository at this point in the history
…r inscriptions when indexing.
  • Loading branch information
gmart7t2 committed Nov 22, 2023
1 parent 8519c34 commit 2efe872
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/index/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ impl<'index> Updater<'_> {
block.header.time,
unbound_inscriptions,
value_cache,
index.options.ignore_cursed,
)?;

if self.index.index_sats {
Expand Down
7 changes: 6 additions & 1 deletion src/index/updater/inscription_updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub(super) struct InscriptionUpdater<'a, 'db, 'tx> {
timestamp: u32,
pub(super) unbound_inscriptions: u64,
value_cache: &'a mut HashMap<OutPoint, u64>,
pub(super) ignore_cursed: bool,
}

impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> {
Expand Down Expand Up @@ -75,6 +76,7 @@ impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> {
timestamp: u32,
unbound_inscriptions: u64,
value_cache: &'a mut HashMap<OutPoint, u64>,
ignore_cursed: bool,
) -> Result<Self> {
let next_sequence_number = sequence_number_to_id
.iter()?
Expand Down Expand Up @@ -104,6 +106,7 @@ impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> {
timestamp,
unbound_inscriptions,
value_cache,
ignore_cursed,
})
}

Expand Down Expand Up @@ -178,7 +181,9 @@ impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> {
index: id_counter,
};

let curse = if inscription.payload.unrecognized_even_field {
let curse = if self.ignore_cursed {
None
} else if inscription.payload.unrecognized_even_field {
Some(Curse::UnrecognizedEvenField)
} else if inscription.payload.duplicate_field {
Some(Curse::DuplicateField)
Expand Down
2 changes: 2 additions & 0 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ pub(crate) struct Options {
pub(crate) ignore_descriptors: bool,
#[arg(long, help = "Don't fail when the index is out of date. This is dangerous, and results in ord treating inscriptions as cardinals if their corresponding utxos haven't been indexed. Use at your own risk.")]
pub(crate) ignore_outdated_index: bool,
#[arg(long, help = "Treat cursed inscriptions as regular inscriptions when indexing. Be consistent; either specify this flag every time you use a given index file or never.")]
pub(crate) ignore_cursed: bool,
}

impl Options {
Expand Down

0 comments on commit 2efe872

Please sign in to comment.