Commit Graph

26395 Commits

Author SHA1 Message Date
MarcoFalke
fa1dea19fc
test: Fix deser issue in create_block
Without the fix a hex-string can not be parsed:

File "./test/functional/test_framework/blocktools.py", line 82, in create_block
    txo.deserialize(io.BytesIO(tx))
TypeError: a bytes-like object is required, not 'str'

Also, remove io import and repace it with our FromHex() helper
2020-11-03 12:25:55 +01:00
MarcoFalke
fa762a3fd4
test: Remove unused unnamed parameter from block.serialize call
All blocks and transactions are serialized with witness, no need to set
this
2020-11-03 12:23:21 +01:00
Jonas Schnelli
58cfbc38e0 Ignoring (but warn) on duplicate -wallet parameters 2020-11-03 12:06:32 +01:00
MarcoFalke
218fe60d91
Merge #20290: fuzz: Fix DecodeHexTx fuzzing harness issue
28f8cb13d4 fuzz: Fix DecodeHexTx fuzzing harness issue (practicalswift)

Pull request description:

  Fix `DecodeHexTx` fuzzing harness issue.

  Before this patch:

  ```
  $ src/test/fuzz/decode_tx
  decode_tx: test/fuzz/decode_tx.cpp:29:
      void test_one_input(const std::vector<uint8_t> &):
      Assertion `result_try_witness_and_maybe_no_witness' failed.
  …
  ```

  After this patch:

  ```
  $ src/test/fuzz/decode_tx
  …
  ```

ACKs for top commit:
  MarcoFalke:
    review ACK 28f8cb13d4

Tree-SHA512: 2ed11b2f00a4c6fa3e8eea76a2a37d89a4b8d52815264676fe3de0a26ad7906cfafda9b843ceede2fd428815472e01fd1f87afb851282a8c7839bd4c87dc382b
2020-11-03 09:48:15 +01:00
MarcoFalke
5174b534da
Merge #20289: fuzz: Check for addrv1 compatibility before using addrv1 serializer/deserializer on CService
c2cf8a18c2 fuzz: Check for addrv1 compatibility before using addrv1 serializer on CService (practicalswift)

Pull request description:

  Check for addrv1 compatibility before using addrv1 serializer/deserializer on `CService`:

  Before this patch:

  ```
  $ src/test/fuzz/service_deserialize
  service_deserialize: test/fuzz/deserialize.cpp:85:
      void (anonymous namespace)::AssertEqualAfterSerializeDeserialize(const T &, const int) [T = CService]:
      Assertion `Deserialize<T>(Serialize(obj, version)) == obj' failed.
  ```

  After this patch:

  ```
  $ src/test/fuzz/service_deserialize
  …
  ```

  Related change: #20247

ACKs for top commit:
  MarcoFalke:
    review ACK c2cf8a18c2

Tree-SHA512: dba6ddc60e8ef621011d844281461f1741de08c4af1a2b7156c810af44306cef7ec582de5974752db02ca085cfd23da0296d70b694e59ee262589d829fa0626e
2020-11-03 09:14:22 +01:00
fanquake
8387f832d6
Merge #20187: Addrman: test-before-evict bugfix and improvements for block-relay-only peers
16d9bfc417 Avoid test-before-evict evictions of current peers (Suhas Daftuar)
e8b215a086 Refactor test for existing peer connection into own function (Suhas Daftuar)
4fe338ab3e Call CAddrMan::Good() on block-relay-only peer addresses (Suhas Daftuar)
daf5553126 Avoid calling CAddrMan::Connected() on block-relay-only peer addresses (Suhas Daftuar)

