Skip to content

Commit

Permalink
Remove unused functionality (ordinals#270)
Browse files Browse the repository at this point in the history
- The paper wallet functions were for the ordinals workshop, and nobody
  should be using them for anything serious.
- The benchmark was against an old version of ord that read blocks from
  bitcoind's blocks directory, so it doesn't even work.
- There were a bunch of unused dependencies.
- bitcoin provides bitcoin_hashes as a reexport, so we don't need to
  import it ourselves
- Use jsonrpc from bitcoin core
  • Loading branch information
casey authored Jul 29, 2022
1 parent b748943 commit db316dc
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 730 deletions.
535 changes: 54 additions & 481 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 3 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,38 @@ anyhow = { version = "1.0.56", features = ["backtrace"] }
axum = "0.5.6"
axum-server = "0.4.0"
bdk = { version = "0.20.0", features = ["keys-bip39", "sqlite"] }
bech32 = "0.9.0"
bitcoin = "0.28.1"
bitcoin_hashes = "0.11.0"
bitcoincore-rpc = "0.15.0"
chrono = "0.4.19"
clap = { version = "3.1.0", features = ["derive"] }
ctrlc = "3.2.1"
derive_more = "0.99.17"
dirs = "4.0.0"
env_logger = "0.9.0"
executable-path = "1.0.0"
http = "0.2.6"
jsonrpc = "0.12.1"
lazy_static = "1.4.0"
log = "0.4.14"
qrcode-generator = "4.1.6"
rayon = "1.5.1"
redb = "0.3.1"
reqwest = { version = "0.11.10", features = ["blocking", "json"] }
redb = "0.4.0"
serde = { version = "1.0.137", features = ["derive"] }
serde_cbor = "0.11.2"
serde_json = "1.0.81"
tokio = { version = "1.17.0", features = ["rt-multi-thread"] }
tower-http = { version = "0.3.3", features = ["cors"] }

[dev-dependencies]
criterion = "0.3.5"
executable-path = "1.0.0"
hex = "0.4.3"
jsonrpc-core = "18.0.0"
jsonrpc-core-client = "18.0.0"
jsonrpc-derive = "18.0.0"
jsonrpc-http-server = "18.0.0"
nix = "0.24.1"
regex = "1.5.4"
reqwest = { version = "0.11.9", features = ["blocking"] }
reqwest = { version = "0.11.10", features = ["blocking"] }
tempfile = "3.2.0"
unindent = "0.1.7"

[[test]]
name = "integration"
path = "tests/lib.rs"

[[bench]]
name = "index"
harness = false
87 changes: 0 additions & 87 deletions benches/index.rs

This file was deleted.

4 changes: 2 additions & 2 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ impl Index {
pub(crate) fn block(&self, height: u64) -> Result<Option<Block>> {
match self.client.get_block_hash(height) {
Ok(hash) => Ok(Some(self.client.get_block(&hash)?)),
Err(bitcoincore_rpc::Error::JsonRpc(jsonrpc::error::Error::Rpc(
jsonrpc::error::RpcError { code: -8, .. },
Err(bitcoincore_rpc::Error::JsonRpc(bitcoincore_rpc::jsonrpc::error::Error::Rpc(
bitcoincore_rpc::jsonrpc::error::RpcError { code: -8, .. },
))) => Ok(None),
Err(err) => Err(err.into()),
}
Expand Down
10 changes: 4 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,25 @@ use {
wallet::AddressIndex::LastUnused,
KeychainKind,
},
bech32::{FromBase32, ToBase32},
bitcoin::{
blockdata::constants::COIN_VALUE,
consensus::Decodable,
consensus::Encodable,
hashes::{sha256, Hash, HashEngine},
secp256k1::{
self,
rand::{self, thread_rng},
schnorr::Signature,
KeyPair, Secp256k1, SecretKey, XOnlyPublicKey,
KeyPair, Secp256k1, XOnlyPublicKey,
},
util::key::PrivateKey,
Address, Block, Network, OutPoint, Transaction, Txid,
Block, Network, OutPoint, Transaction, Txid,
},
bitcoin_hashes::{sha256, Hash, HashEngine},
chrono::{DateTime, NaiveDateTime, Utc},
clap::Parser,
derive_more::{Display, FromStr},
dirs::data_dir,
lazy_static::lazy_static,
qrcode_generator::QrCodeEcc,
redb::{Database, ReadableTable, Table, TableDefinition, WriteTransaction},
serde::{Deserialize, Serialize},
std::{
Expand All @@ -44,7 +42,7 @@ use {
env,
fmt::{self, Display, Formatter},
fs,
io::{self, BufRead, Write},
io::{self, Write},
net::ToSocketAddrs,
ops::{Add, AddAssign, Deref, Sub},
path::PathBuf,
Expand Down
6 changes: 0 additions & 6 deletions src/subcommand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use super::*;

mod epochs;
mod find;
mod generate_paper_wallets;
mod generate_private_key;
mod index;
mod info;
mod list;
Expand All @@ -20,8 +18,6 @@ mod wallet;
pub(crate) enum Subcommand {
Epochs,
Find(find::Find),
GeneratePaperWallets,
GeneratePrivateKey,
Index,
Info,
List(list::List),
Expand All @@ -41,8 +37,6 @@ impl Subcommand {
match self {
Self::Epochs => epochs::run(),
Self::Find(find) => find.run(options),
Self::GeneratePaperWallets => generate_paper_wallets::run(),
Self::GeneratePrivateKey => generate_private_key::run(),
Self::Index => index::run(options),
Self::Info => info::run(options),
Self::List(list) => list.run(options),
Expand Down
120 changes: 0 additions & 120 deletions src/subcommand/generate_paper_wallets.rs

This file was deleted.

15 changes: 0 additions & 15 deletions src/subcommand/generate_private_key.rs

This file was deleted.

0 comments on commit db316dc

Please sign in to comment.