Skip to content

Commit

Permalink
fix: retrieve inscriptions from cache
Browse files Browse the repository at this point in the history
  • Loading branch information
hertarr committed Sep 24, 2023
1 parent 7f25841 commit 0b94c4b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install Rust Toolchain Components
uses: actions-rs/toolchain@v1
with:
components: clippy, rustfmt
override: true
toolchain: stable

- uses: Swatinem/rust-cache@v2

- name: Format
run: cargo fmt --all -- --check
17 changes: 11 additions & 6 deletions src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,17 @@ impl<'block> InscriptionUpdater<'block> {
}

let previous_output = format!("{}:{}", tx_in.outpoint.txid, tx_in.outpoint.index);
let inscriptions_str_at_output = self
.output_inscription
.get(previous_output.as_bytes())
.unwrap_or_default();

let inscriptions_str = String::from_utf8(inscriptions_str_at_output)?;
let inscriptions_str = self
.output_inscription_cache
.entry(previous_output.clone())
.or_insert_with(|| {
String::from_utf8(
self.output_inscription
.get(previous_output.as_bytes())
.unwrap_or_default(),
)
.unwrap()
});
if inscriptions_str != "" {
for (inscription_id, inscription_offset) in
inscriptions_str
Expand Down

0 comments on commit 0b94c4b

Please sign in to comment.