-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
change bitcoind -> corepc_node #89
Conversation
67b72ef
to
615d568
Compare
will investigate the errors another day... Maybe @tcharding could give an hint in the meantime |
@@ -10,12 +10,11 @@ mod error; | |||
mod ext; | |||
mod versions; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagined one would just alias back to bitcoind
use corepc_node as bitcoind;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah or rename directly at Cargo.toml level... I just prefer to have it explicit so that looking at the code you cannot mistakely think it's still the other crate
Sweeet, I think there are multiple problems. One is easy and one I thought I fixed - let me look more. The easy one is that how I added a default feature in
The second one is to do with how Bitcoin Core v28 binds to ports now, something to do with the Tor changes. I thought I fixed it but let me look some more. |
Ouch, I did "fix" it. Using Created issue: rust-bitcoin/corepc#41 |
Thanks @tcharding removing default features fixed the issues... @MaxFangX I am going to merge/release tomorrow or so |
Thank you @RCasatta ! |
Oh I'm surprised CI passes using Core v28 - I thought I hit the "cannot run units tests in parallel because of port binding" issue yesterday when running them. |
EDIT: Should be
I recently had to muck around with this trying to run multiple Our code which uses // Configure bitcoind
let bitcoind_exe_path = std::env::var("BITCOIND_EXE")
.or_else(|_| bitcoind::downloaded_exe_path())
.expect("Didn't specify oneof `$BITCOIND_EXE` or bitcoind version in feature flags");
debug!(%bitcoind_exe_path);
let mut bitcoind_conf = bitcoind::Conf::default();
bitcoind_conf.staticdir = data_dir.as_ref().map(|d| d.join("bitcoind"));
// In bitcoind 28.0 (our current nix packaged version), `-bind` defaults
// to `127.0.0.1:18445=onion` for regtest (see `bitcoind -help`).
// Setting `bitcoind::Conf::p2p` to `P2P::Yes` sets the `-port=<port>`
// CLI arg, but it still leaves a listener at `18445=onion`, which
// causes bind conflicts when running multiple bitcoind instances. To
// overcome this, we set `-bind=[::1]:<port>`, which overrides anything
// set with `-port`. Unfortunately, setting `P2P::No` sets `-listen=0`
// which is incompatible with `-bind`. So we use `P2P::Yes` which sets
// `-listen=1` but emits a confusing unreachable p2p port in the logs.
//
// One bonus of all this is now we can specify which port the p2p
// listener should bind to. For now, we just use an ephemeral port.
let bitcoind_p2p_port =
get_ephemeral_port().expect("Couldn't get ephemeral port");
let bitcoind_p2p_addr =
SocketAddr::from(([0, 0, 0, 0, 0, 0, 0, 1], bitcoind_p2p_port));
info!(%bitcoind_p2p_addr);
let bind_arg = format!("-bind={bitcoind_p2p_addr}");
bitcoind_conf.args.push(&bind_arg);
bitcoind_conf.p2p = P2P::Yes;
// Init bitcoind
let bitcoind = BitcoinD::with_conf(bitcoind_exe_path, &bitcoind_conf)
.expect("Failed to init bitcoind"); Full implementation of our wrapper here: https://gist.github.com/MaxFangX/a2c42179915b1c61f168db86f121d90c |
Sweeeet, legendary @MaxFangX. Thanks man |
#88