Skip to content

Commit a49f412

Browse files
PastaPastaPastaUdjinM6
authored andcommitted
Backports 0.15 pr1 (#2590)
* Merge bitcoin#9744: Remove unused module from rpc-tests a432aa0 Remove unused module from rpc-tests (Takashi Mitsuta) * Merge bitcoin#9696: [trivial] Fix recently introduced typos in comments 0c9b9b7 [trivial] Fix recently introduced typos in comments (practicalswift) * Merge bitcoin#9657: Improve rpc-tests.py a6a3e58 Various review markups for rpc-tests.py improvements (John Newbery) 3de3ccd Refactor rpc-tests.py (John Newbery) afd38e7 Improve rpc-tests.py arguments (John Newbery) 91bffff Use argparse in rpc_tests.py (John Newbery) 1581ecb Use configparser in rpc-tests.py (John Newbery) * Merge bitcoin#9724: Qt/Intro: Add explanation of IBD process f6d18f5 Qt/Intro: Explain a bit more what will happen first time (Luke Dashjr) 50c5657 Qt/Intro: Storage shouldn't grow significantly with pruning enabled (Luke Dashjr) 9adb694 Qt/Intro: Move sizeWarningLabel text into C++ code (Luke Dashjr) * Merge bitcoin#9794: Minor update to qrencode package builder 1bfe6b4 Use package name variable inside $(package)_file_name variable (Mitchell Cash) * Merge bitcoin#9726: netbase: Do not print an error on connection timeouts through proxy 3ddfe29 netbase: Do not print an error on connection timeouts through proxy (Wladimir J. van der Laan) 13f6085 netbase: Make InterruptibleRecv return an error code instead of bool (Wladimir J. van der Laan) * Merge bitcoin#9727: Remove fallbacks for boost_filesystem < v3 056aba2 Remove fallbacks for boost_filesystem < v3 (Wladimir J. van der Laan) * Merge bitcoin#9485: ZMQ example using python3 and asyncio b471daf Adddress nits, use asyncio signal handling, create_task (Bob McElrath) 4bb7d1b Add python version checks and 3.4 example (Bob McElrath) 5406d51 Rewrite to not use Polling wrapper for asyncio, link to python2.7 example (Bob McElrath) 5ea5368 ZMQ example using python3 and asyncio (Bob McElrath) * Merge bitcoin#9807: RPC doc fix-ups. 851f6a3 [qa][doc] Correct rpc test options in readme (fanquake) 41e7219 [trivial] Add tests_config.ini to .gitignore (fanquake) * Dashify Co-Authored-By: PastaPastaPasta <pasta@dashboost.org> * Change file permissions * update travis.yml -parallel -> --jobs
1 parent f95aae2 commit a49f412

28 files changed

+451
-268
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ linux-coverage-build
109109
linux-build
110110
win32-build
111111
qa/pull-tester/tests_config.py
112+
qa/pull-tester/tests_config.ini
112113
qa/cache/*
113114

114115
!src/leveldb*/Makefile

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ script:
7373
- if [ $SECONDS -gt 1200 ]; then export DEPENDS_TIMEOUT="true"; false; fi # The "false" here ensures that the build is marked as failed even though the whole script returns 0
7474
- test "$DEPENDS_TIMEOUT" != "true" && $DOCKER_RUN_IN_BUILDER ./ci/build_src.sh
7575
- test "$DEPENDS_TIMEOUT" != "true" && $DOCKER_RUN_IN_BUILDER ./ci/test_unittests.sh
76-
- test "$DEPENDS_TIMEOUT" != "true" && $DOCKER_RUN_IN_BUILDER ./ci/test_integrationtests.sh -parallel=3
76+
- test "$DEPENDS_TIMEOUT" != "true" && $DOCKER_RUN_IN_BUILDER ./ci/test_integrationtests.sh --jobs=3
7777
- test "$DEPENDS_TIMEOUT" != "true" && if [ "$DOCKER_BUILD" = "true" ]; then BUILD_DIR=build-ci/dashcore-$BUILD_TARGET ./docker/build-docker.sh; fi
7878
after_script:
7979
- echo $TRAVIS_COMMIT_RANGE

Makefile.am

-3
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,6 @@ EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/rpc-tests.py qa/rpc-
224224

225225
CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER)
226226

227-
# This file is problematic for out-of-tree builds if it exists.
228-
DISTCLEANFILES = qa/pull-tester/tests_config.pyc
229-
230227
.INTERMEDIATE: $(COVERAGE_INFO)
231228

