Commit graph

20 commits

Author SHA1 Message Date
Russell Yanofsky 01476a88a6 wallet: Make -wallet setting not create wallets
This changes -wallet setting to only load existing wallets, not create new ones.

- Fixes settings.json corner cases reported by sjors & promag:
  https://github.com/bitcoin-core/gui/issues/95,
  https://github.com/bitcoin/bitcoin/pull/19754#issuecomment-685858578,
  https://github.com/bitcoin/bitcoin/pull/19754#issuecomment-685858578

- Prevents accidental creation of wallets reported most recently by jb55
  http://www.erisian.com.au/bitcoin-core-dev/log-2020-09-14.html#l-355

- Simplifies behavior after #15454. #15454 took the big step of disabling
  creation of the default wallet. This PR extends it to avoid creating other
  wallets as well. With this change, new wallets just aren't created on
  startup, instead of sometimes being created, sometimes not. #15454 release
  notes are updated here and are simpler.

This change should be targeted for 0.21.0. It's a bug fix and simplifies
behavior of the #15937 / #19754 / #15454 features added in 0.21.0.
2020-10-21 08:48:43 -04:00
Prayank 4b16c61461 scripted-diff: test: Replace uses of (dis)?connect_nodes global
-BEGIN VERIFY SCRIPT-

 # max-depth=0 excludes test/functional/test_framework/...
 FILES=$(git grep -l --max-depth 0 "connect_nodes" test/functional)

 # Replace (dis)?connect_nodes(self.nodes[a], b) with self.(dis)?connect_nodes(a, b)
 sed -i 's/\b\(dis\)\?connect_nodes(self\.nodes\[\(.*\)\]/self.\1connect_nodes(\2/g' $FILES

 # Remove imports in the middle of a line
 sed -i 's/\(dis\)\?connect_nodes, //g' $FILES
 sed -i 's/, \(dis\)\?connect_nodes//g' $FILES

 # Remove imports on a line by themselves
 sed -i '/^\s*\(dis\)\?connect_nodes,\?$/d' $FILES
 sed -i '/^from test_framework\.util import connect_nodes$/d' $FILES

-END VERIFY SCRIPT-

Co-authored-by: Elliott Jin <elliott.jin@gmail.com>
2020-10-20 00:42:00 -07:00
Andrew Chow 310b0fde04 Run dumpwallet for legacy wallets only in wallet_backup.py
Descriptor wallets don't support dumpwallet, so make the tests that do
dumpwallet legacy wallet only.
2020-10-14 11:28:18 -04:00
Russell Yanofsky c1585bca8d test: Get rid of default wallet hacks
- Get rid of hardcoded wallet "" names and -wallet="" args
- Get rid of setup_nodes (-wallet, -nowallet, -disablewallet) argument rewriting

Motivation:

- Simplify test framework behavior so it's easier to write new tests without
  having arguments mangled by the framework
- Make tests more readable, replacing unexplained "" string literals with
  default_wallet_name references
- Make it trivial to update default wallet name and wallet data filename for
  sqlite #19077 testing
- Stop relying on -wallet arguments to create wallets, so it is easy to change
  -wallet option in the future to only load existing wallets not create new
  ones (to avoid accidental wallet creation, and encourage use of wallet
  encryption and descriptor features)
2020-09-29 04:35:01 -04:00
Russell Yanofsky ed3acda33b test, refactor: add default_wallet_name and wallet_data_filename variables
No changes in behavior
2020-09-29 04:35:01 -04:00
Andrew Chow 1bee1e6269 Do not create default wallet
No longer create a default wallet. The default wallet will still be
loaded if it exists and not other wallets were specified (anywhere,
including settings.json, bitcoin.conf, and command line).

Tests are updated to be started with -wallet= if they need the default
wallet.

Added test to wallet_startup.py testing that no default wallet is
created and that it is loaded if it exists and no other wallets were
specified.
2020-09-08 21:02:53 -04:00
Sebastian Falbesoner dac7a111bd refactor: test: use _ variable for unused loop counters
substitutes "for x in range(N):" by "for _ in range(N):"
indicates to the reader that a block is just repeated N times, and
that the loop counter is not used in the body
2020-08-06 18:39:33 +02:00
MarcoFalke fa488f131f
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2020-04-16 13:33:09 -04:00
MarcoFalke fa45d60646
test: Reduce unneeded whitelist permissions in tests 2020-02-26 00:00:29 +07:00
Jorge Timón 1abcecc40c
Tests: Use self.chain instead of 'regtest' in almost all current tests 2019-10-26 13:24:39 +02:00
Sebastian Falbesoner 581c9be0d8 test: speedup wallet_backup by whitelisting peers (immediate tx relay)
approaches part of #16613 ("Functional test suite bottlenecks")

The majority of the test time is spent in sync_mempools() after sending to
addresses, i.e. the bottleneck is in relaying transactions. By whitelisting the
peers via -whitelist, the inventory is transmissioned immediately rather than
on average every 5 seconds, speeding up the test by at least a factor of two:

before:
$ time ./wallet_backup.py
real    2m2.523s
user    0m6.093s
sys 0m2.454s

with this PR:
$ time ./wallet_backup_with_whitelist.py
real    0m36.570s
user    0m5.365s
sys 0m1.696s

Note that the test is not deterministic (the sendtoaddress RPC in function
one_send() is executed with a probability of 50%), hence the times could vary
between individual runs.
2019-10-13 02:50:08 +02:00
MarcoFalke fa502cb6f0
test: Bump timeouts in slow running tests 2019-09-16 13:32:13 -04:00
MarcoFalke fafe5f0d09
test: Remove unused imports 2019-04-09 12:10:35 -04:00
MarcoFalke fa16a09215
scripted-diff: use self.sync_* methods
-BEGIN VERIFY SCRIPT-
sed -i -e 's/sync_blocks(self.nodes)/self.sync_blocks()/g'     $(git grep -l 'sync_blocks(self.nodes)'   ./test/functional/*.py)
sed -i -e 's/sync_mempools(self.nodes)/self.sync_mempools()/g' $(git grep -l 'sync_mempools(self.nodes)' ./test/functional/*.py)

sed -i -e 's/  sync_blocks(/  self.sync_blocks(/g'     $(git grep -l sync_blocks   ./test/functional/*.py)
sed -i -e 's/  sync_mempools(/  self.sync_mempools(/g' $(git grep -l sync_mempools ./test/functional/*.py)
-END VERIFY SCRIPT-
2019-04-09 12:09:53 -04:00
MarcoFalke fa3e5786d0
scripted-diff: Remove unused 'split' parameter to setup_network
-BEGIN VERIFY SCRIPT-
sed -i -e 's/, split=False//g' $(git grep -l 'def setup_network')
-END VERIFY SCRIPT-
2018-12-22 17:20:52 +01:00
MarcoFalke fac9539836
qa: Run all tests even if wallet is not compiled 2018-09-10 17:53:21 -04:00
practicalswift 68400d8b96 tests: Use explicit imports 2018-08-13 14:13:39 +02:00
DrahtBot eb7daf4d60 Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
MarcoFalke c8330d4216 qa: Use node.datadir instead of tmpdir in test framework 2018-03-19 12:26:00 -04:00
Anthony Towns 90600bc7db [tests] Rename wallet_* functional tests. 2018-01-25 09:44:29 +10:00
Renamed from test/functional/walletbackup.py (Browse further)