Skip to content

Commit 2a7039f

Browse files
committed
Add Travis fedpeg test with downloaded bitcoind
1 parent f084479 commit 2a7039f

File tree

6 files changed

+42
-8
lines changed

6 files changed

+42
-8
lines changed

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,16 @@ jobs:
159159
RUN_FUNCTIONAL_TESTS=false
160160
GOAL="install"
161161
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER"
162+
163+
# x86_64 Linux w/ single fedpeg test that uses upstream bitcoind as mainchain
164+
- stage: test
165+
env: >-
166+
HOST=x86_64-unknown-linux-gnu
167+
PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libssl1.0-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev"
168+
NO_DEPENDS=1
169+
RUN_UNIT_TESTS=false
170+
RUN_BITCOIN_TESTS=false
171+
RUN_FUNCTIONAL_TESTS=false
172+
RUN_FEDPEG_BITCOIND_TEST=true
173+
GOAL="install"
174+
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=no --disable-tests --disable-bench CPPFLAGS=-DDEBUG_LOCKORDER"

.travis/test_06_script.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,13 @@ if [ "$RUN_BITCOIN_TESTS" = "true" ]; then
7171
DOCKER_EXEC test/bitcoin_functional/functional/test_runner.py --combinedlogslen=4000 --coverage --quiet --failfast ${extended}
7272
END_FOLD
7373
fi
74+
75+
if [ "$RUN_FEDPEG_BITCOIND_TEST" = "true" ]; then
76+
BEGIN_FOLD fedpeg-bitcoind-test
77+
BITCOIND_VERSION=0.17.1
78+
BITCOIND_ARCH=x86_64-linux-gnu
79+
DOCKER_EXEC curl -O https://bitcoincore.org/bin/bitcoin-core-$BITCOIND_VERSION/bitcoin-$BITCOIND_VERSION-$BITCOIND_ARCH.tar.gz
80+
DOCKER_EXEC tar -zxf bitcoin-$BITCOIND_VERSION-$BITCOIND_ARCH.tar.gz
81+
DOCKER_EXEC test/functional/feature_fedpeg.py --parent_bitcoin --parent_binpath $(pwd)/bitcoin-$BITCOIND_VERSION/bin/bitcoind
82+
END_FOLD
83+
fi

