diff --git a/src/index.rs b/src/index.rs index 1637a91ca5..19ed068d25 100644 --- a/src/index.rs +++ b/src/index.rs @@ -346,13 +346,6 @@ impl Index { #[cfg(test)] pub(crate) fn statistic(&self, statistic: Statistic) -> Result { - if matches!( - statistic, - Statistic::OutputsTraversed | Statistic::OrdinalRanges - ) { - self.require_ordinal_index("statistic")?; - } - Ok( self .database diff --git a/tests/info.rs b/tests/info.rs index 523108d9cf..91176f1b4b 100644 --- a/tests/info.rs +++ b/tests/info.rs @@ -1,7 +1,7 @@ use super::*; #[test] -fn json() { +fn json_with_ordinal_index() { let rpc_server = test_bitcoincore_rpc::spawn(); CommandBuilder::new("--index-ordinals info") .rpc_server(&rpc_server) @@ -11,6 +11,17 @@ fn json() { .run(); } +#[test] +fn json_without_ordinal_index() { + let rpc_server = test_bitcoincore_rpc::spawn(); + CommandBuilder::new("info") + .rpc_server(&rpc_server) + .stdout_regex( + r#"\{"blocks_indexed":1,"branch_pages":\d+,"fragmented_bytes":\d+,"index_file_size":\d+,"leaf_pages":\d+,"metadata_bytes":\d+,"ordinal_ranges":0,"outputs_traversed":0,"page_size":\d+,"stored_bytes":\d+,"transactions":\[\{"starting_block_count":0,"starting_timestamp":\d+\}\],"tree_height":\d+,"utxos_indexed":0\}"# + ) + .run(); +} + #[test] fn transactions() { let rpc_server = test_bitcoincore_rpc::spawn(); @@ -20,7 +31,7 @@ fn transactions() { let index_path = tempdir.path().join("index.redb"); CommandBuilder::new(format!( - "--index-ordinals --index {} info --transactions", + "--index {} info --transactions", index_path.display() )) .rpc_server(&rpc_server) @@ -30,7 +41,7 @@ fn transactions() { rpc_server.mine_blocks(10); CommandBuilder::new(format!( - "--index-ordinals --index {} info --transactions", + "--index {} info --transactions", index_path.display() )) .rpc_server(&rpc_server) @@ -40,7 +51,7 @@ fn transactions() { rpc_server.mine_blocks(10); CommandBuilder::new(format!( - "--index-ordinals --index {} info --transactions", + "--index {} info --transactions", index_path.display() )) .rpc_server(&rpc_server) diff --git a/tests/server.rs b/tests/server.rs index c592c323bc..a44b4a449b 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -64,7 +64,7 @@ HELLOWORLD.*", ), ); - let ord_server = TestServer::spawn_with_args(&rpc_server, &["--index-ordinals"]); + let ord_server = TestServer::spawn_with_args(&rpc_server, &[]); ord_server.assert_response_regex( &format!("/inscription/{}", reveal_tx), &format!(