Skip to content

Commit

Permalink
fix: cursed inscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
hertarr committed Sep 26, 2023
1 parent 9aaad3b commit 8a7f7d7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ordi

`ordi` is a light indexer for building ordinals data source.
`ordi` is a fast light indexer for building ordinals data source.

## Usage

Expand Down
30 changes: 21 additions & 9 deletions src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,22 @@ impl<'block> InscriptionUpdater<'block> {
}

let previous_output = format!("{}:{}", tx_in.outpoint.txid, tx_in.outpoint.index);
let inscriptions_str = self
.output_inscription_cache
.entry(previous_output.clone())
.or_insert_with(|| {
String::from_utf8(
let inscriptions_str = match self.output_inscription_cache.get(&previous_output) {
Some(inscriptions) => inscriptions.clone(),
None => {
let value = String::from_utf8(
self.output_inscription
.get(previous_output.as_bytes())
.unwrap_or_default(),
)
.unwrap()
});
)?;
if value != "" {
self.output_inscription_cache
.insert(previous_output.clone(), value.clone());
}

value
}
};
if inscriptions_str != "" {
for (inscription_id, inscription_offset) in
inscriptions_str
Expand Down Expand Up @@ -327,7 +332,14 @@ impl<'block> InscriptionUpdater<'block> {
})
.unwrap();

!(first_reinscription && initial_inscription_is_cursed)
let cursed = !(first_reinscription && initial_inscription_is_cursed);
info!(
"new_inscription: {}, reinscription: {}, first_reinscription: {}, initial_inscription_is_cursed: {}",
&inscription_id,
cursed, first_reinscription,
initial_inscription_is_cursed
);
cursed
} else {
curse.is_some()
};
Expand Down

0 comments on commit 8a7f7d7

Please sign in to comment.