Besides several comments added to the code, all relevant instances of
`panic!`, `.unwrap()` and `.expect()` were removed in order to keep
messages user-friendly. `.extend()` is used istead of `.push()` on
`PathBuf` for multi-fragment values.
The addresses weren't resolved in case of deserializing from config
file. Besides, resolving addresses in parsing/deserialization code would
make messy code (harder to read). This commit fixes both issues by
moving address resolution to post-processing stage.
As the network name changed from `mainnet` to `bitcoin`, this change
accidentally affected database subdirectory. This would be
backwards-incompatible in a major way (the users would have to notice
the change and rename it).
This commit reverts the name of the subdirectory and renames the
variable to express the intent more explicitly.
The values in user-level config file should override system config file,
not the other way arounnd. Also added `electrs.toml` config file which
is searched for in the current directory.
Since use of configuration files is both mmore secure and more
convenient and clap doesn't support config files, this switches to
configure_me, which supports config files, env vars and also generating
man pages.
Closes#151
There were several places where `Vec<Row>` was created just to iterate
it later and throw away, thus allocating memory unnecessarily. This
translates those `Vec`s to `Iterator`s in order to improve the
efficiency.
This change switches from `Mutex<u64>` to `AtomicU64`, which is faster
and somewhat more elegant to write. It keeps the `Counter` type for
backwards compatibility.
The downside is that it doesn't work on as many platforms and requires
fairly recent compiler.