Skip to content

Commit

Permalink
Add inscription index to /status (#3938)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Sep 9, 2024
1 parent a301eeb commit 1ae542f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,10 @@ impl Index {
self.index_addresses
}

pub fn has_inscription_index(&self) -> bool {
self.index_inscriptions
}

pub fn has_rune_index(&self) -> bool {
self.index_runes
}
Expand Down Expand Up @@ -512,6 +516,7 @@ impl Index {
cursed_inscriptions,
height,
initial_sync_time: Duration::from_micros(initial_sync_time),
inscription_index: self.has_inscription_index(),
inscriptions: blessed_inscriptions + cursed_inscriptions,
lost_sats: statistic(Statistic::LostSats)?,
minimum_rune_for_next_block: Rune::minimum_at_height(
Expand Down
2 changes: 2 additions & 0 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3556,6 +3556,8 @@ mod tests {
<dd>false</dd>
<dt>address index</dt>
<dd>false</dd>
<dt>inscription index</dt>
<dd>true</dd>
<dt>rune index</dt>
<dd>false</dd>
<dt>sat index</dt>
Expand Down
1 change: 1 addition & 0 deletions src/templates/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub struct StatusHtml {
pub cursed_inscriptions: u64,
pub height: Option<u32>,
pub initial_sync_time: Duration,
pub inscription_index: bool,
pub inscriptions: u64,
pub lost_sats: u64,
pub minimum_rune_for_next_block: Rune,
Expand Down
2 changes: 2 additions & 0 deletions templates/status.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ <h1>Status</h1>
<dd>{{ self.unrecoverably_reorged }}</dd>
<dt>address index</dt>
<dd>{{ self.address_index }}</dd>
<dt>inscription index</dt>
<dd>{{ self.inscription_index }}</dd>
<dt>rune index</dt>
<dd>{{ self.rune_index }}</dd>
<dt>sat index</dt>
Expand Down
1 change: 1 addition & 0 deletions tests/json_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ fn get_status() {
cursed_inscriptions: 0,
height: Some(3),
initial_sync_time: dummy_duration,
inscription_index: true,
inscriptions: 1,
lost_sats: 0,
minimum_rune_for_next_block: Rune(99218849511960410),
Expand Down

0 comments on commit 1ae542f

Please sign in to comment.