Commit graph

2994 commits

Author SHA1 Message Date
Andrew Chow 59d3da5bce Do addmultisigaddress tests in legacy wallet mode in wallet_address_types.py
addmultisigaddress is not available in descriptor wallets, so only run
these when testing legacy wallets
2020-11-01 17:54:19 -05:00
Andrew Chow 25bc5dccbf Use importdescriptors when in descriptor wallet mode in wallet_createwallet.py
sethdseed and importmulti are not available for descriptor wallets, so
when doing descriptor wallet tests, use importdescriptors instead.

Also changes some output to match what descriptor wallets will return.
2020-11-01 17:54:19 -05:00
Andrew Chow 0bd1860300 Avoid dumpprivkey and watchonly behavior in rpc_signrawtransaction.py
dumpprivkey and watchonly behavior don't work with descriptor wallets.

Test for multisigs is modified to not rely on watchonly behavior for
those multisigs. This has a side effect of removing listunspent, but
that's not the target of this test, so that's fine.
2020-11-01 17:54:19 -05:00
Andrew Chow 08067aebfd Add script equivalent of functions in address.py 2020-11-01 17:54:19 -05:00
Andrew Chow 86968882a8 Add descriptor wallet output to tool_wallet.py
Descriptor wallets output slightly different information in the wallet
tool, so check that output when in descriptor wallet mode.
2020-11-01 17:54:19 -05:00
Andrew Chow 3457679870 Use separate watchonly wallet for multisig in feature_nulldummy.py
Create and import the multisig into a separate watchonly wallet so that
feature_nulldummy.py works with descriptor wallets.

blocktools.create_raw_transaction is also updated to use multiple nodes
and wallets and to use PSBT so that this test passes.
2020-11-01 17:54:19 -05:00
Andrew Chow a42652ec10 Move import and watchonly tests to be legacy wallet only in wallet_balance.py
Imports and watchonly behavior are legacy wallet only, so make them only
run when the test is in legacy wallet mode.
2020-11-01 17:54:19 -05:00
Andrew Chow 4b871909d6 Use importdescriptors for descriptor wallets in wallet_bumpfee.py
If using descriptor wallets, use importdescriptors instead of
importmulti.
2020-11-01 17:54:19 -05:00
Andrew Chow c2711e4230 Avoid dumpprivkey in wallet_listsinceblock.py
Generate a privkey in the test framework instead of using dumpprivkey so
that descriptor wallets work in this test.
2020-11-01 17:54:19 -05:00
Andrew Chow 553dbf9af4 Make import tests in wallet_listtransactions.py legacy wallet only
Existing import* RPCs are disabled for descriptor wallets, so only do
these tests for legacy wallets.
2020-11-01 17:54:19 -05:00
Andrew Chow dc81418fd0 Use a separate watchonly wallet in rpc_fundrawtransaction.py
Import things into a separate watchonly wallet to work with descriptor
wallets.
2020-11-01 17:54:19 -05:00
Andrew Chow a357111047 Update wallet_importprunedfunds to avoid dumpprivkey
Removes the use of dumpprivkey so that descriptor wallets can pass on
this. Also does a few descriptor wallet specific changes due to
different IsMine semantics.
2020-11-01 17:54:19 -05:00
Andrew Chow 7411876c75 Ensure a legacy wallet for BDB format check 2020-10-29 14:59:29 -04:00
Andrew Chow 586640381a Skip --descriptor tests if sqlite is not compiled 2020-10-29 12:34:16 -04:00
MarcoFalke 42b66a6b81
Merge #20186: wallet: Make -wallet setting not create wallets
01476a88a6 wallet: Make -wallet setting not create wallets (Russell Yanofsky)

Pull request description:

  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.

  ---

  This PR is implementing the simplest, most basic alternative listed in https://github.com/bitcoin-core/gui/issues/95#issuecomment-694236940. Other improvements mentioned there can build on top of this.

ACKs for top commit:
  achow101:
    ACK 01476a88a6
  hebasto:
    re-ACK 01476a88a6
  MarcoFalke:
    review ACK 01476a88a6 🏂