Pull request description:

  This PR does two things:

  * Block-relay-only interaction with addrman.
    * Calling `CAddrMan::Connected()` on an address that was a block-relay-only peer causes the time we report in `addr` messages containing that peer to be updated; particularly now that we use anchor connections with a our block-relay-only peers, this risks leaking information about those peers.  So, stop this.
    * Avoiding calling `CAddrMan::Good()` on block-relay-only peer addresses causes the addrman logic around maintaining the new and tried table to be less good, and in particular makes it so that block-relay-only peer addresses are more likely to be evicted from the addrman (for no good reason I can think of).  So, mark those addresses as good when we connect.

  * Fix test-before-evict bug. There's a bug where if we get a collision in the tried table with an existing address that is one of our current peers, and the connection is long-lived enough, then `SelectTriedCollisions()` might return that existing peer address to us as a test-before-evict connection candidate. However, our logic for new outbound connections would later prevent us from actually making a connection; the result would be that when we get a collision with a long-lived current peer, that peer's address is likely to get evicted from the tried table.  Fix this by checking to see if a test-before-evict candidate is a peer we're currently connected to, and if so, mark it as `Good()`.

ACKs for top commit:
  sipa:
    utACK 16d9bfc417
  amitiuttarwar:
    code review ACK 16d9bfc417
  mzumsande:
    Code-Review ACK 16d9bfc417.
  jnewbery:
    utACK 16d9bfc417
  ariard:
    Code Review ACK 16d9bfc.
  jonatack:
    Tested ACK 16d9bfc417

Tree-SHA512: 188ccb814e436937cbb91d29d73c316ce83f4b9c22f1cda56747f0949a093e10161ae724e87e4a2d85ac40f85f5f6b4e87e97d350a1ac44f80c57783f4423324
2020-11-03 09:38:35 +08:00
practicalswift
28f8cb13d4 fuzz: Fix DecodeHexTx fuzzing harness issue 2020-11-02 22:21:03 +00:00
practicalswift
c2cf8a18c2 fuzz: Check for addrv1 compatibility before using addrv1 serializer on CService 2020-11-02 21:45:40 +00:00
Wladimir J. van der Laan
ca18860563
Merge #20263: Update assumed chain params
fa90ba36d3 Update assumed chain params (MarcoFalke)

Pull request description:

  > Oh, by the way, the same procedure as last year, Miss Sophie?
  > Same procedure as every year, James.

  See https://github.com/bitcoin/bitcoin/blob/master/doc/release-process.md#before-branch-off

ACKs for top commit:
  jonatack:
    ACK fa90ba36d3 per `git diff fa0c1b5 fa90ba3` and re-running getblockheader/getblockhash/getchaintxstats on the signet chain
  dergoegge:
    ACK fa90ba36d3 - mainnet and testnet data matches my node.
  theStack:
    re-ACK fa90ba36d3 ✔️
  darosior:
    re-ACK fa90ba36d3 for mainnet and testnet.

Tree-SHA512: 83044cc59d9fc873cb29f13008d00b54cb4bb4646c1ca53ab4f429e7333a32402becb888d3be117d390c1297c2f7d083f77ae12ac8633265edceb3cfefac087f
2020-11-02 18:53:23 +01:00
Wladimir J. van der Laan
ef4c7c4e0b
Merge #18788: tests: Update more tests to work with descriptor wallets
c7b7e0a692 tests: Make only desc wallets for wallet_multwallet.py --descriptors (Andrew Chow)
d4b67ad214 Avoid creating legacy wallets in wallet_importdescriptors.py (Andrew Chow)
6c9c12bf87 Update feature_backwards_compatibility for descriptor wallets (Andrew Chow)
9a4c631e1c Update wallet_labels.py to not require descriptors=False (Andrew Chow)
242aed7cc1 tests: Add a --legacy-wallet that is mutually exclusive with --descriptors (Andrew Chow)
388053e172 Disable some tests for tool_wallet when descriptors (Andrew Chow)
47d3243160 Make raw multisig tests legacy wallet only in rpc_rawtransaction.py (Andrew Chow)
59d3da5bce Do addmultisigaddress tests in legacy wallet mode in wallet_address_types.py (Andrew Chow)
25bc5dccbf Use importdescriptors when in descriptor wallet mode in wallet_createwallet.py (Andrew Chow)
0bd1860300 Avoid dumpprivkey and watchonly behavior in rpc_signrawtransaction.py (Andrew Chow)
08067aebfd Add script equivalent of functions in address.py (Andrew Chow)
86968882a8 Add descriptor wallet output to tool_wallet.py (Andrew Chow)
3457679870 Use separate watchonly wallet for multisig in feature_nulldummy.py (Andrew Chow)
a42652ec10 Move import and watchonly tests to be legacy wallet only in wallet_balance.py (Andrew Chow)
4b871909d6 Use importdescriptors for descriptor wallets in wallet_bumpfee.py (Andrew Chow)
c2711e4230 Avoid dumpprivkey in wallet_listsinceblock.py (Andrew Chow)
553dbf9af4 Make import tests in wallet_listtransactions.py legacy wallet only (Andrew Chow)
dc81418fd0 Use a separate watchonly wallet in rpc_fundrawtransaction.py (Andrew Chow)
a357111047 Update wallet_importprunedfunds to avoid dumpprivkey (Andrew Chow)

