Skip to content

[test] Consider removing lazy_static #149

@ValuedMammal

Description

@ValuedMammal

Static references don't run their destructors. This means we can end up leaking resources after running the test suite. This issue is only related to tests and not a bug in the library.

lazy_static! {
static ref BITCOIND: corepc_node::Node = {
let bitcoind_exe = env::var("BITCOIND_EXE")
.ok()
.or_else(|| corepc_node::downloaded_exe_path().ok())
.expect(
"you need to provide an env var BITCOIND_EXE or specify a bitcoind version feature",
);
let conf = corepc_node::Conf::default();
corepc_node::Node::with_conf(bitcoind_exe, &conf).unwrap()
};

To reproduce

  1. cargo test -- --test-threads=1
  2. ps aux | grep bitcoind

Additional Context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions