HomePhabricator

tests: Represent proof IDs as hex strings when sync_proofs fails

Description

tests: Represent proof IDs as hex strings when sync_proofs fails

Summary:
Internally, the test framework computes and stores proof IDs as
integers. This is not a convenient format when debugging, as the
debug.log message all show proof IDs as hex strings.

Format the proof IDs as hex strings for the AssertionError message.

Test Plan:
Run abc_p2p_proof_inventory with the following patch, to cause the error message to be displayed:

diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index c4581f787d..1befe966d7 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -579,7 +579,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
             "".join("\n  {!r}".format(m) for m in pool),
         ))

-    def sync_proofs(self, nodes=None, wait=1, timeout=60):
+    def sync_proofs(self, nodes=None, wait=1, timeout=10):
         """
         Wait until everybody has the same proofs in their proof pools
         """
@@ -592,8 +592,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
         while time.time() <= stop_time:
             nodes_proofs = [
                 set(format_ids(get_proof_ids(r))) for r in rpc_connections]
-            if nodes_proofs.count(nodes_proofs[0]) == len(rpc_connections):
-                return
             # Check that each peer has at least one connection
             assert (all([len(x.getpeerinfo()) for x in rpc_connections]))
             time.sleep(wait)

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D10028

Details

Provenance
PiRKAuthored on Sep 2 2021, 14:04
PiRKPushed on Sep 2 2021, 16:14
Reviewer
Restricted Project
Differential Revision
D10028: tests: Represent proof IDs as hex strings when sync_proofs fails
Parents
rABCaa3437af5c88: walletdb: Introduce WalletDatabase abstract class
Branches
Unknown
Tags
Unknown