Pull request description:

  I went through all the tests and checked whether they passed with descriptor wallets. This partially informed some changes in #16528. Some tests needed changes to work with descriptor wallets. These were primarily due to import and watchonly behavior. There are some tests and test cases that only test legacy wallet behavior so those tests won't be run with descriptor wallets.

  This PR updates more tests to have to the `--descriptors` switch in `test_runner.py`. Additionally a mutually exclusive `--legacy-wallet` option has been added to force legacy wallets. This does nothing currently but will be useful in the future when descriptor wallets are the default. For the tests that rely on legacy wallet behavior, this option is being set so that we don't forget in the future. Those tests are `feature_segwit.py`, `wallet_watchonly.py`, `wallet_implicitsegwit.py`, `wallet_import_with_label.py`, and `wallet_import_with_label.py`.

  If you invert the `--descriptors`/`--legacy-wallet` default so that descriptor wallets are the default, all tests (besides the legacy wallet specific ones) will pass.

ACKs for top commit:
  MarcoFalke:
    review ACK c7b7e0a692 🎿
  laanwj:
    ACK c7b7e0a692

Tree-SHA512: 2f4e87815005d1d0a2543ea7947f7cd7593d8cf5312228ef85f8e096f19739b225769961943049cb44f6f07a35b8de988e2246ab9aca5bb5a0b2e62694d5637d
2020-11-02 18:50:37 +01:00
MarcoFalke
b6a00e76ab
Merge #20279: doc: release process updates/fixups
e5f3e95a8e doc: fix getchaintxstats fields in release-process.md (Jon Atack)

Pull request description:

  ISTM the getchaintxstats fields should be `window_final_block_hash` rather than `window_last_block_hash`. While here, replace getblockchaininfo with getblockheader (and getblockhash) instead of getblockchaininfo for updating the nMinimumChainWork and defaultAssumeValid consensus params, update the example PR, and improve a link with a named anchor tag.

  Markdown rendering here: https://github.com/jonatack/bitcoin/blob/release-process-getchaintxstats-fix/doc/release-process.md

ACKs for top commit:
  theStack:
    re-ACK e5f3e95a8e

Tree-SHA512: 48c9c65f10d65e461da8d4935af56b6c67e6faca94e4593237f754d8c48f03bef2b9b4a71e5d1009b215a415ba7c4c4218aca6dce97238101ca1c81f5d098bdb
2020-11-02 15:58:25 +01:00
MarcoFalke
fae45c34d1
test: Only try witness deserialize when checking for witness deserialize failure 2020-11-02 14:19:44 +01:00
MarcoFalke
c5ec0367d7
Merge #20165: Only relay Taproot spends if next block has it active
3d0556d410 Increase feature_taproot inactive test coverage (Pieter Wuille)
525cbd425e Only relay Taproot spends if next block has it active (Pieter Wuille)

Pull request description:

  There should be no change to mempool transaction behavior for witness v1 transactions as long as no activation is defined. Until that point, we should treat the consensus rules as under debate, and for soft-fork safety, that means spends should be treated as non-standard.

  It's possible to go further: don't relay them unless the consensus rules are actually active for the next block. This extends non-relay to the period where a deployment is defined, started, locked in, or failed. I see no downsides to this, and the code change is very simple.

