-
Notifications
You must be signed in to change notification settings - Fork 37.7k
qa: Fixups to "Run all tests even if wallet is not compiled" #14179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
666627b
to
fae497d
Compare
tACK fae497d on macOS 10.13.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
@@ -247,6 +247,14 @@ def setup_nodes(self): | |||
self.add_nodes(self.num_nodes, extra_args) | |||
self.start_nodes() | |||
|
|||
def import_deterministic_coinbase_privkeys(self): | |||
for n in self.nodes: | |||
wallet_enabled = 'Wallet' in [line[3:-3] for line in n.help().splitlines() if line.startswith('==')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -247,6 +247,14 @@ def setup_nodes(self): | |||
self.add_nodes(self.num_nodes, extra_args) | |||
self.start_nodes() | |||
|
|||
def import_deterministic_coinbase_privkeys(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to call this by default... This is now always called before run_test
, unless self.setup_clean_chain
is set.
fa2f2bf
to
faa669c
Compare
def get_deterministic_priv_key(self): | ||
"""Return a deterministic priv key in base58, that only depends on the node's index""" | ||
PRIV_KEYS = [ | ||
# adress , privkey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codespell
:
test/functional/test_framework/test_node.py:103: adress ==> address
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed typo
def import_deterministic_coinbase_privkeys(self): | ||
assert_equal(0, len(self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True))) | ||
super().import_deterministic_coinbase_privkeys() | ||
self.num_cb_reward_addresses = len(self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe substitute cb_reward
with just coinbase
to be more consistent.
test/functional/wallet_dump.py
Outdated
if len(comment) > 1: | ||
addr_keypath = comment.split(" addr=")[1] | ||
addr = addr_keypath.split(" ")[0] | ||
key_date_label, comment = line.split("#") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment. Note that it is easier to see that nothing changed with --ignore-all-space
@@ -168,6 +168,11 @@ def transact_and_mine(self, numblocks, mining_node): | |||
newmem.append(utx) | |||
self.memutxo = newmem | |||
|
|||
def import_deterministic_coinbase_privkeys(self): | |||
self.start_nodes() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
test/functional/interface_zmq.py
Outdated
@@ -40,6 +40,13 @@ def set_test_params(self): | |||
def setup_nodes(self): | |||
skip_if_no_py3_zmq() | |||
skip_if_no_bitcoind_zmq(self) | |||
|
|||
# Import keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the unneeded import_deterministic_coinbase_privkeys
@@ -116,10 +116,19 @@ def setup_network(self): | |||
extra_args[i] += ["-prune=1"] | |||
|
|||
self.add_nodes(self.num_nodes, extra_args=extra_args) | |||
|
|||
# Import keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment
fa513ea
to
fa8433e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK fa8433e, thanks for cleanup!
…iled" fa8433e qa: Remove unneded import_deterministic_coinbase_privkeys overwrite, add comments (MarcoFalke) e413c2d qa: Fix codespell error and have lint-spelling error instead of warn (MarcoFalke) Pull request description: 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. Tree-SHA512: 9ce26036b0e10f0f888f66a1e50be6a357343f9ffb302ae24a7bb3df2f083a31702ef308b738a03b08a1b623aeddac5d6563dc1b15078c0357b7dafad7808ec3
c32cf6a Add ignored word: mut (practicalswift) 4ae50da Revert "qa: Fix codespell error and have lint-spelling error instead of warn" (practicalswift) Pull request description: Revert `codespell` policy change introduced in #14179. Context: #13954 (comment) Tree-SHA512: 4606b19bb32cdd661f90b3778759818d3493e5ed1a4a2f95982f07eeb6b9c889bc8d53cde31706e0a3b9524c3d3a7378f1b769a60baeb0d00da4c68fd3068114
c32cf6a Add ignored word: mut (practicalswift) 4ae50da Revert "qa: Fix codespell error and have lint-spelling error instead of warn" (practicalswift) Pull request description: Revert `codespell` policy change introduced in bitcoin#14179. Context: bitcoin#13954 (comment) Tree-SHA512: 4606b19bb32cdd661f90b3778759818d3493e5ed1a4a2f95982f07eeb6b9c889bc8d53cde31706e0a3b9524c3d3a7378f1b769a60baeb0d00da4c68fd3068114
c32cf6a Add ignored word: mut (practicalswift) 4ae50da Revert "qa: Fix codespell error and have lint-spelling error instead of warn" (practicalswift) Pull request description: Revert `codespell` policy change introduced in bitcoin#14179. Context: bitcoin#13954 (comment) Tree-SHA512: 4606b19bb32cdd661f90b3778759818d3493e5ed1a4a2f95982f07eeb6b9c889bc8d53cde31706e0a3b9524c3d3a7378f1b769a60baeb0d00da4c68fd3068114
c32cf6a Add ignored word: mut (practicalswift) 4ae50da Revert "qa: Fix codespell error and have lint-spelling error instead of warn" (practicalswift) Pull request description: Revert `codespell` policy change introduced in bitcoin#14179. Context: bitcoin#13954 (comment) Tree-SHA512: 4606b19bb32cdd661f90b3778759818d3493e5ed1a4a2f95982f07eeb6b9c889bc8d53cde31706e0a3b9524c3d3a7378f1b769a60baeb0d00da4c68fd3068114
c32cf6a Add ignored word: mut (practicalswift) 4ae50da Revert "qa: Fix codespell error and have lint-spelling error instead of warn" (practicalswift) Pull request description: Revert `codespell` policy change introduced in bitcoin#14179. Context: bitcoin#13954 (comment) Tree-SHA512: 4606b19bb32cdd661f90b3778759818d3493e5ed1a4a2f95982f07eeb6b9c889bc8d53cde31706e0a3b9524c3d3a7378f1b769a60baeb0d00da4c68fd3068114
…ot compiled" fa8433e qa: Remove unneded import_deterministic_coinbase_privkeys overwrite, add comments (MarcoFalke) e413c2d qa: Fix codespell error and have lint-spelling error instead of warn (MarcoFalke) Pull request description: 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. Tree-SHA512: 9ce26036b0e10f0f888f66a1e50be6a357343f9ffb302ae24a7bb3df2f083a31702ef308b738a03b08a1b623aeddac5d6563dc1b15078c0357b7dafad7808ec3
…ot compiled" fa8433e qa: Remove unneded import_deterministic_coinbase_privkeys overwrite, add comments (MarcoFalke) e413c2d qa: Fix codespell error and have lint-spelling error instead of warn (MarcoFalke) Pull request description: 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. Tree-SHA512: 9ce26036b0e10f0f888f66a1e50be6a357343f9ffb302ae24a7bb3df2f083a31702ef308b738a03b08a1b623aeddac5d6563dc1b15078c0357b7dafad7808ec3
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.