gnu: bitcoin: Fix test failure with Python 3.8.
authorMarius Bakke <mbakke@fastmail.com>
Mon, 11 May 2020 11:38:39 +0000 (13:38 +0200)
committerMarius Bakke <mbakke@fastmail.com>
Mon, 11 May 2020 19:55:01 +0000 (21:55 +0200)
* gnu/packages/patches/bitcoin-core-python-compat.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/finance.scm (bitcoin-core)[source](patches): New field.

gnu/local.mk
gnu/packages/finance.scm
gnu/packages/patches/bitcoin-core-python-compat.patch [new file with mode: 0644]

index eb149cb..7d023c6 100644 (file)
@@ -793,6 +793,7 @@ dist_patch_DATA =                                           \
   %D%/packages/patches/binutils-loongson-workaround.patch      \
   %D%/packages/patches/binutils-mingw-w64-timestamp.patch      \
   %D%/packages/patches/binutils-mingw-w64-deterministic.patch  \
+  %D%/packages/patches/bitcoin-core-python-compat.patch                \
   %D%/packages/patches/blender-2.79-newer-ffmpeg.patch         \
   %D%/packages/patches/blender-2.79-python-3.7-fix.patch       \
   %D%/packages/patches/bluez-CVE-2020-0556.patch               \
index dfc89ca..6b34845 100644 (file)
                              version "/bitcoin-" version ".tar.gz"))
              (sha256
               (base32
-               "1h3w7brc18145np920vy7j5ms5hym59hvr40swdjx34fbdaisngj"))))
+               "1h3w7brc18145np920vy7j5ms5hym59hvr40swdjx34fbdaisngj"))
+             (patches (search-patches "bitcoin-core-python-compat.patch"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("pkg-config" ,pkg-config)
diff --git a/gnu/packages/patches/bitcoin-core-python-compat.patch b/gnu/packages/patches/bitcoin-core-python-compat.patch
new file mode 100644 (file)
index 0000000..6bf7441
--- /dev/null
@@ -0,0 +1,28 @@
+Get rid of deprecation warning emitted by Python 3.8, which causes a test failure(!).
+
+https://github.com/bitcoin/bitcoin/pull/17931
+
+Taken from upstream:
+
+https://github.com/bitcoin/bitcoin/commit/f117fb00da747147cddfb071c1427a2754c278cd
+
+diff --git a/test/functional/p2p_invalid_messages.py b/test/functional/p2p_invalid_messages.py
+index 20864881c165..07eacf410d88 100755
+--- a/test/functional/p2p_invalid_messages.py
++++ b/test/functional/p2p_invalid_messages.py
+@@ -145,13 +145,13 @@ def run_test(self):
+     def test_magic_bytes(self):
+         conn = self.nodes[0].add_p2p_connection(P2PDataStore())
+-        def swap_magic_bytes():
++        async def swap_magic_bytes():
+             conn._on_data = lambda: None  # Need to ignore all incoming messages from now, since they come with "invalid" magic bytes
+             conn.magic_bytes = b'\x00\x11\x22\x32'
+         # Call .result() to block until the atomic swap is complete, otherwise
+         # we might run into races later on
+-        asyncio.run_coroutine_threadsafe(asyncio.coroutine(swap_magic_bytes)(), NetworkThread.network_event_loop).result()
++        asyncio.run_coroutine_threadsafe(swap_magic_bytes(), NetworkThread.network_event_loop).result()
+         with self.nodes[0].assert_debug_log(['PROCESSMESSAGE: INVALID MESSAGESTART ping']):
+             conn.send_message(messages.msg_ping(nonce=0xff))