ACKs for top commit:
  Sjors:
    utACK 3d0556d410
  MarcoFalke:
    review ACK 3d0556d410 🏓
  jnewbery:
    utACK 3d0556d410

Tree-SHA512: ca625a2981716b4b44e8f3722718fd25fd04e25bf3ca1684924b8974fca49f7c1d438fdd9dcdfbc091a442002e20d441d42c41a0e2096e74a61068da6c60267a
2020-11-02 10:12:06 +01:00
Sishir Giri
2ead31fb1b [wallet] Return object from upgradewallet RPC 2020-11-02 08:38:38 +00:00
MarcoFalke
fa90ba36d3
Update assumed chain params 2020-11-02 09:22:08 +01:00
MarcoFalke
867dbeba5f
Merge #20281: docs: Correct getblockstats documentation for (sw)total_weight
5d9917464a docs: Correct getblockstats documentation for (sw)total_weight (Nadav Ivgi)

Pull request description:

ACKs for top commit:
  MarcoFalke:
    ACK 5d9917464a

Tree-SHA512: eb9e8f05c61d5363cf698f0b9b51ff42557e783be64c6a814cd8f4073499ff0cbfe00528b12cc0f5e4de245458a62cbd30eb817a7d1e020ee3cbfa83a95eb550
2020-11-02 08:44:59 +01:00
Samuel Dobson
26d7941224
Merge #20230: wallet: Fix bug when just created encrypted wallet cannot get address
bf6855a909 wallet: Fix bug when just created encrypted wallet cannot get address (Hennadii Stepanov)

Pull request description:

  Fix https://github.com/bitcoin-core/gui/issues/105

ACKs for top commit:
  achow101:
    Tested ACK bf6855a909
  kristapsk:
    ACK bf6855a909
  meshcollider:
    Tested ACK bf6855a909

Tree-SHA512: eca0ab306d7206f2e5db568e83217bd854caac104379f4d8fb261db832d4d6310cbb1eab44ce9b05a5ac2eb5879a623b729752a88810f8370c24518a8d81292d
2020-11-02 11:58:19 +13:00
Andrew Chow
c7b7e0a692 tests: Make only desc wallets for wallet_multwallet.py --descriptors 2020-11-01 17:54:19 -05:00
Andrew Chow
d4b67ad214 Avoid creating legacy wallets in wallet_importdescriptors.py 2020-11-01 17:54:19 -05:00
Andrew Chow
6c9c12bf87 Update feature_backwards_compatibility for descriptor wallets 2020-11-01 17:54:19 -05:00
Andrew Chow
9a4c631e1c Update wallet_labels.py to not require descriptors=False 2020-11-01 17:54:19 -05:00
Andrew Chow
242aed7cc1 tests: Add a --legacy-wallet that is mutually exclusive with --descriptors
Although legacy wallet is still the default, for future use, add a
--legacy-wallet option to the test framework. Additional tests for
descriptor wallets have been enabled with the --descriptors option.
Tests that must be legacy wallet only are being started with
--legacy-wallet. Even though this option does not currently do anything,
this will be helpful in the future when descriptor wallets become the
default.
2020-11-01 17:54:19 -05:00
Andrew Chow
388053e172 Disable some tests for tool_wallet when descriptors
Some tests are legacy wallet only (and make legacy wallets) so they
shouldn't be run when doing descriptor wallet tests.
2020-11-01 17:54:19 -05:00
Andrew Chow
47d3243160 Make raw multisig tests legacy wallet only in rpc_rawtransaction.py
The traditional multisig workflow doesn't work with descriptor wallets
so make these tests legacy wallet only.
2020-11-01 17:54:19 -05:00
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
Samuel Dobson
f1fcbdea25
Merge #20271: doc: Document that wallet salvage is experimental
fab94534b6 doc: Document that wallet salvage is experimental (MarcoFalke)