232229
DISTCHECK_CONFIGURE_FLAGS = --enable-man

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ AC_SUBST(ZMQ_LIBS)
11131113
AC_SUBST(PROTOBUF_LIBS)
11141114
AC_SUBST(QR_LIBS)
11151115
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist src/test/buildenv.py])
1116-
AC_CONFIG_FILES([qa/pull-tester/tests_config.py],[chmod +x qa/pull-tester/tests_config.py])
1116+
AC_CONFIG_FILES([qa/pull-tester/tests_config.ini],[chmod +x qa/pull-tester/tests_config.ini])
11171117
AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh])
11181118
AC_CONFIG_LINKS([qa/pull-tester/rpc-tests.py:qa/pull-tester/rpc-tests.py])
11191119

contrib/zmq/zmq_sub.py

+75-34
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,118 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# Copyright (c) 2014-2016 The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6+
"""
7+
ZMQ example using python3's asyncio
8+
9+
Dash should be started with the command line arguments:
10+
dashd-testnet -daemon \
11+
-zmqpubhashblock=tcp://127.0.0.1:28332 \
12+
-zmqpubrawtx=tcp://127.0.0.1:28332 \
13+
-zmqpubhashtx=tcp://127.0.0.1:28332 \
14+
-zmqpubhashblock=tcp://127.0.0.1:28332
15+
16+
We use the asyncio library here. `self.handle()` installs itself as a
17+
future at the end of the function. Since it never returns with the event
18+
loop having an empty stack of futures, this creates an infinite loop. An
19+
alternative is to wrap the contents of `handle` inside `while True`.
20+
21+
A blocking example using python 2.7 can be obtained from the git history:
22+
https://github.com/bitcoin/bitcoin/blob/37a7fe9e440b83e2364d5498931253937abe9294/contrib/zmq/zmq_sub.py
23+
"""
24+
625
import binascii
26+
import asyncio
727
import zmq
28+
import zmq.asyncio
29+
import signal
830
import struct
31+
import sys
32+
33+
if not (sys.version_info.major >= 3 and sys.version_info.minor >= 5):
34+
print("This example only works with Python 3.5 and greater")
35+
exit(1)
936

1037
port = 28332
1138

12-
zmqContext = zmq.Context()
13-
zmqSubSocket = zmqContext.socket(zmq.SUB)
14-
zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock")
15-
zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx")
16-
zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtxlock")
17-
zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashgovernancevote")
18-
zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashgovernanceobject")
19-
zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashinstantsenddoublespend")
20-
zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawblock")
21-
zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawtx")
22-
zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawtxlock")
23-
zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawgovernancevote")
24-
zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawgovernanceobject")
25-
zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawinstantsenddoublespend")
26-
zmqSubSocket.connect("tcp://127.0.0.1:%i" % port)
39+
class ZMQHandler():
40+
def __init__(self):
41+
self.loop = zmq.asyncio.install()
42+
self.zmqContext = zmq.asyncio.Context()
43+
44+
self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)
45+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashblock")
46+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashtx")
47+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashtxlock")
48+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashgovernancevote")
49+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashgovernanceobject")
50+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashinstantsenddoublespend")
51+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawblock")
52+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawtx")
53+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawtxlock")
54+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawgovernancevote")
55+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawgovernanceobject")
56+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawinstantsenddoublespend")
57+
self.zmqSubSocket.connect("tcp://127.0.0.1:%i" % port)
2758

28-
try:
29-
while True:
30-
msg = zmqSubSocket.recv_multipart()
31-
topic = str(msg[0].decode("utf-8"))
59+
async def handle(self) :
60+
msg = await self.zmqSubSocket.recv_multipart()
61+
topic = msg[0]
3262
body = msg[1]
3363
sequence = "Unknown"
3464

3565
if len(msg[-1]) == 4:
3666
msgSequence = struct.unpack('<I', msg[-1])[-1]
3767
sequence = str(msgSequence)
3868

