qa: Fixups to “Run all tests even if wallet is not compiled” #14179

pull MarcoFalke wants to merge 2 commits into bitcoin:master from MarcoFalke:Mf1809-qaPremine changing 5 files +15 −13
  1. MarcoFalke commented at 3:33 pm on September 9, 2018: member

    Currently the functional tests require the wallet module to be compiled into the Bitcoin Core executable. For example the premine (or datadir cache) to speed up tests when run in parallel would mine a bunch of blocks and store the private keys to sign the coinbase tx outputs in a wallet. There is no need to have the overhead of the whole wallet module by using keys that are deterministic for all runs.

    Note that this change most likely requires the ./test/cache/ to be cleared.

  2. MarcoFalke added the label Tests on Sep 9, 2018
  3. MarcoFalke force-pushed on Sep 9, 2018
  4. MarcoFalke force-pushed on Sep 9, 2018
  5. Sjors commented at 8:27 am on September 10, 2018: member
    tACK fae497d on macOS 10.13.6
  6. in test/functional/test_framework/test_framework.py:252 in fae497d560 outdated
    246@@ -247,6 +247,14 @@ def setup_nodes(self):
    247         self.add_nodes(self.num_nodes, extra_args)
    248         self.start_nodes()
    249 
    250+    def import_deterministic_coinbase_privkeys(self):
    251+        for n in self.nodes:
    252+            wallet_enabled = 'Wallet' in [line[3:-3] for line in n.help().splitlines() if line.startswith('==')]
    


    jnewbery commented at 3:46 pm on September 10, 2018:

    This seems a little brittle (based on the exact text output of the help text).

    Calling getwalletinfo and catching the returned error is an alternative way to do this.

  7. in test/functional/test_framework/test_framework.py:263 in fae497d560 outdated
    246@@ -247,6 +247,14 @@ def setup_nodes(self):
    247         self.add_nodes(self.num_nodes, extra_args)
    248         self.start_nodes()
    249 
    250+    def import_deterministic_coinbase_privkeys(self):
    


    jnewbery commented at 5:41 pm on September 10, 2018:
    Can you add a call to import_deterministic_coinbase_privkeys() to setup_nodes()? Would that reduce the number of tests that you need to change in this commit?

    MarcoFalke commented at 8:54 pm on September 10, 2018:
    Good idea to call this by default… This is now always called before run_test, unless self.setup_clean_chain is set.
  8. jnewbery commented at 5:42 pm on September 10, 2018: member

    Concept ACK.

    A couple of suggested changes inline. There are also a bunch of unrelated style changes in your commit. Can you remove those or split them into their own commit?

  9. MarcoFalke force-pushed on Sep 10, 2018
  10. MarcoFalke force-pushed on Sep 10, 2018
  11. in test/functional/test_framework/test_node.py:103 in faa669cbcd outdated
     96@@ -97,6 +97,22 @@ def __init__(self, i, datadir, *, rpchost, timewait, bitcoind, bitcoin_cli, mock
     97 
     98         self.p2ps = []
     99 
    100+    def get_deterministic_priv_key(self):
    101+        """Return a deterministic priv key in base58, that only depends on the node's index"""
    102+        PRIV_KEYS = [
    103+            # adress , privkey
    


    practicalswift commented at 7:37 am on September 11, 2018:

    codespell:

    0test/functional/test_framework/test_node.py:103: adress  ==> address
    

    MarcoFalke commented at 1:23 pm on September 13, 2018:
    Fixed typo
  12. in test/functional/wallet_listreceivedby.py:24 in fa513ea54d outdated
    17@@ -18,6 +18,11 @@ class ReceivedByTest(BitcoinTestFramework):
    18     def set_test_params(self):
    19         self.num_nodes = 2
    20 
    21+    def import_deterministic_coinbase_privkeys(self):
    22+        assert_equal(0, len(self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True)))
    23+        super().import_deterministic_coinbase_privkeys()
    24+        self.num_cb_reward_addresses = len(self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True))
    


    ryanofsky commented at 8:11 pm on September 12, 2018:
    Maybe substitute cb_reward with just coinbase to be more consistent.
  13. in test/functional/wallet_dump.py:32 in faa669cbcd outdated
    33-                # key = key_label.split(" ")[0]
    34-                keytype = key_label.split(" ")[2]
    35-                if len(comment) > 1:
    36-                    addr_keypath = comment.split(" addr=")[1]
    37-                    addr = addr_keypath.split(" ")[0]
    38+                key_date_label, comment = line.split("#")
    


    ryanofsky commented at 8:22 pm on September 12, 2018:
    Previous code and new changes here are pretty inscrutable. Can you explain at a high level what is changing here and why? Can you perhaps add comments to the code to make it clearer, for example to explain why new code skips lines containing 1970?

    MarcoFalke commented at 1:24 pm on September 13, 2018:
    Added a comment. Note that it is easier to see that nothing changed with –ignore-all-space
  14. in test/functional/feature_fee_estimation.py:175 in faa669cbcd outdated
    167@@ -168,6 +168,11 @@ def transact_and_mine(self, numblocks, mining_node):
    168                     newmem.append(utx)
    169             self.memutxo = newmem
    170 
    171+    def import_deterministic_coinbase_privkeys(self):
    172+        self.start_nodes()
    


    ryanofsky commented at 8:27 pm on September 12, 2018:
    Couldn’t the test framework implementation of import_deterministic_coinbase_privkeys be smart enough to know whether nodes are running or not with node.is_node_stopped (or other state)? It seems unfortunate that an individual test would need to override the import_deterministic_coinbase_privkeys method to get such basic functionality.
  15. in test/functional/interface_zmq.py:44 in faa669cbcd outdated
    39@@ -40,6 +40,13 @@ def set_test_params(self):
    40     def setup_nodes(self):
    41         skip_if_no_py3_zmq()
    42         skip_if_no_bitcoind_zmq(self)
    43+
    44+        # Import keys
    


    ryanofsky commented at 8:30 pm on September 12, 2018:
    Why doesn’t the default framework import_deterministic_coinbase_privkeys call work in this test? There should be a comment here to explain why this override is needed if the default behavior can’t be fixed.

    MarcoFalke commented at 1:24 pm on September 13, 2018:
    Removed the unneeded import_deterministic_coinbase_privkeys
  16. in test/functional/wallet_import_rescan.py:120 in faa669cbcd outdated
    115@@ -116,10 +116,19 @@ def setup_network(self):
    116                 extra_args[i] += ["-prune=1"]
    117 
    118         self.add_nodes(self.num_nodes, extra_args=extra_args)
    119+
    120+        # Import keys
    


    ryanofsky commented at 8:35 pm on September 12, 2018:
    Can you add comment explaining need for this override? The stop_nodes immediately followed by start_nodes below seems very odd. And given that this is a wallet test, maybe it would be simpler to just keep the old behavior and just use the wallet instead of generating to hardcoded addresses?

    MarcoFalke commented at 1:23 pm on September 13, 2018:
    Added a comment
  17. qa: Fix codespell error and have lint-spelling error instead of warn e413c2ddd1
  18. MarcoFalke renamed this:
    qa: Premine to deterministic address with -disablewallet
    qa: Fixups to "Run all tests even if wallet is not compiled"
    on Sep 13, 2018
  19. qa: Remove unneded import_deterministic_coinbase_privkeys overwrite, add comments fa8433e379
  20. MarcoFalke force-pushed on Sep 13, 2018
  21. ryanofsky commented at 7:08 pm on September 13, 2018: member
    utACK fa8433e3797a574937009c1b0843f44d8d7b5358, thanks for cleanup!
  22. MarcoFalke merged this on Sep 13, 2018
  23. MarcoFalke closed this on Sep 13, 2018

  24. MarcoFalke referenced this in commit efb11d7c05 on Sep 13, 2018
  25. MarcoFalke deleted the branch on Sep 13, 2018
  26. sipa referenced this in commit 27bf14f6f3 on Oct 17, 2018
  27. PastaPastaPasta referenced this in commit 329d9eafea on Jul 17, 2021
  28. UdjinM6 referenced this in commit b85b315471 on Jul 19, 2021
  29. PastaPastaPasta referenced this in commit 9e7bb84a01 on Jul 19, 2021
  30. PastaPastaPasta referenced this in commit 07abb538c3 on Jul 19, 2021
  31. PastaPastaPasta referenced this in commit e35dbc49ab on Jul 20, 2021
  32. PastaPastaPasta referenced this in commit 077f21875f on Jul 21, 2021
  33. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 12:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me