Tree-SHA512: 0d50f4e5dfbd04a2efd9fd66c02085a0ed705807bdec1cf5770d0ae8cb6af07080fb81306349937bf66acdb713d03fb35636f6442b650d0820e66cbae09c2f87
2020-10-29 15:01:39 +01:00
Wladimir J. van der Laan 6196cf77e5
Merge #19753: p2p: don't add AlreadyHave transactions to recentRejects
d419fdedbe [net processing] Don't add AlreadyHave txs to recentRejects (Troy Giorshev)

Pull request description:

  If we already have a transaction, don't add it to recentRejects

  Now, we only add a transaction to our recentRejects filter if we didn't already have it, meaning that it is added at most once, as intended.

ACKs for top commit:
  jnewbery:
    Code review ACK d419fdedbe
  laanwj:
    Code review ACK d419fdedbe

Tree-SHA512: cff5c1ba36c4700e2d6ab3eec4a3e51e1bef28fb3cc1bc850c84e06d6e5a9f6c32825207c253cc9cdf596b2eaadb6b5be68b3f8ca752b4ef6c31cf85138e3c99
2020-10-29 11:40:15 +01:00
John Newbery 778cd0d88d [tests] Remove getnettotals/getpeerinfo consistency test
We make no guarantees about consistency between RPC calls.
2020-10-28 10:18:09 +00:00
Amiti Uttarwar 47ff5098ad [test] Clarify setup of node topology.
Since the test framework automatically sets up a connection between the nodes,
the second connect_nodes call was a no-op. Remove the redundant call & add
comments to explain the expected topology.
2020-10-27 19:23:02 -07:00
Amiti Uttarwar 0672522aed [move-only, test]: Match test order with run order 2020-10-27 13:45:25 -07:00
Troy Giorshev d419fdedbe [net processing] Don't add AlreadyHave txs to recentRejects
Now, we only add a transaction to our recentRejects filter if we didn't
already have it, meaning that it is added at most once, as intended.
2020-10-27 06:07:41 -04:00
Wladimir J. van der Laan 83363f7b62
Merge #20167: test: Add test for -blockversion
fa9b48549c test: Add test for -blockversion (MarcoFalke)
fa7fb0e442 test: Default blockversion to 4 in feature_block (MarcoFalke)
fa2b778d0c test: Remove unused -blockversion from tests (MarcoFalke)

Pull request description:

  `-blockversion` is currently untested, as in: The setting could be made a no-op without any tests failing. Fix that by adding an explicit test for it. Also, related minor cleanups.

ACKs for top commit:
  guggero:
    ACK fa9b48549c.

Tree-SHA512: 1b2e792f7ed0ec1db163476ee8a938f8f7cb3691f797c721bbe55fdeed92487c2ff83b55467440096917999406c86430cb3a615383cefb4f621828309ff6a1e7
2020-10-27 10:57:57 +01:00
MarcoFalke fa9b48549c
test: Add test for -blockversion 2020-10-26 16:31:25 +01:00
MarcoFalke 88271184e8
Merge #20112: test: Speed up wallet_resendwallettransactions with mockscheduler RPC
fa299ac273 test: Speed up wallet_resendwallettransactions test with mockscheduler RPC (MarcoFalke)

Pull request description:

  Also fixes #20143

ACKs for top commit:
  guggero:
    ACK fa299ac2

Tree-SHA512: 024ced4aa5f5c266e24fd0583d47b45b19c2a6ae25a06fabeacaa0ac996eec0c45f11cc34b2df17d01759b78ed31a991aa86978aafcc76cb0017382f601bf85a
2020-10-22 14:18:06 +02:00
MarcoFalke 7012db2a6b
Merge #20176: test: Fix intermittent issue in p2p_feefilter
fa5a91a352 test: Fix typo (one tx is enough) in p2p_feefilter (MarcoFalke)
fa3af2c0d3 test: Fix intermittent issue in p2p_feefilter (MarcoFalke)