Pull request description:

  See #20151

ACKs for top commit:
  practicalswift:
    ACK fab94534b6: user safety first
  hebasto:
    ACK fab94534b6, maybe capitalize into "WARNING"?
  meshcollider:
    Trivial ACK fab94534b6

Tree-SHA512: 94912c491facc485293e4333066057933d706d84c7172f615296e7ba998c583c8bd07e751e6f00cd6576e7791007ace321f959181f7bf6a4e15e10d7ec8a1b7e
2020-11-02 11:52:49 +13:00
Samuel Dobson
0c2eb7f8de
Merge #20262: tests: Skip --descriptor tests if sqlite is not compiled
7411876c75 Ensure a legacy wallet for BDB format check (Andrew Chow)
586640381a Skip --descriptor tests if sqlite is not compiled (Andrew Chow)

Pull request description:

  #20156 allows sqlite to not be compiled by configuring `--without-sqlite`. However doing so and then running the test runner will result in all of the `--descriptor` tests to fail. We should be skipping those tests if sqlite was not compiled.

ACKs for top commit:
  practicalswift:
    ACK 7411876c75: patch looks correct
  Sjors:
    tACK 7411876c75
  ryanofsky:
    Code review ACK 7411876c75
  hebasto:
    ACK 7411876c75, tested on Linux Mint 20 (x86_64), tests pass for binaries compiled with:

Tree-SHA512: 1d635a66d2b7bb865300144dfefcfdaf86133aaaa020c8f440a471476ac1205d32f2df704906ce6c2ea48ddf791c3c95055f6291340b4f7b353c1b02cab5cabe
2020-11-02 11:48:22 +13:00
Samuel Dobson
5a6f3c5a01
Merge #20080: Strip any trailing / in -datadir and -blocksdir paths
ad5cef5dfd doc: Update data directory path comments (Hennadii Stepanov)
b19e88230f util: Add StripRedundantLastElementsOfPath function (Hennadii Stepanov)

Pull request description:

  Wallet names in `listwalletdir` RPC are correct now, even if the `-datadir` path has any number of trailing `/`.

  This PR is an alternative to #19933.

  Fixes #19928.

ACKs for top commit:
  MarcoFalke:
    review ACK ad5cef5dfd 🔙
  promag:
    Code review ACK ad5cef5dfd.
  meshcollider:
    Code review + test run ACK ad5cef5dfd

Tree-SHA512: bccabbd6c18243d48d15b2b27201cc0f5984623dcbc635c8740cf74523f359844c36eadd40391142874fcf452a43880bb6afbf89815ae736e499f9a98143a661
2020-11-02 11:41:38 +13:00
Jon Atack
e5f3e95a8e
doc: fix getchaintxstats fields in release-process.md
also:

- use the getblockheader (and getblockhash) RPCs instead of getblockchaininfo
  for updating the nMinimumChainWork and defaultAssumeValid consensus params

- use "RPC" consistently

- update the example PR from 17002 to 20263

- improve a link with a named anchor tag
2020-11-01 22:19:24 +01:00
Nadav Ivgi
5d9917464a
docs: Correct getblockstats documentation for (sw)total_weight 2020-11-01 19:23:05 +02:00
João Barbosa
241434200e refactor: qt: Use vQueueNotifications.clear() 2020-11-01 12:56:10 +00:00
Vasil Dimov
89836a82ee
style: minor improvements as a followup to #19845
Address suggestions:
https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495486760
https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495488051
https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495730125
2020-10-31 17:02:52 +01:00
Pieter Wuille
3d0556d410 Increase feature_taproot inactive test coverage 2020-10-30 15:52:38 -07:00
Pieter Wuille
525cbd425e Only relay Taproot spends if next block has it active 2020-10-30 15:52:19 -07:00
MarcoFalke
fab94534b6
doc: Document that wallet salvage is experimental 2020-10-30 13:53:28 +01:00
Andrew Chow
bd93fc9945 Fix change detection of imported internal descriptors 2020-10-29 17:55:13 -04: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