1
0
Fork 0
mirror of https://github.com/romanz/electrs.git synced 2025-02-22 14:33:09 +01:00

Bump MSRV to 1.63.0 and update dependencies

This commit is contained in:
Roman Zeyde 2022-11-06 19:23:39 +02:00
parent 46881ed884
commit d2c794cc20
No known key found for this signature in database
GPG key ID: 87CAE5FA46917CBB
8 changed files with 384 additions and 275 deletions

604
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -9,7 +9,7 @@ repository = "https://github.com/romanz/electrs"
keywords = ["bitcoin", "electrum", "server", "index", "database"]
documentation = "https://docs.rs/electrs/"
readme = "README.md"
edition = "2018"
edition = "2021"
build = "build.rs"
[features]
@ -27,11 +27,11 @@ bitcoincore-rpc = "0.17.0"
configure_me = "0.4"
crossbeam-channel = "0.5"
dirs-next = "2.0"
env_logger = "0.9"
env_logger = "0.10"
log = "0.4"
parking_lot = "0.11"
parking_lot = "0.12"
prometheus = { version = "0.13", optional = true }
rayon = "1.5"
rayon = "1.7"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
@ -39,17 +39,15 @@ signal-hook = "0.3"
tiny_http = { version = "0.12", optional = true }
[dependencies.electrs-rocksdb]
# Workaround the following issues:
# - https://github.com/romanz/electrs/issues/403 (support building on ARM 32-bit)
# - https://github.com/romanz/electrs/issues/469 (dynamic linking on Debian 11)
version = "0.15.0-e3"
version = "0.19.0-e2"
default-features = false
# ZSTD is used for data compression
# Snappy is only for checking old DB
features = ["zstd", "snappy"]
[build-dependencies]
configure_me_codegen = { version = "0.4.3", default-features = false }
configure_me_codegen = { version = "0.4.4", default-features = false }
[dev-dependencies]
hex_lit = "0.1.1"

View file

@ -2,7 +2,7 @@
# The maintainers of electrs are not deeply familiar with Docker, so you should DYOR.
# If you are not familiar with Docker either it's probably be safer to NOT use it.
FROM debian:bullseye-slim as base
FROM debian:bookworm-slim as base
RUN apt-get update -qqy
RUN apt-get install -qqy librocksdb-dev curl

View file

@ -2,7 +2,7 @@
# The maintainers of electrs are not deeply familiar with Docker, so you should DYOR.
# If you are not familiar with Docker either it's probably be safer to NOT use it.
FROM debian:bullseye-slim as base
FROM debian:bookworm-slim as base
RUN apt-get update -qqy
RUN apt-get install -qqy librocksdb-dev wget
@ -36,9 +36,11 @@ RUN bitcoind -version && bitcoin-cli -version
### Electrum ###
# Clone latest Electrum wallet and a few test tools
WORKDIR /build/
RUN apt-get install -qqy git libsecp256k1-0 python3-cryptography python3-setuptools python3-pip jq curl
RUN apt-get install -qqy git libsecp256k1-1 python3-cryptography python3-setuptools python3-venv python3-pip jq curl
RUN git clone --recurse-submodules https://github.com/spesmilo/electrum/ && cd electrum/ && git log -1
RUN python3 -m pip install -e electrum/
RUN python3 -m venv --system-site-packages venv && \
venv/bin/pip install -e electrum/ && \
ln /build/venv/bin/electrum /usr/bin/electrum
RUN electrum version --offline
WORKDIR /

View file

