Skip to content

Commit

Permalink
Add first signet inscription height (#1016)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Dec 20, 2022
1 parent a2a1861 commit 334830a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ impl Chain {
match self {
Self::Mainnet => 767430,
Self::Regtest => 0,
Self::Signet => 112402,
Self::Testnet => 0,
Self::Signet => 0,
}
}

Expand Down
12 changes: 8 additions & 4 deletions src/index/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ impl Updater {
let client =
Client::new(&index.rpc_url, index.auth.clone()).context("failed to connect to RPC URL")?;

let chain = index.chain;
let first_inscription_height = if integration_test() {
0
} else {
index.chain.first_inscription_height()
};

thread::spawn(move || loop {
if let Some(height_limit) = height_limit {
Expand All @@ -175,7 +179,7 @@ impl Updater {
}
}

match Self::get_block_with_retries(&client, height, index_sats, chain) {
match Self::get_block_with_retries(&client, height, index_sats, first_inscription_height) {
Ok(Some(block)) => {
if let Err(err) = tx.send(block.into()) {
log::info!("Block receiver disconnected: {err}");
Expand All @@ -198,7 +202,7 @@ impl Updater {
client: &Client,
height: u64,
index_sats: bool,
chain: Chain,
first_inscription_height: u64,
) -> Result<Option<Block>> {
let mut errors = 0;
loop {
Expand All @@ -208,7 +212,7 @@ impl Updater {
.and_then(|option| {
option
.map(|hash| {
if index_sats || height >= chain.first_inscription_height() {
if index_sats || height >= first_inscription_height {
Ok(client.get_block(&hash)?)
} else {
Ok(Block {
Expand Down
1 change: 1 addition & 0 deletions tests/command_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ impl CommandBuilder {
}

command
.env("ORD_INTEGRATION_TEST", "1")
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
Expand Down

0 comments on commit 334830a

Please sign in to comment.