src/chainparams.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ class CCustomParams : public CRegTestParams {
562562
base58Prefixes[PARENT_PUBKEY_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-parentpubkeyprefix", 111));
563563
base58Prefixes[PARENT_SCRIPT_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-parentscriptprefix", 196));
564564
parent_bech32_hrp = args.GetArg("-parent_bech32_hrp", "bcrt");
565-
parent_blech32_hrp = args.GetArg("-parent_bech32_hrp", "bcrt");
565+
parent_blech32_hrp = args.GetArg("-parent_blech32_hrp", "bcrt");
566566

567567
base58Prefixes[BLINDED_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-blindedprefix", 4));
568568

test/functional/feature_fedpeg.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,22 @@ def setup_network(self, split=False):
3838

3939
self.nodes = []
4040
# Setup parent nodes
41-
parent_chain = "regtest" if self.options.parent_bitcoin else "parent"
41+
parent_chain = "parent" if not self.options.parent_bitcoin else "regtest"
4242
parent_binary = [self.options.parent_binpath] if self.options.parent_binpath != "" else None
4343
for n in range(2):
4444
extra_args = [
45-
"-printtoconsole=0",
4645
"-port="+str(p2p_port(n)),
4746
"-rpcport="+str(rpc_port(n))
4847
]
4948
if self.options.parent_bitcoin:
49+
# bitcoind can't read elements.conf config files
5050
extra_args.extend([
51+
"-regtest=1",
52+
"-printtoconsole=0",
53+
"-server=1",
54+
"-discover=0",
55+
"-keypool=1",
56+
"-listenonion=0",
5157
"-addresstype=legacy", # To make sure bitcoind gives back p2pkh no matter version
5258
])
5359
else:
@@ -58,7 +64,7 @@ def setup_network(self, split=False):
5864
"-signblockscript=51", # OP_TRUE
5965
])
6066

61-
self.add_nodes(1, [extra_args], chain=[parent_chain], binary=parent_binary)
67+
self.add_nodes(1, [extra_args], chain=[parent_chain], binary=parent_binary, chain_in_args=[not self.options.parent_bitcoin])
6268
self.start_node(n)
6369
print("Node {} started".format(n))
6470

@@ -86,6 +92,8 @@ def setup_network(self, split=False):
8692
'-mainchainrpchost=127.0.0.1',
8793
'-mainchainrpcport=%s' % rpc_port(n),
8894
'-recheckpeginblockinterval=15', # Long enough to allow failure and repair before timeout
95+
'-parentpubkeyprefix=111',
96+
'-parentscriptprefix=196',
8997
]
9098
if not self.options.parent_bitcoin:
9199
extra_args.extend([

test/functional/test_framework/test_framework.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def run_test(self):
280280

281281
# Public helper methods. These can be accessed by the subclass test scripts.
282282

283-
def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, chain=None, binary=None):
283+
def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, chain=None, binary=None, chain_in_args=None):
284284
"""Instantiate TestNode objects"""
285285
if self.bind_to_localhost_only:
286286
extra_confs = [["bind=127.0.0.1"]] * num_nodes
@@ -292,13 +292,15 @@ def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, chain=None, bin
292292
binary = [self.options.bitcoind] * num_nodes
293293
if chain is None:
294294
chain = [self.chain] * num_nodes
295+
if chain_in_args is None:
296+
chain_in_args = [True] * num_nodes
295297
assert_equal(len(extra_confs), num_nodes)
296298
assert_equal(len(extra_args), num_nodes)
297299
assert_equal(len(binary), num_nodes)
298300
assert_equal(len(chain), num_nodes)
299301
for i in range(num_nodes):
300302
numnode = len(self.nodes)
301-
self.nodes.append(TestNode(numnode, get_datadir_path(self.options.tmpdir, numnode), chain[i], rpchost=rpchost, timewait=self.rpc_timewait, bitcoind=binary[i], bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli))
303+
self.nodes.append(TestNode(numnode, get_datadir_path(self.options.tmpdir, numnode), chain[i], rpchost=rpchost, timewait=self.rpc_timewait, bitcoind=binary[i], bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli, chain_in_args=chain_in_args[i]))
302304

303305
def start_node(self, i, *args, **kwargs):
304306
"""Start a bitcoind"""

test/functional/test_framework/test_node.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class TestNode():
5858
To make things easier for the test writer, any unrecognised messages will
5959
be dispatched to the RPC connection."""
6060

61-
def __init__(self, i, datadir, chain, *, rpchost, timewait, bitcoind, bitcoin_cli, mocktime, coverage_dir, extra_conf=None, extra_args=None, use_cli=False):
61+
def __init__(self, i, datadir, chain, *, rpchost, timewait, bitcoind, bitcoin_cli, mocktime, coverage_dir, extra_conf=None, extra_args=None, use_cli=False, chain_in_args=True):
6262
self.index = i
6363
self.datadir = datadir
6464
self.stdout_dir = os.path.join(self.datadir, "stdout")
@@ -77,14 +77,15 @@ def __init__(self, i, datadir, chain, *, rpchost, timewait, bitcoind, bitcoin_cl
7777
self.args = [
7878
self.binary,
7979
"-datadir=" + self.datadir,
80-
"-chain=" + self.chain,
8180
"-logtimemicros",
8281
"-debug",
8382
"-debugexclude=libevent",
8483
"-debugexclude=leveldb",
8584
"-mocktime=" + str(mocktime),
8685
"-uacomment=testnode%d" % i
8786
]
87+
if chain_in_args:
88+
self.args += ["-chain=" + self.chain]
8889

8990
self.cli = TestNodeCLI(bitcoin_cli, self.datadir, self.chain)
9091
self.use_cli = use_cli

0 commit comments

Comments
 (0)