@ -25,7 +25,7 @@ $ ./target/release/electrs --version # should print the latest version
Note for Raspberry Pi 4 owners: the old versions of OS/toolchains produce broken binaries.
Make sure to use latest OS! (see #226)
Install [recent Rust](https://rustup.rs/) (1.48.0+, `apt install cargo` is preferred for Debian 11),
Install [recent Rust](https://rustup.rs/) (1.63.0+, `apt install cargo` is preferred for Debian 12),
[latest Bitcoin Core](https://bitcoincore.org/en/download/) (0.21+)
and [latest Electrum wallet](https://electrum.org/#download) (4.0+).
@ -52,18 +52,18 @@ The advantages of dynamic linking:
* Cross compilation is more reliable
* If another application is also using `rocksdb`, you don't store it on disk and in RAM twice
If you decided to use dynamic linking, you will also need to install the library ([6.11.4 release](https://github.com/facebook/rocksdb/releases/tag/v6.11.4) is required).
On [Debian 11 (bullseye)](https://packages.debian.org/bullseye/librocksdb-dev) and [Ubuntu 21.04 (hirsute)](https://packages.ubuntu.com/hirsute/librocksdb-dev):
If you decided to use dynamic linking, you will also need to install the library ([7.8.3 release](https://github.com/facebook/rocksdb/releases/tag/v7.8.3) is required).
On [Debian 12 (bookworm)](https://packages.debian.org/bookworm/librocksdb-dev) and [Ubuntu 23.04 (lunar)](https://packages.ubuntu.com/lunar/librocksdb-dev):
```bash
$ sudo apt install librocksdb-dev=6.11.4-3
$ sudo apt install librocksdb-dev=7.8.3-2
```
For other versions of Debian or Ubuntu, you can build librocksdb and install inside `/usr/local` directory using following command.
```bash
$ sudo apt install -y libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
$ git clone -b v6.11.4 --depth 1 https://github.com/facebook/rocksdb && cd rocksdb
$ git clone -b v7.8.3 --depth 1 https://github.com/facebook/rocksdb && cd rocksdb
$ make shared_lib -j $(nproc) && sudo make install-shared
$ cd .. && rm -r rocksdb
```

View file

@ -1 +1 @@
1.48.0
1.63.0

View file

@ -96,6 +96,9 @@ impl Default for Config {
}
fn default_opts() -> rocksdb::Options {
let mut block_opts = rocksdb::BlockBasedOptions::default();
block_opts.set_checksum_type(rocksdb::ChecksumType::CRC32c);
let mut opts = rocksdb::Options::default();
opts.set_keep_log_file_num(10);
opts.set_max_open_files(16);
@ -106,6 +109,7 @@ fn default_opts() -> rocksdb::Options {
opts.set_disable_auto_compactions(true); // for initial bulk load
opts.set_advise_random_on_open(false); // bulk load uses sequential I/O
opts.set_prefix_extractor(rocksdb::SliceTransform::create_fixed_prefix(8));
opts.set_block_based_table_factory(&block_opts);
opts
}
@ -233,7 +237,7 @@ impl DBStore {
opts.set_prefix_same_as_start(true); // requires .set_prefix_extractor() above.
self.db
.iterator_cf_opt(cf, opts, mode)
.map(|(key, _value)| key) // values are empty in prefix-scanned CFs
.map(|row| row.expect("prefix iterator failed").0) // values are empty in prefix-scanned CFs
}
pub(crate) fn read_headers(&self) -> Vec<Row> {
@ -241,7 +245,7 @@ impl DBStore {
opts.fill_cache(false);
self.db
.iterator_cf_opt(self.headers_cf(), opts, rocksdb::IteratorMode::Start)
.map(|(key, _)| key)
.map(|row| row.expect("header iterator failed").0) // extract key from row
.filter(|key| &key[..] != TIP_KEY) // headers' rows are longer than TIP_KEY
.collect()
}
@ -310,7 +314,7 @@ impl DBStore {
DB_PROPERIES.iter().filter_map(move |property_name| {
let value = self
.db
.property_int_value_cf(cf, property_name)
.property_int_value_cf(cf, *property_name)
.expect("failed to get property");
Some((*cf_name, *property_name, value?))
})

View file

@ -376,9 +376,8 @@ impl ScriptHashStatus {
let sorted_entries = entries_map
.into_iter()
.collect::<BTreeMap<usize, TxEntry>>()
.into_iter()
.map(|(_pos, entry)| entry)
.collect::<Vec<TxEntry>>();
.into_values()
.collect();
(blockhash, sorted_entries)
})
.collect())
@ -415,7 +414,7 @@ impl ScriptHashStatus {
.spent = spent_outpoints;
cache.add_tx(entry.txid, || entry.tx.clone());
}
result.into_iter().map(|(_txid, entry)| entry).collect()
result.into_values().collect()
}
/// Sync with currently confirmed txs and mempool, downloading non-cached transactions via p2p protocol.