Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bin/electrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn fetch_from(config: &Config, store: &Store) -> FetchFrom {

if jsonrpc_import {
// slower, uses JSONRPC (good for incremental updates)
FetchFrom::Bitcoind
FetchFrom::Tapyrusd
} else {
// faster, uses blk*.dat files (good for initial indexing)
FetchFrom::BlkFiles
Expand Down
2 changes: 1 addition & 1 deletion src/bin/tx-fingerprint-stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn main() {

let chain = ChainQuery::new(Arc::clone(&store), Arc::clone(&daemon), &config, &metrics);

let mut indexer = Indexer::open(Arc::clone(&store), FetchFrom::Bitcoind, &config, &metrics);
let mut indexer = Indexer::open(Arc::clone(&store), FetchFrom::Tapyrusd, &config, &metrics);
indexer.update(&daemon).unwrap();

let mut iter = store.txstore_db().raw_iterator();
Expand Down
19 changes: 10 additions & 9 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn str_to_socketaddr(address: &str, what: &str) -> SocketAddr {
impl Config {
pub fn from_args() -> Config {
let network_help = format!(
"Select Bitcoin network type ({})",
"Select tapyrus network type ({}) (default: prod)",
NetworkType::names().join(", ")
);

Expand All @@ -79,19 +79,19 @@ impl Config {
.arg(
Arg::with_name("daemon_dir")
.long("daemon-dir")
.help("Data directory of Bitcoind (default: ~/.bitcoin/)")
.help("Data directory of Tapyrusd (default: ~/.tapyrus/prod-1)")
.takes_value(true),
)
.arg(
Arg::with_name("blocks_dir")
.long("blocks-dir")
.help("Analogous to bitcoind's -blocksdir option, this specifies the directory containing the raw blocks files (blk*.dat) (default: ~/.bitcoin/blocks/)")
.help("Analogous to tapyrusd's -blocksdir option, this specifies the directory containing the raw blocks files (blk*.dat) (default: ~/.tapyrus/prod-1/blocks/)")
.takes_value(true),
)
.arg(
Arg::with_name("cookie")
.long("cookie")
.help("JSONRPC authentication cookie ('USER:PASSWORD', default: read from ~/.bitcoin/.cookie)")
.help("JSONRPC authentication cookie ('USER:PASSWORD', default: read from ~/.tapyrus/prod-1/.cookie)")
.takes_value(true),
)
.arg(
Expand All @@ -109,7 +109,7 @@ impl Config {
.arg(
Arg::with_name("network_id")
.long("network-id")
.help("Select tapyrus network id")
.help("Select tapyrus network id (default: 1)")
.takes_value(true),
)
.arg(
Expand All @@ -121,7 +121,7 @@ impl Config {
.arg(
Arg::with_name("daemon_rpc_addr")
.long("daemon-rpc-addr")
.help("Bitcoin daemon JSONRPC 'addr:port' to connect (default: 127.0.0.1:8332 for prod and 127.0.0.1:18443 for dev)")
.help("Tapyrus daemon JSONRPC 'addr:port' to connect (default: 127.0.0.1:2377 for prod and 127.0.0.1:12381 for dev)")
.takes_value(true),
)
.arg(
Expand Down Expand Up @@ -194,7 +194,7 @@ impl Config {

let m = args.get_matches();

let network_name = m.value_of("network").unwrap_or("mainnet");
let network_name = m.value_of("network").unwrap_or("prod");
let network_id = u32::from_str(m.value_of("network_id").unwrap_or("1"))
.expect("failed to get network id");
let network = Network::new(network_name, network_id);
Expand All @@ -221,7 +221,7 @@ impl Config {
let daemon_rpc_addr: SocketAddr = str_to_socketaddr(
m.value_of("daemon_rpc_addr")
.unwrap_or(&format!("127.0.0.1:{}", default_daemon_port)),
"Bitcoin RPC",
"Tapyrus RPC",
);
let electrum_rpc_addr: SocketAddr = str_to_socketaddr(
m.value_of("electrum_rpc_addr")
Expand All @@ -246,7 +246,8 @@ impl Config {
.map(PathBuf::from)
.unwrap_or_else(|| {
let mut default_dir = home_dir().expect("no homedir");
default_dir.push(".bitcoin");
default_dir.push(".tapyrus");
default_dir.push(format!("{}-{}", network_name, network_id));
default_dir
});
let blocks_dir = m
Expand Down
18 changes: 9 additions & 9 deletions src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub struct BlockchainInfo {
struct NetworkInfo {
version: u64,
subversion: String,
relayfee: f64, // in BTC/kB
relayfee: f64, // in TPC/kB
}

pub trait CookieGetter: Send + Sync {
Expand Down Expand Up @@ -290,11 +290,11 @@ impl Daemon {
message_id: Counter::new(),
signal: signal.clone(),
latency: metrics.histogram_vec(
HistogramOpts::new("daemon_rpc", "Bitcoind RPC latency (in seconds)"),
HistogramOpts::new("daemon_rpc", "Tapyrusd RPC latency (in seconds)"),
&["method"],
),
size: metrics.histogram_vec(
HistogramOpts::new("daemon_bytes", "Bitcoind RPC size (in bytes)"),
HistogramOpts::new("daemon_bytes", "Tapyrusd RPC size (in bytes)"),
&["method", "dir"],
),
};
Expand All @@ -303,7 +303,7 @@ impl Daemon {
let blockchain_info = daemon.getblockchaininfo()?;
info!("{:?}", blockchain_info);
if blockchain_info.pruned {
bail!("pruned node is not supported (use '-prune=0' bitcoind flag)".to_owned())
bail!("pruned node is not supported (use '-prune=0' tapyrusd flag)".to_owned())
}
loop {
let info = daemon.getblockchaininfo()?;
Expand All @@ -313,7 +313,7 @@ impl Daemon {
}

warn!(
"waiting for bitcoind sync to finish: {}/{} blocks, verification progress: {:.3}%",
"waiting for tapyrusd sync to finish: {}/{} blocks, verification progress: {:.3}%",
info.blocks,
info.headers,
info.verificationprogress * 100.0
Expand Down Expand Up @@ -389,7 +389,7 @@ impl Daemon {
loop {
match self.handle_request_batch(method, params_list) {
Err(Error(ErrorKind::Connection(msg), _)) => {
warn!("reconnecting to bitcoind: {}", msg);
warn!("reconnecting to tapyrusd: {}", msg);
self.signal.wait(Duration::from_secs(3), false)?;
let mut conn = self.conn.lock().unwrap();
*conn = conn.reconnect()?;
Expand All @@ -410,7 +410,7 @@ impl Daemon {
self.retry_request_batch(method, params_list)
}

// bitcoind JSONRPC API:
// tapyrusd JSONRPC API:

pub fn getblockchaininfo(&self) -> Result<BlockchainInfo> {
let info: Value = self.request("getblockchaininfo", json!([]))?;
Expand Down Expand Up @@ -552,7 +552,7 @@ impl Daemon {
return None;
}

// from BTC/kB to sat/b
// from TPC/kB to tapyrus/b
Some((*target, feerate * 100_000f64))
})
.collect())
Expand Down Expand Up @@ -621,7 +621,7 @@ impl Daemon {
pub fn get_relayfee(&self) -> Result<f64> {
let relayfee = self.getnetworkinfo()?.relayfee;

// from BTC/kB to sat/b
// from TPC/kB to tapyrus/b
Ok(relayfee * 100_000f64)
}
}
2 changes: 1 addition & 1 deletion src/electrum/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ mod tests {
stderrlog::new().verbosity(4).init().unwrap();

let discovery = DiscoveryManager::new(
Network::Testnet,
Network::Dev,
"1.4".parse().unwrap(),
Some("127.0.0.1:9150".parse().unwrap()),
);
Expand Down
Loading