diff --git a/deploy/ord-dev.service b/deploy/ord-dev.service index b1b3689e53..8b416d37ec 100644 --- a/deploy/ord-dev.service +++ b/deploy/ord-dev.service @@ -12,7 +12,7 @@ ExecStart=/usr/local/bin/ord-dev \ --bitcoin-data-dir /var/lib/bitcoind \ --chain ${CHAIN} \ --data-dir /var/lib/ord-dev \ - --index-satoshis \ + --index-sats \ server \ --http-port 8080 Group=ord diff --git a/deploy/ord.service b/deploy/ord.service index 5674708bfe..9dda830b8d 100644 --- a/deploy/ord.service +++ b/deploy/ord.service @@ -12,7 +12,7 @@ ExecStart=/usr/local/bin/ord \ --bitcoin-data-dir /var/lib/bitcoind \ --data-dir /var/lib/ord \ --chain ${CHAIN} \ - --index-satoshis \ + --index-sats \ server \ --acme-contact mailto:casey@rodarmor.com \ --http \ diff --git a/docs/src/guides/sat-hunting.md b/docs/src/guides/sat-hunting.md index 14a239a997..0e21420b3e 100644 --- a/docs/src/guides/sat-hunting.md +++ b/docs/src/guides/sat-hunting.md @@ -2,9 +2,9 @@ Ordinal Hunting =============== *This guide is out of date. Since it was written, the `ord` binary was changed -to only build the full satoshi index when the `--index-satoshis` flag is -supplied. Additionally, `ord` now has a built-in wallet that wraps a Bitcoin -Core wallet. See `ord wallet --help`.* +to only build the full satoshi index when the `--index-sats` flag is supplied. +Additionally, `ord` now has a built-in wallet that wraps a Bitcoin Core wallet. +See `ord wallet --help`.* Ordinal hunting is difficult but rewarding. The feeling of owning a wallet full of UTXOs, redolent with the scent of rare and exotic sats, is beyond compare. diff --git a/src/index.rs b/src/index.rs index 88335e4afe..8ddf6cc6b7 100644 --- a/src/index.rs +++ b/src/index.rs @@ -210,7 +210,7 @@ impl Index { tx.open_table(STATISTIC_TO_COUNT)?; tx.open_table(WRITE_TRANSACTION_STARTING_BLOCK_COUNT_TO_TIMESTAMP)?; - if options.index_satoshis { + if options.index_sats { tx.open_table(OUTPOINT_TO_SAT_RANGES)?; } @@ -248,7 +248,7 @@ impl Index { fn require_satoshi_index(&self, feature: &str) -> Result { if !self.has_satoshi_index()? { - bail!("{feature} requires index created with `--index-satoshis` flag") + bail!("{feature} requires index created with `--index-sats` flag") } Ok(()) @@ -662,7 +662,7 @@ mod tests { #[test] fn list_first_coinbase_transaction() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); assert_eq!( context .index @@ -679,7 +679,7 @@ mod tests { #[test] fn list_second_coinbase_transaction() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); let txid = context.rpc_server.mine_blocks(1)[0].txdata[0].txid(); context.index.update().unwrap(); assert_eq!( @@ -690,7 +690,7 @@ mod tests { #[test] fn list_split_ranges_are_tracked_correctly() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); context.rpc_server.mine_blocks(1); let split_coinbase_output = TransactionTemplate { @@ -716,7 +716,7 @@ mod tests { #[test] fn list_merge_ranges_are_tracked_correctly() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); context.rpc_server.mine_blocks(2); let merge_coinbase_outputs = TransactionTemplate { @@ -740,7 +740,7 @@ mod tests { #[test] fn list_fee_paying_transaction_range() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); context.rpc_server.mine_blocks(1); let fee_paying_tx = TransactionTemplate { @@ -774,7 +774,7 @@ mod tests { #[test] fn list_two_fee_paying_transaction_range() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); context.rpc_server.mine_blocks(2); let first_fee_paying_tx = TransactionTemplate { @@ -809,7 +809,7 @@ mod tests { #[test] fn list_null_output() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); context.rpc_server.mine_blocks(1); let no_value_output = TransactionTemplate { @@ -829,7 +829,7 @@ mod tests { #[test] fn list_null_input() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); context.rpc_server.mine_blocks(1); let no_value_output = TransactionTemplate { @@ -857,7 +857,7 @@ mod tests { #[test] fn list_spent_output() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); context.rpc_server.mine_blocks(1); context.rpc_server.broadcast_tx(TransactionTemplate { input_slots: &[(1, 0, 0)], @@ -875,7 +875,7 @@ mod tests { #[test] fn list_unknown_output() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); assert_eq!( context @@ -892,7 +892,7 @@ mod tests { #[test] fn find_first_sat() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); assert_eq!( context.index.find(0).unwrap().unwrap(), SatPoint { @@ -906,7 +906,7 @@ mod tests { #[test] fn find_second_sat() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); assert_eq!( context.index.find(1).unwrap().unwrap(), SatPoint { @@ -920,7 +920,7 @@ mod tests { #[test] fn find_first_sat_of_second_block() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); context.rpc_server.mine_blocks(1); context.index.update().unwrap(); assert_eq!( @@ -936,13 +936,13 @@ mod tests { #[test] fn find_unmined_sat() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); assert_eq!(context.index.find(50 * COIN_VALUE).unwrap(), None); } #[test] fn find_first_satoshi_spent_in_second_block() { - let context = Context::with_args("--index-satoshis"); + let context = Context::with_args("--index-sats"); context.rpc_server.mine_blocks(1); let spend_txid = context.rpc_server.broadcast_tx(TransactionTemplate { input_slots: &[(1, 0, 0)], diff --git a/src/index/updater.rs b/src/index/updater.rs index 56995fd621..94f7d32126 100644 --- a/src/index/updater.rs +++ b/src/index/updater.rs @@ -24,7 +24,7 @@ impl From for BlockData { pub struct Updater { cache: HashMap>, height: u64, - index_satoshis: bool, + index_sats: bool, sat_ranges_since_flush: u64, outputs_cached: u64, outputs_inserted_since_flush: u64, @@ -56,7 +56,7 @@ impl Updater { let mut updater = Self { cache: HashMap::new(), height, - index_satoshis: index.has_satoshi_index()?, + index_sats: index.has_satoshi_index()?, sat_ranges_since_flush: 0, outputs_cached: 0, outputs_inserted_since_flush: 0, @@ -90,7 +90,7 @@ impl Updater { Some(progress_bar) }; - let rx = Self::fetch_blocks_from(index, self.height, self.index_satoshis)?; + let rx = Self::fetch_blocks_from(index, self.height, self.index_sats)?; let mut uncommitted = 0; loop { @@ -157,7 +157,7 @@ impl Updater { fn fetch_blocks_from( index: &Index, mut height: u64, - index_satoshis: bool, + index_sats: bool, ) -> Result> { let (tx, rx) = mpsc::sync_channel(32); @@ -166,7 +166,7 @@ impl Updater { let client = Client::new(&index.rpc_url, index.auth.clone()).context("failed to connect to RPC URL")?; - let with_transactions = index_satoshis || index.chain != Chain::Mainnet; + let with_transactions = index_sats || index.chain != Chain::Mainnet; thread::spawn(move || loop { if let Some(height_limit) = height_limit { @@ -272,7 +272,7 @@ impl Updater { let mut inscription_id_to_satpoint = wtx.open_table(INSCRIPTION_ID_TO_SATPOINT)?; let mut satpoint_to_inscription_id = wtx.open_table(SATPOINT_TO_INSCRIPTION_ID)?; - if self.index_satoshis { + if self.index_sats { let mut sat_to_inscription_id = wtx.open_table(SAT_TO_INSCRIPTION_ID)?; let mut sat_to_satpoint = wtx.open_table(SAT_TO_SATPOINT)?; let mut outpoint_to_sat_ranges = wtx.open_table(OUTPOINT_TO_SAT_RANGES)?; @@ -504,7 +504,7 @@ impl Updater { self.outputs_cached ); - if self.index_satoshis { + if self.index_sats { log::info!( "Flushing {} entries ({:.1}% resulting from {} insertions) from memory to database", self.cache.len(), diff --git a/src/options.rs b/src/options.rs index 2dc140e778..180b6af7f7 100644 --- a/src/options.rs +++ b/src/options.rs @@ -23,7 +23,7 @@ pub(crate) struct Options { #[clap(long, help = "Use index at .")] pub(crate) index: Option, #[clap(long, help = "Index current location of all satoshis.")] - pub(crate) index_satoshis: bool, + pub(crate) index_sats: bool, #[clap(long, help = "Use regtest.")] regtest: bool, #[clap(long, help = "Connect to Bitcoin Core RPC at .")] diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index ae8d14a3db..ca2716f85b 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -398,7 +398,7 @@ impl Server { .map_err(|err| ServerError::Internal(anyhow!("error getting rare sat satpoints: {err}")))? .ok_or_else(|| { ServerError::NotFound( - "tracking rare sats requires index created with `--index-satoshis` flag".into(), + "tracking rare sats requires index created with `--index-sats` flag".into(), ) })?, )) @@ -1174,7 +1174,7 @@ mod tests { #[test] fn output_with_satoshi_index() { - TestServer::new_with_args(&["--index-satoshis"]).assert_response_regex( + TestServer::new_with_args(&["--index-sats"]).assert_response_regex( "/output/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0", StatusCode::OK, ".*Output 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0.*

Output 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0

@@ -1422,7 +1422,7 @@ next.*", #[test] fn rare_with_index() { - TestServer::new_with_args(&["--index-satoshis"]).assert_response( + TestServer::new_with_args(&["--index-sats"]).assert_response( "/rare.txt", StatusCode::OK, "sat\tsatpoint @@ -1436,13 +1436,13 @@ next.*", TestServer::new_with_args(&[]).assert_response( "/rare.txt", StatusCode::NOT_FOUND, - "tracking rare sats requires index created with `--index-satoshis` flag", + "tracking rare sats requires index created with `--index-sats` flag", ); } #[test] fn show_rare_txt_in_header_with_satoshi_index() { - TestServer::new_with_args(&["--index-satoshis"]).assert_response_regex( + TestServer::new_with_args(&["--index-sats"]).assert_response_regex( "/", StatusCode::OK, ".* @@ -1535,7 +1535,7 @@ next.*", #[test] fn outputs_traversed_are_tracked() { - let server = TestServer::new_with_args(&["--index-satoshis"]); + let server = TestServer::new_with_args(&["--index-sats"]); assert_eq!( server @@ -1571,7 +1571,7 @@ next.*", #[test] fn coinbase_sat_ranges_are_tracked() { - let server = TestServer::new_with_args(&["--index-satoshis"]); + let server = TestServer::new_with_args(&["--index-sats"]); assert_eq!( server @@ -1606,7 +1606,7 @@ next.*", #[test] fn split_sat_ranges_are_tracked() { - let server = TestServer::new_with_args(&["--index-satoshis"]); + let server = TestServer::new_with_args(&["--index-sats"]); assert_eq!( server @@ -1636,7 +1636,7 @@ next.*", #[test] fn fee_sat_ranges_are_tracked() { - let server = TestServer::new_with_args(&["--index-satoshis"]); + let server = TestServer::new_with_args(&["--index-sats"]); assert_eq!( server diff --git a/tests/find.rs b/tests/find.rs index aaa2551dc4..04474560c0 100644 --- a/tests/find.rs +++ b/tests/find.rs @@ -3,7 +3,7 @@ use super::*; #[test] fn find_command_returns_satpoint_for_sat() { let rpc_server = test_bitcoincore_rpc::spawn(); - CommandBuilder::new("--index-satoshis find 0") + CommandBuilder::new("--index-sats find 0") .rpc_server(&rpc_server) .expected_stdout("4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0:0\n") .run(); @@ -12,7 +12,7 @@ fn find_command_returns_satpoint_for_sat() { #[test] fn unmined_sat() { let rpc_server = test_bitcoincore_rpc::spawn(); - CommandBuilder::new("--index-satoshis find 5000000000") + CommandBuilder::new("--index-sats find 5000000000") .rpc_server(&rpc_server) .expected_stderr("error: sat has not been mined as of index height\n") .expected_exit_code(1) @@ -24,7 +24,7 @@ fn no_satoshi_index() { let rpc_server = test_bitcoincore_rpc::spawn(); CommandBuilder::new("find 0") .rpc_server(&rpc_server) - .expected_stderr("error: find requires index created with `--index-satoshis` flag\n") + .expected_stderr("error: find requires index created with `--index-sats` flag\n") .expected_exit_code(1) .run(); } diff --git a/tests/info.rs b/tests/info.rs index ea6fb0d6e9..e780bab538 100644 --- a/tests/info.rs +++ b/tests/info.rs @@ -3,7 +3,7 @@ use super::*; #[test] fn json_with_satoshi_index() { let rpc_server = test_bitcoincore_rpc::spawn(); - CommandBuilder::new("--index-satoshis info") + CommandBuilder::new("--index-sats 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+,"sat_ranges":1,"outputs_traversed":1,"page_size":\d+,"stored_bytes":\d+,"transactions":\[\{"starting_block_count":0,"starting_timestamp":\d+\}\],"tree_height":\d+,"utxos_indexed":1\}"# diff --git a/tests/list.rs b/tests/list.rs index 491e830949..646b99ad13 100644 --- a/tests/list.rs +++ b/tests/list.rs @@ -4,7 +4,7 @@ use super::*; fn output_found() { let rpc_server = test_bitcoincore_rpc::spawn(); CommandBuilder::new( - "--index-satoshis list 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0", + "--index-sats list 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0", ) .rpc_server(&rpc_server) .expected_stdout("4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0\t0\t5000000000\tmythic\tnvtdijuwxlp\n") @@ -15,7 +15,7 @@ fn output_found() { fn output_not_found() { let rpc_server = test_bitcoincore_rpc::spawn(); CommandBuilder::new( - "--index-satoshis list 0000000000000000000000000000000000000000000000000000000000000000:0", + "--index-sats list 0000000000000000000000000000000000000000000000000000000000000000:0", ) .rpc_server(&rpc_server) .expected_exit_code(1) @@ -28,7 +28,7 @@ fn no_satoshi_index() { let rpc_server = test_bitcoincore_rpc::spawn(); CommandBuilder::new("list 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0") .rpc_server(&rpc_server) - .expected_stderr("error: list requires index created with `--index-satoshis` flag\n") + .expected_stderr("error: list requires index created with `--index-sats` flag\n") .expected_exit_code(1) .run(); } diff --git a/tests/wallet.rs b/tests/wallet.rs index d6e022c869..a50eef4d77 100644 --- a/tests/wallet.rs +++ b/tests/wallet.rs @@ -5,7 +5,7 @@ fn satoshis() { let rpc_server = test_bitcoincore_rpc::spawn(); let second_coinbase = rpc_server.mine_blocks(1)[0].txdata[0].txid(); - CommandBuilder::new("--index-satoshis wallet satoshis") + CommandBuilder::new("--index-sats wallet satoshis") .rpc_server(&rpc_server) .expected_stdout(format!( "{}\t{}\t0\tuncommon\n", @@ -20,7 +20,7 @@ fn satoshis_from_tsv_success() { let rpc_server = test_bitcoincore_rpc::spawn(); let second_coinbase = rpc_server.mine_blocks(1)[0].txdata[0].txid(); - CommandBuilder::new("--index-satoshis wallet satoshis --tsv foo.tsv") + CommandBuilder::new("--index-sats wallet satoshis --tsv foo.tsv") .write("foo.tsv", "nvtcsezkbtg") .rpc_server(&rpc_server) .expected_stdout(format!( @@ -60,7 +60,7 @@ fn send_works_on_signet() { let txid = rpc_server.mine_blocks(1)[0].txdata[0].txid(); let stdout = CommandBuilder::new(format!( - "--chain signet --index-satoshis wallet inscribe --satpoint {txid}:0:0 --file degenerate.png" + "--chain signet --index-sats wallet inscribe --satpoint {txid}:0:0 --file degenerate.png" )) .write("degenerate.png", [1; 520]) .rpc_server(&rpc_server) @@ -124,7 +124,7 @@ fn send_inscribed_sat() { let txid = rpc_server.mine_blocks(1)[0].txdata[0].txid(); let stdout = CommandBuilder::new(format!( - "--chain signet --index-satoshis wallet inscribe --satpoint {txid}:0:0 --file degenerate.png" + "--chain signet --index-sats wallet inscribe --satpoint {txid}:0:0 --file degenerate.png" )) .write("degenerate.png", [1; 520]) .rpc_server(&rpc_server) @@ -255,7 +255,7 @@ fn inscribe() { rpc_server.mine_blocks(1); - TestServer::spawn_with_args(&rpc_server, &["--index-satoshis"]).assert_response_regex( + TestServer::spawn_with_args(&rpc_server, &["--index-sats"]).assert_response_regex( "/sat/5000000000", ".*
inscription
\n
HELLOWORLD
.*", ); @@ -301,7 +301,7 @@ fn inscribe_png() { let txid = rpc_server.mine_blocks(1)[0].txdata[0].txid(); CommandBuilder::new(format!( - "--chain regtest --index-satoshis wallet inscribe --satpoint {txid}:0:0 --file degenerate.png" + "--chain regtest --index-sats wallet inscribe --satpoint {txid}:0:0 --file degenerate.png" )) .write("degenerate.png", [1; 520]) .rpc_server(&rpc_server) @@ -310,7 +310,7 @@ fn inscribe_png() { rpc_server.mine_blocks(1); - let ord_server = TestServer::spawn_with_args(&rpc_server, &["--index-satoshis"]); + let ord_server = TestServer::spawn_with_args(&rpc_server, &["--index-sats"]); ord_server.assert_response_regex( "/sat/5000000000", @@ -608,7 +608,7 @@ fn inscribe_with_optional_satpoint_arg() { rpc_server.mine_blocks(1); - TestServer::spawn_with_args(&rpc_server, &["--index-satoshis"]).assert_response_regex( + TestServer::spawn_with_args(&rpc_server, &["--index-sats"]).assert_response_regex( "/sat/5000000000", ".*
inscription
\n
HELLOWORLD
.*", );