Skip to content

Commit

Permalink
- precursed area concept not required
Browse files Browse the repository at this point in the history
  • Loading branch information
ordinally committed Jun 23, 2023
1 parent 466a1ba commit 9ddfe32
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 25 deletions.
11 changes: 0 additions & 11 deletions src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@ impl Chain {
}
}

pub(crate) fn cursed_era_start_height(self) -> u64 {
// deployment block height for ord 0.6.0 introducing cursed inscriptions on ordinals.com - everything before that is precursed.
// TODO: this is mainnet only, need to make this configurable
match self {
Self::Mainnet => 792_876,
Self::Regtest => 11,
Self::Signet => 38332, // FIXME
Self::Testnet => 18332,
}
}

pub(crate) fn inscription_content_size_limit(self) -> Option<usize> {
match self {
Self::Mainnet | Self::Regtest => None,
Expand Down
4 changes: 0 additions & 4 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,6 @@ impl Index {
})
}

pub(crate) fn chain(&self) -> Chain {
self.options.chain()
}

pub(crate) fn get_unspent_outputs(&self, _wallet: Wallet) -> Result<BTreeMap<OutPoint, Amount>> {
let mut utxos = BTreeMap::new();
utxos.extend(
Expand Down
3 changes: 0 additions & 3 deletions src/index/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pub(crate) struct Updater {
outputs_cached: u64,
outputs_inserted_since_flush: u64,
outputs_traversed: u64,
chain: Chain,
}

impl Updater {
Expand Down Expand Up @@ -70,7 +69,6 @@ impl Updater {
outputs_cached: 0,
outputs_inserted_since_flush: 0,
outputs_traversed: 0,
chain: index.chain(),
};

updater.update_index(index, wtx)
Expand Down Expand Up @@ -439,7 +437,6 @@ impl Updater {
block.header.time,
unbound_inscriptions,
value_cache,
self.chain,
)?;

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

impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> {
Expand All @@ -61,7 +60,6 @@ impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> {
timestamp: u32,
unbound_inscriptions: u64,
value_cache: &'a mut HashMap<OutPoint, u64>,
chain: Chain,
) -> Result<Self> {
let next_cursed_number = number_to_id
.iter()?
Expand Down Expand Up @@ -94,7 +92,6 @@ impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> {
timestamp,
unbound_inscriptions,
value_cache,
chain,
})
}

Expand Down Expand Up @@ -203,22 +200,21 @@ impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> {
.and_then(|(_id, count)| Some(count == &0))
.unwrap_or(false);

let initial_inscription_is_precursed = inscribed_offsets
let initial_inscription_is_cursed = inscribed_offsets
.get(&offset)
.and_then(|(inscription_id, _count)| {
match self.id_to_entry.get(&inscription_id.store()) {
Ok(option) => option.map(|entry| {
let loaded_entry = InscriptionEntry::load(entry.value());
loaded_entry.number < 0
&& loaded_entry.height < self.chain.cursed_era_start_height()
}),
Err(_) => None,
}
})
.unwrap_or(false);
log::info!("{inscription_id}: is first reinscription: {first_reinscription}, initial inscription is precursed: {initial_inscription_is_precursed}");
log::info!("{inscription_id}: is first reinscription: {first_reinscription}, initial inscription is cursed: {initial_inscription_is_cursed}");

!(initial_inscription_is_precursed && first_reinscription)
!(initial_inscription_is_cursed && first_reinscription)
} else {
curse != inscription::CursedType::NotCursed
};
Expand Down

0 comments on commit 9ddfe32

Please sign in to comment.