mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
test: use random port/rpcport for bitcoind.
This means we don't get confused if a testnet bitcoind already running. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
754616c45a
commit
b22bdfcbe8
3 changed files with 13 additions and 3 deletions
|
@ -11,10 +11,16 @@ fi
|
||||||
rm -rf $DATADIR
|
rm -rf $DATADIR
|
||||||
mkdir $DATADIR
|
mkdir $DATADIR
|
||||||
|
|
||||||
|
# Find a free port (racy, but hey)
|
||||||
|
PORT=`findport 18332`
|
||||||
|
RPCPORT=`findport $(($PORT + 1))`
|
||||||
|
|
||||||
# Create appropriate config file so cmdline matches.
|
# Create appropriate config file so cmdline matches.
|
||||||
cat > $DATADIR/bitcoin.conf <<EOF
|
cat > $DATADIR/bitcoin.conf <<EOF
|
||||||
regtest=1
|
regtest=1
|
||||||
testnet=0
|
testnet=0
|
||||||
|
rpcport=$RPCPORT
|
||||||
|
port=$PORT
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
$DAEMON &
|
$DAEMON &
|
||||||
|
|
|
@ -11,4 +11,10 @@ else
|
||||||
SEQ_ENFORCEMENT=false
|
SEQ_ENFORCEMENT=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
findport()
|
||||||
|
{
|
||||||
|
PORT=$1
|
||||||
|
while netstat -ntl | grep -q ":$PORT "; do PORT=$(($PORT + 1)); done
|
||||||
|
echo $PORT
|
||||||
|
}
|
||||||
#PREFIX="valgrind --vgdb-error=1"
|
#PREFIX="valgrind --vgdb-error=1"
|
||||||
|
|
|
@ -352,9 +352,7 @@ cp $DIR2/config $DIR3/config
|
||||||
if [ x"$RECONNECT" = xrestart ]; then
|
if [ x"$RECONNECT" = xrestart ]; then
|
||||||
# Make sure node2 restarts on same port, by setting in config.
|
# Make sure node2 restarts on same port, by setting in config.
|
||||||
# Find a free TCP port.
|
# Find a free TCP port.
|
||||||
port=4000
|
echo port=`findport 4000` >> $DIR2/config
|
||||||
while netstat -ntl | grep -q ":$port "; do port=$(($port + 1)); done
|
|
||||||
echo port=$port >> $DIR2/config
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$DIFFERENT_FEES" ]; then
|
if [ -n "$DIFFERENT_FEES" ]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue