Use non-default regtest bitcoind -rpcport

The default bitcoind / bitcoin-cli rpcport option has been changed
from 18443 to 19443, to help avoid rpcport conflicts between apitest's
bitcoind instances and other bitcoind and/or bitcion-qt instances
which are probably using the bitcoin-core default (regtest) rpcport
18443.

However, this commit cannot include other changes for avoiding bind
address:port conflicts between apitest bitcoind instances and other
regtest bitcoin-core instances because bitcoinj's bind port is hardcoded
in RegTestParams.java as 18444.

In order to avoid bitcoin-core regtest mode bind address conflicts,
you must start or restart your bitcoind or bitcoin-qt instance with a
non-default bind port argument, e.g.

	bitcoin-qt -regtest -port=20444
This commit is contained in:
ghubstan 2020-08-15 12:20:25 -03:00
parent 9637cc0943
commit 72ff4dca2b
No known key found for this signature in database
GPG key ID: E35592D6800A861E
3 changed files with 4 additions and 2 deletions

View file

@ -173,9 +173,9 @@ public class ApiTestConfig {
.ofType(String.class).defaultsTo("localhost"); .ofType(String.class).defaultsTo("localhost");
ArgumentAcceptingOptionSpec<Integer> bitcoinRpcPortOpt = ArgumentAcceptingOptionSpec<Integer> bitcoinRpcPortOpt =
parser.accepts(BITCOIN_RPC_PORT, "Bitcoin Core rpc port") parser.accepts(BITCOIN_RPC_PORT, "Bitcoin Core rpc port (non-default)")
.withRequiredArg() .withRequiredArg()
.ofType(Integer.class).defaultsTo(18443); .ofType(Integer.class).defaultsTo(19443);
ArgumentAcceptingOptionSpec<String> bitcoinRpcUserOpt = ArgumentAcceptingOptionSpec<String> bitcoinRpcUserOpt =
parser.accepts(BITCOIN_RPC_USER, "Bitcoin rpc user") parser.accepts(BITCOIN_RPC_USER, "Bitcoin rpc user")

View file

@ -149,6 +149,7 @@ public class BitcoinCli extends AbstractLinuxProcess implements LinuxProcess {
verifyBitcoinPathsExist(false); verifyBitcoinPathsExist(false);
verifyBitcoindRunning(); verifyBitcoindRunning();
commandWithOptions = config.bitcoinPath + "/bitcoin-cli -regtest " commandWithOptions = config.bitcoinPath + "/bitcoin-cli -regtest "
+ " -rpcport=" + config.bitcoinRpcPort
+ " -rpcuser=" + config.bitcoinRpcUser + " -rpcuser=" + config.bitcoinRpcUser
+ " -rpcpassword=" + config.bitcoinRpcPassword + " -rpcpassword=" + config.bitcoinRpcPassword
+ " " + command; + " " + command;

View file

@ -56,6 +56,7 @@ public class BitcoinDaemon extends AbstractLinuxProcess implements LinuxProcess
+ " -peerbloomfilters=1" + " -peerbloomfilters=1"
+ " -debug=net" + " -debug=net"
+ " -fallbackfee=0.0002" + " -fallbackfee=0.0002"
+ " -rpcport=" + config.bitcoinRpcPort
+ " -rpcuser=" + config.bitcoinRpcUser + " -rpcuser=" + config.bitcoinRpcUser
+ " -rpcpassword=" + config.bitcoinRpcPassword + " -rpcpassword=" + config.bitcoinRpcPassword
+ " -blocknotify=" + config.bitcoinDatadir + "/blocknotify"; + " -blocknotify=" + config.bitcoinDatadir + "/blocknotify";