From 18cb4f3ddf87bb600f25985bb4d369ec95b04c75 Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Wed, 8 May 2024 20:59:53 -0500 Subject: [PATCH] Add -datadir to when obtaining bitcoind -version to avoid using default datadir (#5574) --- .../scala/org/bitcoins/rpc/config/BitcoindInstance.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindInstance.scala b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindInstance.scala index 12d4e07f62..03a7b0a018 100644 --- a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindInstance.scala +++ b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindInstance.scala @@ -52,8 +52,13 @@ sealed trait BitcoindInstanceLocal extends BitcoindInstance { val binaryPath = binary.getAbsolutePath val versionT = Try { + val cmd = + Seq(binaryPath, s"-datadir=${datadir.toPath.toString}", "--version") val foundVersion = - Seq(binaryPath, "--version").!!.split(Properties.lineSeparator).head + cmd + .!!(NativeProcessFactory.processLogger) + .split(Properties.lineSeparator) + .head .split(" ") .last BitcoindVersion.findVersion(foundVersion).getOrElse { @@ -69,7 +74,7 @@ sealed trait BitcoindInstanceLocal extends BitcoindInstance { case Success(value) => value case Failure(exception) => logger.error("Error getting bitcoind version", exception) - BitcoindVersion.newest + throw exception } } }