mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-19 05:44:05 +01:00
Assume bitcoin-core is statically linked to berkeley-db
The `berkeleyDbLibPath` option now defaults to an empty string. If not set to a berkeley lib path on the command line or the apitest.properties file, this option is ignored, and 'bitcoind' will be started without first exporting the berkeley db library path. In other words: If the bitcoind binary is dynamically linked to berkeley db libs, export the configured berkeley-db lib path before starting 'bitcoind'. If statically linked, the berkeley db lib path will not be exported. Also fixed exception msgs to show missing config file's absolute path.
This commit is contained in:
parent
e61a42dbb4
commit
898219aba5
@ -50,6 +50,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import static java.lang.String.format;
|
||||
import static java.lang.System.getProperty;
|
||||
import static java.lang.System.getenv;
|
||||
import static joptsimple.internal.Strings.EMPTY;
|
||||
|
||||
@Slf4j
|
||||
public class ApiTestConfig {
|
||||
@ -151,7 +152,7 @@ public class ApiTestConfig {
|
||||
ArgumentAcceptingOptionSpec<String> berkeleyDbLibPathOpt =
|
||||
parser.accepts(BERKELEYDB_LIB_PATH, "Berkeley DB lib path")
|
||||
.withRequiredArg()
|
||||
.ofType(String.class).defaultsTo("/usr/local/BerkeleyDB.4.8/lib");
|
||||
.ofType(String.class).defaultsTo(EMPTY);
|
||||
|
||||
ArgumentAcceptingOptionSpec<String> bitcoinPathOpt =
|
||||
parser.accepts(BITCOIN_PATH, "Bitcoin path")
|
||||
|
@ -24,6 +24,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static bisq.apitest.linux.BashCommand.isAlive;
|
||||
import static java.lang.String.format;
|
||||
import static joptsimple.internal.Strings.EMPTY;
|
||||
|
||||
|
||||
|
||||
@ -48,6 +49,7 @@ abstract class AbstractLinuxProcess implements LinuxProcess {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void verifyBitcoinConfig() {
|
||||
verifyBitcoinConfig(false);
|
||||
}
|
||||
@ -62,9 +64,11 @@ abstract class AbstractLinuxProcess implements LinuxProcess {
|
||||
"bitcoin.conf", config.bitcoinDatadir + "/bitcoin.conf",
|
||||
"blocknotify", config.bitcoinDatadir + "/blocknotify"));
|
||||
|
||||
File berkeleyDbLibPath = new File(config.berkeleyDbLibPath);
|
||||
if (!berkeleyDbLibPath.exists() || !berkeleyDbLibPath.canExecute())
|
||||
throw new IllegalStateException(berkeleyDbLibPath + " cannot be found or executed");
|
||||
if (!config.berkeleyDbLibPath.equals(EMPTY)) {
|
||||
File berkeleyDbLibPath = new File(config.berkeleyDbLibPath);
|
||||
if (!berkeleyDbLibPath.exists() || !berkeleyDbLibPath.canExecute())
|
||||
throw new IllegalStateException(berkeleyDbLibPath + " cannot be found or executed");
|
||||
}
|
||||
|
||||
File bitcoindExecutable = new File(config.bitcoinPath);
|
||||
if (!bitcoindExecutable.exists() || !bitcoindExecutable.canExecute())
|
||||
@ -76,11 +80,11 @@ abstract class AbstractLinuxProcess implements LinuxProcess {
|
||||
|
||||
File bitcoinConf = new File(bitcoindDatadir, "bitcoin.conf");
|
||||
if (!bitcoinConf.exists() || !bitcoinConf.canRead())
|
||||
throw new IllegalStateException(bitcoindDatadir + "/bitcoin.conf cannot be found or read");
|
||||
throw new IllegalStateException(bitcoinConf.getAbsolutePath() + " cannot be found or read");
|
||||
|
||||
File blocknotify = new File(bitcoindDatadir, "blocknotify");
|
||||
if (!blocknotify.exists() || !blocknotify.canExecute())
|
||||
throw new IllegalStateException(bitcoindDatadir + "/blocknotify cannot be found or executed");
|
||||
throw new IllegalStateException(blocknotify.getAbsolutePath() + " cannot be found or executed");
|
||||
}
|
||||
|
||||
public void verifyBitcoindRunning() throws IOException, InterruptedException {
|
||||
|
@ -23,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static bisq.apitest.linux.BashCommand.isAlive;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
import static joptsimple.internal.Strings.EMPTY;
|
||||
|
||||
|
||||
|
||||
@ -44,8 +45,15 @@ public class BitcoinDaemon extends AbstractLinuxProcess implements LinuxProcess
|
||||
|
||||
@Override
|
||||
public void start() throws InterruptedException, IOException {
|
||||
String bitcoindCmd = "export LD_LIBRARY_PATH=" + config.berkeleyDbLibPath + ";"
|
||||
+ " " + config.bitcoinPath + "/bitcoind"
|
||||
|
||||
// If the bitcoind binary is dynamically linked to berkeley db libs, export the
|
||||
// configured berkeley-db lib path. If statically linked, the berkeley db lib
|
||||
// path will not be exported.
|
||||
String berkeleyDbLibPathExport = config.berkeleyDbLibPath.equals(EMPTY) ? EMPTY
|
||||
: "export LD_LIBRARY_PATH=" + config.berkeleyDbLibPath + "; ";
|
||||
|
||||
String bitcoindCmd = berkeleyDbLibPathExport
|
||||
+ config.bitcoinPath + "/bitcoind"
|
||||
+ " -datadir=" + config.bitcoinDatadir
|
||||
+ " -daemon";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user