After a recent switch to configure_me in ec049b9a, the 'mainnet'
arg value became 'bitcoin'. 2c50791d then updated db dir location
but the doc for the --network arg remained stale.
An alternative is to accept both 'mainnet' and 'bitcoin' but
it would be confusing IMHO.
This change allows the user to specify a custom cookie file, which is then
used instead of `~/.bitcoin/.cookie`. This resolves situations when the
user wants to have the cookie file in non-standard path.
Aside from that, the code now pre-computes the default path, improving
the performance by avoiding allocation (and copying). Unfortunately, due
to limitations of Rust, the code doesn't print out cookie configuration
anymore. This however might be safer, since the cookie isn't printed,
and thus doesn't end up in some readable logs by accident.
Closes#176Closes#189
Also, move TransactionCache into `cache` module.
Following https://github.com/romanz/electrs/pull/161 by @dagurval.
Co-authored-by: Dagur Valberg Johannsson <dagurval@pvv.ntnu.no>
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.