39-
if topic == "hashblock":
69+
if topic == b"hashblock":
4070
print('- HASH BLOCK ('+sequence+') -')
4171
print(binascii.hexlify(body).decode("utf-8"))
42-
elif topic == "hashtx":
72+
elif topic == b"hashtx":
4373
print ('- HASH TX ('+sequence+') -')
4474
print(binascii.hexlify(body).decode("utf-8"))
45-
elif topic == "hashtxlock":
75+
elif topic == b"hashtxlock":
4676
print('- HASH TX LOCK ('+sequence+') -')
4777
print(binascii.hexlify(body).decode("utf-8"))
48-
elif topic == "rawblock":
78+
elif topic == b"rawblock":
4979
print('- RAW BLOCK HEADER ('+sequence+') -')
5080
print(binascii.hexlify(body[:80]).decode("utf-8"))
51-
elif topic == "rawtx":
81+
elif topic == b"rawtx":
5282
print('- RAW TX ('+sequence+') -')
5383
print(binascii.hexlify(body).decode("utf-8"))
54-
elif topic == "rawtxlock":
84+
elif topic == b"rawtxlock":
5585
print('- RAW TX LOCK ('+sequence+') -')
5686
print(binascii.hexlify(body).decode("utf-8"))
57-
elif topic == "rawinstantsenddoublespend":
87+
elif topic == b"rawinstantsenddoublespend":
5888
print('- RAW IS DOUBLE SPEND ('+sequence+') -')
5989
print(binascii.hexlify(body).decode("utf-8"))
60-
elif topic == "hashgovernancevote":
90+
elif topic == b"hashgovernancevote":
6191
print('- HASH GOVERNANCE VOTE ('+sequence+') -')
6292
print(binascii.hexlify(body).decode("utf-8"))
63-
elif topic == "hashgovernanceobject":
93+
elif topic == b"hashgovernanceobject":
6494
print('- HASH GOVERNANCE OBJECT ('+sequence+') -')
6595
print(binascii.hexlify(body).decode("utf-8"))
66-
elif topic == "rawgovernancevote":
96+
elif topic == b"rawgovernancevote":
6797
print('- RAW GOVERNANCE VOTE ('+sequence+') -')
6898
print(binascii.hexlify(body).decode("utf-8"))
69-
elif topic == "rawgovernanceobject":
99+
elif topic == b"rawgovernanceobject":
70100
print('- RAW GOVERNANCE OBJECT ('+sequence+') -')
71101
print(binascii.hexlify(body).decode("utf-8"))
72-
elif topic == "hashinstantsenddoublespend":
102+
elif topic == b"hashinstantsenddoublespend":
73103
print('- HASH IS DOUBLE SPEND ('+sequence+') -')
74104
print(binascii.hexlify(body).decode("utf-8"))
105+
# schedule ourselves to receive the next message
106+
asyncio.ensure_future(self.handle())
107+
108+
def start(self):
109+
self.loop.add_signal_handler(signal.SIGINT, self.stop)
110+
self.loop.create_task(self.handle())
111+
self.loop.run_forever()
112+
113+
def stop(self):
114+
self.loop.stop()
115+
self.zmqContext.destroy()
75116

76-
except KeyboardInterrupt:
77-
zmqContext.destroy()
117+
daemon = ZMQHandler()
118+
daemon.start()