Pull request description:

  Fixes:

  ```
  Traceback (most recent call last):
    File "test/functional/test_framework/test_framework.py", line 126, in main
      self.run_test()
    File "test/functional/p2p_feefilter.py", line 63, in run_test
      self.test_feefilter()
    File "test/functional/p2p_feefilter.py", line 117, in test_feefilter
      txids = [miniwallet.send_self_transfer(fee_rate=Decimal('0.00020000'), from_node=node1)['wtxid'] for _ in range(3)]
    File "test/functional/p2p_feefilter.py", line 117, in <listcomp>
      txids = [miniwallet.send_self_transfer(fee_rate=Decimal('0.00020000'), from_node=node1)['wtxid'] for _ in range(3)]
    File "test/functional/test_framework/wallet.py", line 63, in send_self_transfer
      txid = from_node.sendrawtransaction(tx_hex)
    File "test/functional/test_framework/coverage.py", line 47, in __call__
      return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
    File "test/functional/test_framework/authproxy.py", line 146, in __call__
      raise JSONRPCException(response['error'], status)
  test_framework.authproxy.JSONRPCException: bad-txns-inputs-missingorspent (-25)

ACKs for top commit:
  guggero:
    ACK fa5a91a3

Tree-SHA512: 51d885753f72e1c91c4580709c15bdab60ff8c9d6f9bcb6db78a560e7e4dd7f76ce23add3303b374174afa3f11f74aa61db189a90c68d7f7655b15e64f51ed96
2020-10-22 11:02:33 +02:00
MarcoFalke 1cb4e339f9
Merge #20039: test: Convert amounts from float to decimal
5aadd4be18 Convert amounts from float to decimal (Prayank)

Pull request description:

  > decimal is preferred in accounting applications

  https://docs.python.org/3.8/library/decimal.html

  Decimal type saves an exact value so better than using float.

  ~~3 variables declared with type as 'Decimal' in [test/functional/mempool_accept.py](https://github.com/bitcoin/bitcoin/blob/master/test/functional/mempool_accept.py): fee, fee_expected, output_amount~~

  ~~Not required to convert to string anymore for using the above variables as decimal~~

  + fee, fee_expected, output_amount
  ~~+ 8 decimal places~~
  + Using value of coin['amount'] as decimal and removed 'int'
  + Removed unnecessary parentheses
  + Remove str() and use quotes

  Fixes https://github.com/bitcoin/bitcoin/issues/20011

ACKs for top commit:
  guggero:
    ACK 5aadd4be18

Tree-SHA512: 5877cf3837e5b65bec0fc8909de141a720bfa02a747513e21d20f3c41ec0cfecc524d2c347a96596b0a1a97900da2acf08b799f26b11d537e4dcddc6ce45f38e
2020-10-22 10:13:44 +02:00
MarcoFalke fa5f46600f
test: Fix rpc_net intermittent issue 2020-10-21 21:07:28 +02:00
Prayank 5aadd4be18 Convert amounts from float to decimal
+ fee, fee_expected, output_amount
+ Using value of coin['amount'] as decimal and removed 'int'
+ Removed unnecessary parentheses
+ Remove str() and use quotes
2020-10-21 21:21:39 +05:30
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
MarcoFalke b46f37ba5e
Merge #20198: Show name, format and if uses descriptors in bitcoin-wallet tool
fa4074b395 Show name, format and if uses descriptors in bitcoin-wallet tool (Jonas Schnelli)

Pull request description:

ACKs for top commit:
  MarcoFalke:
    ACK fa4074b395
  jonatack:
    re-ACK fa4074b395

Tree-SHA512: cf6ee96ff21532fc4b0ba7a0fdfdc1fa485c9b1495447350fe65cd0bd919e0e0280613933265cdee069b8c29ccf015ac374535a70cac3d4fb89f4d08b3a03519
2020-10-21 14:48:43 +02:00
Jonas Schnelli fa4074b395 Show name, format and if uses descriptors in bitcoin-wallet tool 2020-10-21 13:28:15 +02:00
Elliott Jin 3c7d9ab8c8 test: Move (dis)?connect_nodes globals into TestFramework as helpers 2020-10-20 00:43:00 -07: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
Elliott Jin be386840d4 test: Replace use of (dis)?connect_nodes globals
A later scripted-diff commit replaces the majority of uses, which all
follow this pattern:

    (dis)?connect_nodes(self.nodes[a], b)

This commit replaces the few "special cases".
2020-10-20 00:27:45 -07:00
Samuel Dobson f5bd46a4cc
Merge #20125: rpc, wallet: Expose database format in getwalletinfo
624bab00dd test: add coverage for getwalletinfo format field (Jon Atack)
5e737a0092 rpc, wallet: Expose database format in getwalletinfo (João Barbosa)

Pull request description:

  Support for sqlite based wallets was added in #19077. This PR adds the `format` key in `getwalletinfo` response, that can be `bdb` or  `sqlite`.

ACKs for top commit:
  jonatack:
    Tested ACK 624bab00dd
  laanwj:
    Code review ACK 624bab00dd.
  MarcoFalke:
    doesn't hurt ACK 624bab00dd
  hebasto:
    ACK 624bab00dd, tested on Linux Mint 20 (x86_64).
  meshcollider:
    utACK 624bab00dd

Tree-SHA512: a81f8530f040f6381d33e073a65f281993eccfa717424ab6e651c1203cbaf27794dcb7175570459e7fdaa211565bc060d0a3ecbe70d2b6f9c49b8d5071e4441c
2020-10-20 12:35:33 +13:00
MarcoFalke 4769942d90
Merge #19624: Warn on unknown rw_settings
fa48405ef8 Warn on unknown rw_settings (MarcoFalke)

Pull request description:

  Log a warning to debug log if unknown settings are encountered. This should probably only ever happen when the software is upgraded.

  Something similar is already done for the command line and config file. See:

  * test: Add test for unknown args #16234 (commit fa7dd88b71)

ACKs for top commit:
  ryanofsky:
    Code review ACK fa48405ef8. Looks good and I could see this being helpful for debugging. Thanks for taking suggestions

Tree-SHA512: cec7d88adf84fa0a842f56b26245157736eb50df433db951e622ea07fd145b899822b24cdab1d8b36c066415ce4f0ef09b493fa8a8d691532822a59c573aafa7
2020-10-19 11:30:49 +02:00
MarcoFalke fa5a91a352
test: Fix typo (one tx is enough) in p2p_feefilter 2020-10-19 09:42:40 +02:00
MarcoFalke faab86f6c8
test: Fix intermittent issue in wallet_send 2020-10-18 11:02:59 +02:00
MarcoFalke faca3734c0
test: Fix intermittent issue in wallet_import_rescan 2020-10-18 10:10:20 +02:00
MarcoFalke 80c8a02f1b
Merge #20159: test: mining_getblocktemplate_longpoll.py improvements (use MiniWallet, add logging)
b128b56672 test: add logging for mining_getblocktemplate_longpoll.py (Sebastian Falbesoner)
8ee3536b2b test: remove unused helpers random_transaction(), make_change() and gather_inputs() (Sebastian Falbesoner)
fddce7e199 test: use MiniWallet for mining_getblocktemplate_longpoll.py (Sebastian Falbesoner)

Pull request description:

  This PR enables one more of the non-wallet functional tests (mining_getblocktemplate_longpoll.py) to be run even with the Bitcoin Core wallet disabled by using the new MiniWallet instead, as proposed in #20078. Also adds missing log messages for the subtests.

  This was the only functional test that used the `random_transaction` helper in `test_framework/util.py`, hence it is removed, together with other helpers (`make_change` and `gather_inputs`) that were again only used by `random_transaction`.

ACKs for top commit:
  MarcoFalke:
    ACK b128b56672

Tree-SHA512: 09a5fa7b0f5976a47040f7027236d7ec0426d5a4829a082221c4b5fae294470230e89ae3df0bca0eea26833162c03980517f5cc88761ad251c3df4c4a49bca46
2020-10-17 17:57:23 +02:00
MarcoFalke fa3af2c0d3
test: Fix intermittent issue in p2p_feefilter 2020-10-17 17:48:03 +02:00
Sebastian Falbesoner b128b56672 test: add logging for mining_getblocktemplate_longpoll.py 2020-10-16 15:41:00 +02:00
Sebastian Falbesoner 8ee3536b2b test: remove unused helpers random_transaction(), make_change() and gather_inputs() 2020-10-16 15:40:54 +02:00
MarcoFalke fa7fb0e442
test: Default blockversion to 4 in feature_block
There is one tests that checks version=1 blocks are rejected. For all
other tests the version doesn't matter as long as it is large enough.
2020-10-16 13:28:17 +02:00
Sebastian Falbesoner fddce7e199 test: use MiniWallet for mining_getblocktemplate_longpoll.py
This test can now be run even with the Bitcoin Core wallet disabled.
2020-10-16 13:05:31 +02:00
MarcoFalke fa2b778d0c
test: Remove unused -blockversion from tests 2020-10-16 13:01:07 +02:00
MarcoFalke cb21d864c5
Merge #19401: QA: Use GBT to get block versions correct
d438d609cd QA: Use GBT to get block versions correct (Luke Dashjr)
1df2cd1c8f QA: blocktools: Accept block template to create_block (Luke Dashjr)

Pull request description:

  The goal here is to decouple unrelated tests from the details of block versions.

  Currently, these tests are forcing specific versions of blocks for no real reason.

ACKs for top commit:
  fjahr:
    re-ACK d438d609cd
  benthecarman:
    ACK d438d60

Tree-SHA512: 523b1cd4dac8d65c88432e126ce7f60df96ca4b94f7ecc8e83ba4ffbade23e2afe7055fdf586ce3c195a533f2004e63fff83add4267b39473a581c9f1c6d5340
2020-10-16 11:43:21 +02:00
Pieter Wuille 1d22300b99 Address functional test nits 2020-10-15 15:39:09 -07:00
Wladimir J. van der Laan 0d22482353
Merge #20002: net, rpc, cli: expose peer network in getpeerinfo; simplify/improve -netinfo
6272604bef refactor: enable -netinfo to add future networks (i2p, cjdns) (Jon Atack)
82fd40216c refactor: promote some -netinfo localvars to class members (Jon Atack)
5133fab37e cli: simplify -netinfo using getpeerinfo network field (Jon Atack)
4938a109ad rpc, test: expose CNodeStats network in RPC getpeerinfo (Jon Atack)
6df7882029 net: add peer network to CNodeStats (Jon Atack)

Pull request description:

  This PR:

  - builds on #19991 and #19998
  - exposes peer networks via a new getpeerinfo `network` field ("ipv4", "ipv6", or "onion"), and adds functional tests
  - updates -netinfo to use getpeerinfo `network` rather than detecting the peer networks client-side
  - refactors -netinfo to easily add future networks

ACKs for top commit:
  laanwj:
    ACK 6272604bef

Tree-SHA512: 28883487585135ceaaf84ce09131f2336e3193407f2e3df0960e3f4ac340f500ab94ffecb9d06a4c49bc05e3cca4f914ea4379860bea0bd5df2f834f74616015
2020-10-15 17:44:38 +02:00
Jon Atack 624bab00dd
test: add coverage for getwalletinfo format field 2020-10-15 16:46:34 +02:00
MarcoFalke 560dea9b26
Merge #19770: RPC: getpeerinfo: Deprecate "whitelisted" field (replaced by "permissions")
5b57dc5458 RPC: getpeerinfo: Wrap long help line for bytesrecv_per_msg (Luke Dashjr)
d681a28219 RPC: getpeerinfo: Deprecate "whitelisted" field (replaced by "permissions") (Luke Dashjr)

Pull request description:

  If we were going to continue support for "whitelisted", we should have probably made it true if any permission flag was set, rather than only if "default permissions" were used.

  This corrects the description, and deprecates it.

ACKs for top commit:
  laanwj:
    ACK 5b57dc5458

Tree-SHA512: a2e2137f8be8110357c1b2fef2c923fa8c7c4a49b0b2b3a2d78aedf12f8ed5cc7e140018a21b37e6ec7770ed4007542aeef7ad4558973901b107e8e0f81d6003
2020-10-15 11:49:34 +02:00