contrib/zmq/zmq_sub3.4.py

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2014-2016 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
6+
"""
7+
ZMQ example using python3's asyncio
8+
9+
Dash should be started with the command line arguments:
10+
dashd -testnet -daemon \
11+
-zmqpubhashblock=tcp://127.0.0.1:28332 \
12+
-zmqpubrawtx=tcp://127.0.0.1:28332 \
13+
-zmqpubhashtx=tcp://127.0.0.1:28332 \
14+
-zmqpubhashblock=tcp://127.0.0.1:28332
15+
16+
We use the asyncio library here. `self.handle()` installs itself as a
17+
future at the end of the function. Since it never returns with the event
18+
loop having an empty stack of futures, this creates an infinite loop. An
19+
alternative is to wrap the contents of `handle` inside `while True`.
20+
21+
The `@asyncio.coroutine` decorator and the `yield from` syntax found here
22+
was introduced in python 3.4 and has been deprecated in favor of the `async`
23+
and `await` keywords respectively.
24+
25+
A blocking example using python 2.7 can be obtained from the git history:
26+
https://github.com/bitcoin/bitcoin/blob/37a7fe9e440b83e2364d5498931253937abe9294/contrib/zmq/zmq_sub.py
27+
"""
28+
29+
import binascii
30+
import asyncio
31+
import zmq
32+
import zmq.asyncio
33+
import signal
34+
import struct
35+
import sys
36+
37+
if not (sys.version_info.major >= 3 and sys.version_info.minor >= 4):
38+
print("This example only works with Python 3.4 and greater")
39+
exit(1)
40+
41+
port = 28332
42+
43+
class ZMQHandler():
44+
def __init__(self):
45+
self.loop = zmq.asyncio.install()
46+
self.zmqContext = zmq.asyncio.Context()
47+
48+
self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)
49+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashblock")
50+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashtx")
51+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashtxlock")
52+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashgovernancevote")
53+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashgovernanceobject")
54+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashinstantsenddoublespend")
55+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawblock")
56+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawtx")
57+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawtxlock")
58+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawgovernancevote")
59+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawgovernanceobject")
60+
self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawinstantsenddoublespend")
61+
self.zmqSubSocket.connect("tcp://127.0.0.1:%i" % port)
62+
63+
@asyncio.coroutine
64+
def handle(self) :
65+
msg = yield from self.zmqSubSocket.recv_multipart()
66+
topic = msg[0]
67+
body = msg[1]
68+
sequence = "Unknown";
69+
if len(msg[-1]) == 4:
70+
msgSequence = struct.unpack('<I', msg[-1])[-1]
71+
sequence = str(msgSequence)
72+
if topic == b"hashblock":
73+
print('- HASH BLOCK ('+sequence+') -')
74+
print(binascii.hexlify(body).decode("utf-8"))
75+
elif topic == b"hashtx":
76+
print ('- HASH TX ('+sequence+') -')
77+
print(binascii.hexlify(body).decode("utf-8"))
78+
elif topic == b"hashtxlock":
79+
print('- HASH TX LOCK ('+sequence+') -')
80+
print(binascii.hexlify(body).decode("utf-8"))
81+
elif topic == b"rawblock":
82+
print('- RAW BLOCK HEADER ('+sequence+') -')
83+
print(binascii.hexlify(body[:80]).decode("utf-8"))
84+
elif topic == b"rawtx":
85+
print('- RAW TX ('+sequence+') -')
86+
print(binascii.hexlify(body).decode("utf-8"))
87+
elif topic == b"rawtxlock":
88+
print('- RAW TX LOCK ('+sequence+') -')
89+
print(binascii.hexlify(body).decode("utf-8"))
90+
elif topic == b"rawinstantsenddoublespend":
91+
print('- RAW IS DOUBLE SPEND ('+sequence+') -')
92+
print(binascii.hexlify(body).decode("utf-8"))
93+
elif topic == b"hashgovernancevote":
94+
print('- HASH GOVERNANCE VOTE ('+sequence+') -')
95+
print(binascii.hexlify(body).decode("utf-8"))
96+
elif topic == b"hashgovernanceobject":
97+
print('- HASH GOVERNANCE OBJECT ('+sequence+') -')
98+
print(binascii.hexlify(body).decode("utf-8"))
99+
elif topic == b"rawgovernancevote":
100+
print('- RAW GOVERNANCE VOTE ('+sequence+') -')
101+
print(binascii.hexlify(body).decode("utf-8"))
102+
elif topic == b"rawgovernanceobject":
103+
print('- RAW GOVERNANCE OBJECT ('+sequence+') -')
104+
print(binascii.hexlify(body).decode("utf-8"))
105+
elif topic == b"hashinstantsenddoublespend":
106+
print('- HASH IS DOUBLE SPEND ('+sequence+') -')
107+
print(binascii.hexlify(body).decode("utf-8"))
108+
# schedule ourselves to receive the next message
109+
asyncio.ensure_future(self.handle())
110+
111+
def start(self):
112+
self.loop.add_signal_handler(signal.SIGINT, self.stop)
113+
self.loop.create_task(self.handle())
114+
self.loop.run_forever()
115+
116+
def stop(self):
117+
self.loop.stop()
118+
self.zmqContext.destroy()
119+
120+
daemon = ZMQHandler()
121+
daemon.start()

depends/packages/qrencode.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package=qrencode
22
$(package)_version=3.4.4
33
$(package)_download_path=https://fukuchi.org/works/qrencode/
4-
$(package)_file_name=qrencode-$(qrencode_version).tar.bz2
4+
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
55
$(package)_sha256_hash=efe5188b1ddbcbf98763b819b146be6a90481aac30cfc8d858ab78a19cde1fa5
66

77
define $(package)_set_vars

qa/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ Run the regression test suite with
3939

4040
Run all possible tests with
4141

42-
qa/pull-tester/rpc-tests.py -extended
42+
qa/pull-tester/rpc-tests.py --extended
4343

4444
By default, tests will be run in parallel. To specify how many jobs to run,
45-
append `-parallel=n` (default n=4).
45+
append `--jobs=n` (default n=4).
4646

47-
If you want to create a basic coverage report for the rpc test suite, append `--coverage`.
47+
If you want to create a basic coverage report for the RPC test suite, append `--coverage`.
4848

4949
Possible options, which apply to each individual test run:
5050

@@ -83,5 +83,5 @@ killall dashd
8383
Writing tests
8484
=============
8585
You are encouraged to write tests for new or existing features.
86-
Further information about the test framework and individual rpc
86+
Further information about the test framework and individual RPC
8787
tests is found in [qa/rpc-tests](/qa/rpc-tests).

0 commit comments

Comments
 (0)