Commit graph

32382 commits

Author SHA1 Message Date
Martin Zumsande
e880bb7836 test: Add test for updating addrman entries
This covers Connected() which updates nTime, and SetServices()
which updates nServices
2021-12-28 21:54:51 +01:00
Martin Zumsande
f02eee8c87 test: introduce utility function to retrieve an addrman 2021-12-28 21:54:51 +01:00
Martin Zumsande
f0e5efb824 test: Remove unused AddrManTest class 2021-12-28 21:54:51 +01:00
Martin Zumsande
b696d7870b test: Remove tests for internal helper functions
The logic of these functions is already covered by existing unit tests
using publicly exposed functions of the interface.
Therefore, removing them does not decrease test coverage.
2021-12-28 21:54:51 +01:00
Martin Zumsande
0538520091 test: use AddrMan instead of AddrManTest where possible
Switches to AddrMan for tests that use no features of AddrManTest.
Also removes unusued AddrManTest variables

Co-Authored-By: Amiti Uttarwar <amiti@uttarwar.org>
2021-12-28 21:54:49 +01:00
Martin Zumsande
1c65d427bb test: Inline SimConnFail function
No need for a function, since it is only used once.

Co-Authored-By: Amiti Uttarwar <amiti@uttarwar.org>
2021-12-28 19:36:22 +01:00
Amiti Uttarwar
5b7aac34f2 test: delete unused GetBucketAndEntry function 2021-12-28 17:26:24 +01:00
Amiti Uttarwar
2ba1e74e59 test: Update addrman_serialization unit test to use AddrMan's interface
By updating the test to use FindEntry, it no longer needs to reach into
AddrMan's internals (via GetBucketAndEntry) to assert expected
behaviors.
2021-12-28 17:26:24 +01:00
Amiti Uttarwar
dad5f76021 addrman: Introduce a test-only function to lookup addresses
Co-Authored-By: Martin Zumsande <mzumsande@gmail.com>
2021-12-28 17:26:24 +01:00
Rojar Smith
1fa2e80190 Include patches for Guix 2021-12-28 23:02:29 +08:00
MarcoFalke
587cbca826
Merge bitcoin/bitcoin#23873: test: use MiniWallet for p2p_compactblocks.py
d2efb66458 test: use MiniWallet for p2p_compactblocks.py (Sebastian Falbesoner)

Pull request description:

  This PR enables one more of the non-wallet functional tests (p2p_compactblocks.py) to be run even with the Bitcoin Core wallet disabled by using the MiniWallet instead, as proposed in #20078.

  The wallet RPCs calls (`getnewaddress`/`sendtoaddress`) can easily be substituted by generating/sending to the MiniWallet's internal address instead (`self.generate(self.wallet, ...)`/`self.wallet.send_self_transfer(...)`).

ACKs for top commit:
  josibake:
    ACK d2efb66458
  brunoerg:
    tACK d2efb66458

Tree-SHA512: 25340d95199ffd1fa734231c22b7710aad1ed4cda78c8c533c19cea90dc4eab65832f043d20e4fc5c0869692b1f300ad79af4e7fd3c4af8f2578ac9ccbbc9aeb
2021-12-28 13:39:05 +01:00
fanquake
1292334bf5
Merge bitcoin/bitcoin#23878: doc: Remove TODO comment in tx_verify
fa50d8b66e doc: Remove TODO comment in tx_verify (MarcoFalke)

Pull request description:

  The comment has no clear motivation, so it seems better to remove it and fix it when there is a reason.

  An alternative (if a fix isn't possible when there is a clear motivation) would be to create an issue thread for easier discussion.

ACKs for top commit:
  fanquake:
    ACK fa50d8b66e

Tree-SHA512: e9c25bab46a73b7c2db288c62ed9838a5e794b3b72db494173f4502da60b58dec4383064964c0842932cd30e4251fc01ad0c28681e2ef6cb442482eea2bad595
2021-12-28 20:31:46 +08:00
fanquake
5d2344885b
Merge bitcoin/bitcoin#23840: doc: Fix -changetype help text
fa993d0e7e doc: Fix -changetype help text (MarcoFalke)

Pull request description:

  This was forgotten in commit 3ac38058ce

ACKs for top commit:
  shaavan:
    ACK fa993d0e7e
  w0xlt:
    ACK fa993d0
  josibake:
    ACK fa993d0e7e

Tree-SHA512: 9f84b1168e3b3ab06e5c1f4915a1874598b273099eb5878ed28c3a66f1484e34c836fd3c68c4131bee541f3428052f6b66e02b192170752d1082de689d44cd4d
2021-12-28 20:23:31 +08:00
fanquake
bb655a6aac
Merge bitcoin/bitcoin#23883: doc: Remove fixed TODO from wallet/feebumper
fa562fdd5e doc: Remove fixed TODO from wallet/feebumper (MarcoFalke)

Pull request description:

  Fixed in commit 9522b53a91

ACKs for top commit:
  shaavan:
    ACK fa562fdd5e

Tree-SHA512: 968fda0994020c369b7acfc01db109d0f50d4c137fadf533ae55d0e14a353ebbde4320e798cf89e5489f1020c459712631b3967976c1f73d99db8a2d1cbad982
2021-12-28 20:22:38 +08:00
fanquake
45249e70d9
Merge bitcoin/bitcoin#23881: doc: Remove TODO from block fuzz test
fa5d0b6ecd doc: Remove TODO from block fuzz test (MarcoFalke)

Pull request description:

  I don't see a reason to fix the TODO, as all call sites assume at least one tx in `vtx`. So remove it.

ACKs for top commit:
  fanquake:
    ACK fa5d0b6ecd

Tree-SHA512: 8fe03a5bdebf4d6dad00f410a1dc6449c485a4d61afb79ebcaa221489cde2a465fea981742fde130238ebed6d2f1f032aa4976726ee07b23fe7fb745b2728d46
2021-12-28 20:21:38 +08:00
MarcoFalke
fa8e01a5b8
doc: Remove outdated scriptChange TODO comment 2021-12-27 19:35:22 +01:00
MarcoFalke
fa562fdd5e
doc: Remove fixed TODO from wallet/feebumper
Fixed in commit 9522b53a91
2021-12-27 19:26:33 +01:00
MarcoFalke
fa1a51cbc1
doc: testnet3 was not reset and is doing BIP30 checks again 2021-12-27 18:56:54 +01:00
MarcoFalke
fa5d0b6ecd
doc: Remove TODO from block fuzz test 2021-12-27 18:40:01 +01:00
MarcoFalke
fa50d8b66e
doc: Remove TODO comment in tx_verify 2021-12-27 16:47:24 +01:00
brunoerg
da349f131a test: check ban_duration and time_remaining after setting ban 2021-12-27 11:39:07 -03:00
Sebastian Falbesoner
d2efb66458 test: use MiniWallet for p2p_compactblocks.py
This test can now be run even with the Bitcoin Core wallet disabled.
2021-12-27 14:39:22 +01:00
MarcoFalke
d3582f2d3b
Merge bitcoin/bitcoin#23866: test: use MiniWallet for rpc_scantxoutset.py
e844115dea test: use MiniWallet for rpc_scantxoutset.py (Sebastian Falbesoner)
983ca0456c test: introduce `address_to_scriptpubkey` helper (Sebastian Falbesoner)
e704d4d26f test: introduce `getnewdestination` helper for generating various address types (Sebastian Falbesoner)

Pull request description:

  This PR enables one more of the non-wallet functional tests (rpc_scantxoutset.py) to be run even with the Bitcoin Core wallet disabled by using the MiniWallet instead, as proposed in #20078 and https://github.com/bitcoin/bitcoin/pull/23858#issue-1088320649 more recently.

  Reviewer's guide:
  * [commit 1/3] For replacing the getnewaddress/getaddressinfo RPC calls a helper `getnewdestination` is introduced which allows to create addresses with the common address format types ('legacy', 'p2sh-segwit' and 'bech32'), but also additionally returns the corresponding pubkey and output script.
  * [commit 2/3] In order to send to addresses with MiniWallet, a helper `address_to_scriptpubkey` is introduced. It only supports legacy addresses (Base58Check) so far, which is sufficient for the scantxoutset test.
  * [commit 3/3] With those helpers, the use of MiniWallet in the test is quite straight-forward. To avoid repeatedly specifying parameters like `from_node` to MiniWallet's `send_to` method, another test-internal helper `sendtodestination` is introduced which supports specifying the destination both as outputscript or as address.

ACKs for top commit:
  w0xlt:
    reACK [e844115](e844115dea)

Tree-SHA512: e4823dc507019b2b8e479602963c5dddc4c78211e1d934218ee0f0e32c068ab7e44e9793307f549127946364f57d684c4ea1d70f25865ea70d30d4f3855836d0
2021-12-27 11:37:45 +01:00
fanquake
a213bd63ca
Merge bitcoin/bitcoin#23817: build: Fix regression introduced in PR23603
d3b0f82a43 build: Fix regression introduced in PR23603 (Hennadii Stepanov)

Pull request description:

  It appears 7629efcc2c from bitcoin/bitcoin#23603 introduced a regression in build tool flag evaluation.

  On macOS system:
  - pre-PR23603 master (ae017b8160):
  ```
  % make -C depends print-darwin_CXXFLAGS
  darwin_CXXFLAGS=-pipe
  % make -C depends print-host_CXXFLAGS
  host_CXXFLAGS=-pipe
  ```
  - the current master (369978686e):
  ```
  % make -C depends print-darwin_CXXFLAGS
  darwin_CXXFLAGS=-pipe
  % make -C depends print-host_CXXFLAGS
  host_CXXFLAGS=-arch x86_64
  ```

  It's obvious a flag being set in `depends/hosts/darwin.mk`, i.e., `-pipe`, is lost.

  With this PR:
  ```
  % make -C depends print-darwin_CXXFLAGS
  darwin_CXXFLAGS=-pipe
  % make -C depends print-host_CXXFLAGS
  host_CXXFLAGS=-pipe -arch x86_64
  ```

ACKs for top commit:
  fanquake:
    ACK d3b0f82a43

Tree-SHA512: 643099ce6858475ac9f3a4dfa72a4e493fec6fdd7042ae0f0d5fe44c5cd175e4eda63cb39fc46ac1501cadcd3466507ec88d9089235e005fe43ea7ab47ce37c1
2021-12-27 15:57:45 +08:00
fanquake
09ac6c81be
Merge bitcoin/bitcoin#23862: build, qt: Hardcode last modified timestamp in Qt RCC
11736dbe3d build, qt: Hardcode last modified timestamp in Qt RCC (Hennadii Stepanov)

Pull request description:

  Our Guix build system sets the [`SOURCE_DATE_EPOCH`](https://reproducible-builds.org/specs/source-date-epoch/) and propagates it to the depends build subsystem. Its [default value](https://github.com/bitcoin/bitcoin/blob/master/contrib/guix/README.md#recognized-environment-variables) is the top commit timestamp.

  After bumping Qt version up to 5.15.2, due to [this](1ffcca4cc2) change, every time they are going to make new Guix builds for another branch/commit they must ensure that the `qt` package will be rebuilt from scratch. Otherwise, Bitcoin Core GUI binaries will be non-deterministic.

  Such behavior makes working with Guix builds suboptimal.

  This PR fixes the described issue by patching Qt RCC and hardcoding last modified timestamps with `1`.

  It's worth to mention that this change is compatible with a possible future [improvement](https://github.com/bitcoin/bitcoin/pull/21995) which makes each dependency package reproducible.

  A drawback of such an approach is not currently applied to our project, as it effectively makes [QML cache files](https://bugreports.qt.io/browse/QTBUG-57182) useless. I can't say it's a problem for the https://github.com/bitcoin-core/gui-qml project.

  ---

  **A note for thinkers:** For now this change is enough as only Qt source contains `SOURCE_DATE_EPOCH`. But in general we should re-think about treating the `SOURCE_DATE_EPOCH` variable in the depends build subsystem. For instance, its default value could be the output of `git log --format=%at -1 -- depends`.

ACKs for top commit:
  fanquake:
    ACK 11736dbe3d

Tree-SHA512: 31f104010a0a78d217aafcc5bc4606351f9060fc2a827277935b85fc8ced9f3d90a31d812c7db8c2711fb6daccd279cf0945dc1d7a7199e0eb0ade451cdbcd5d
2021-12-27 15:43:34 +08:00
Andrew Chow
ac617cc141 wallettool: Check that the dumpfile checksum is the correct size
After parsing the checksum, make sure that it is the size that we expect
it to be.
2021-12-26 12:33:23 -05:00
Sebastian Falbesoner
e844115dea test: use MiniWallet for rpc_scantxoutset.py
This test can now be run even with the Bitcoin Core wallet disabled.
2021-12-26 15:52:45 +01:00
MarcoFalke
6a363720ff
Merge bitcoin/bitcoin#23864: doc: Drop outdated note
94a7f09de6 doc: Drop outdated note (Hennadii Stepanov)

Pull request description:

  It is outdated since bitcoin/bitcoin#23060.

ACKs for top commit:
  MarcoFalke:
    cr ACK 94a7f09de6
  theStack:
    Code-review ACK 94a7f09de6

Tree-SHA512: 5a98cf39c3939845d1abb64cb62dbb9bdb1135aa07a5cd0d85de7b6a6d9a3397b0e5da06cdb89991aac31151cb3c0d38eacf4898c53014cb7f7600e992230f87
2021-12-26 12:58:35 +01:00
Sebastian Falbesoner
983ca0456c test: introduce address_to_scriptpubkey helper
Works only with legacy addresses (Base58Check) right now.
2021-12-26 12:10:56 +01:00
Sebastian Falbesoner
e704d4d26f test: introduce getnewdestination helper for generating various address types
This serves as a replacement for the getnewaddress RPC if no wallet is
available. In addition to the address, it also returns the corresponding
public key and output script (scriptPubKey).
2021-12-26 12:10:52 +01:00
MarcoFalke
9bec5b80a0
Merge bitcoin/bitcoin#23858: test: Fix rpc_scantxoutset intermittent issue
fafe4dea16 test: Fix pep8 of touched file (MarcoFalke)
fa0ac9d7e3 test: Fix rpc_scantxoutset intermittent issue (MarcoFalke)

Pull request description:

  I fail to see how this could have ever worked, since there is nothing that prevents the wallet from spending the coins in the utxo set.

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

  Longer term it would be nice to remove the wallet and use MiniWallet here.

ACKs for top commit:
  brunoerg:
    tACK fafe4dea16
  theStack:
    Code-review ACK fafe4dea16

Tree-SHA512: d92b7be9a81eb62f496488dd15b8e564e9b7a64b55634af2714b53f985e6a35fdae788323833ff59c40ae7c6a0cf54fe069db8eb3be03686f7c100379f54a292
2021-12-26 11:07:27 +01:00
Hennadii Stepanov
11736dbe3d
build, qt: Hardcode last modified timestamp in Qt RCC
This change allows the already built qt package to be reused even with
the SOURCE_DATE_EPOCH variable set, e.g., for Guix builds.
2021-12-25 23:00:37 +02:00
Hennadii Stepanov
94a7f09de6
doc: Drop outdated note
It is outdated since bitcoin/bitcoin#23060.
2021-12-25 15:41:58 +02:00
fanquake
0106861983
Merge bitcoin/bitcoin#23859: test: Add missing suppressions for crypto_diff_fuzz_chacha20.cpp
faaf9da20a test: Add missing suppressions for crypto_diff_fuzz_chacha20.cpp (MarcoFalke)

Pull request description:

  Without them, CI and fuzzing is broken

ACKs for top commit:
  stratospher:
    ACK faaf9da. The changes look good to me.

Tree-SHA512: 46604ba1b6eb8ea321e55e043835ca1e7a4f562855007b08cf9cf96d9a7f2a0155009ca1397f34338e478b8cc5b5a6a0dc94e1878a2f00bfab11595ae58bb014
2021-12-25 17:32:42 +08:00
Sjors Provoost
923312fbf6
rpc: use peer_id, block_hash for FetchBlock 2021-12-24 16:29:04 +01:00
Sjors Provoost
34d5399211
rpc: more detailed errors for getblockfrompeer 2021-12-24 16:29:03 +01:00
Sjors Provoost
60243cac72
rpc: turn already downloaded into error in getblockfrompeer 2021-12-24 16:29:03 +01:00
Sjors Provoost
809d66bb65
rpc: clarify getblockfrompeer behavior when called multiple times 2021-12-24 16:28:54 +01:00
Sjors Provoost
0e3d7c5ee1
refactor: drop redundant hash argument from FetchBlock 2021-12-24 16:28:53 +01:00
Sjors Provoost
8d1a3e6498
rpc: allow empty JSON object result 2021-12-24 16:28:53 +01:00
MarcoFalke
faaf9da20a
test: Add missing suppressions for crypto_diff_fuzz_chacha20.cpp 2021-12-24 12:47:46 +01:00
Bruno Garcia
126853214a test: add functional test for -startupnotify 2021-12-24 08:41:43 -03:00
Hennadii Stepanov
d3b0f82a43
build: Fix regression introduced in PR23603
Assignments in builders/darwin.mk actually override previous assignments
in hosts/default.mk. Therefore, the append operator must be used
instead.
2021-12-24 13:17:07 +02:00
MarcoFalke
fafe4dea16
test: Fix pep8 of touched file
Can be reviewed with --word-diff-regex=. --ignore-all-space
2021-12-24 12:04:25 +01:00
MarcoFalke
fa0ac9d7e3
test: Fix rpc_scantxoutset intermittent issue 2021-12-24 12:03:21 +01:00
MarcoFalke
369978686e
Merge bitcoin/bitcoin#23835: test: check for invalid listtransactions RPC parameters
c27bba9672 test: check for invalid listtransactions RPC parameters (Sebastian Falbesoner)

Pull request description:

  This PR adds missing test coverage for RPC errors that are thrown if invalid parameters are passed to `listtransactions`:

  887796a5ff/src/wallet/rpc/transactions.cpp (L508)

  887796a5ff/src/wallet/rpc/transactions.cpp (L524)

  887796a5ff/src/wallet/rpc/transactions.cpp (L526)

ACKs for top commit:
  shaavan:
    ACK c27bba9672

Tree-SHA512: e5a23590186b4d9663261ff6cea52ac45e9bf2f2ef693c22b3452bb07af9b800fdabc2a94fd2852c686c28214a496d7afe296e41831759f2182feac2482635d0
2021-12-24 10:24:01 +01:00
MarcoFalke
dada92fed2
Merge bitcoin/bitcoin#22875: util: Fix Racy ParseOpCode function initialization
7b481f015a Fix Racy ParseOpCode function initialization (Jeremy Rubin)

Pull request description:

  If multiple callers call ParseOpCode concurrently it will cause a race condition. We can either move the static to it's own area and require init be called explicitly, or just allow concurrent first callers to race to fill in an atomic variable that never changes thereafter. The second approach is taken here.

  Static initialization *is* threadsafe, but only insofar as definining the variable being guaranteed to be called once. This is used incorrectly here.

  practicalswift --> are there tools we can deploy to catch usage like this?

ACKs for top commit:
  MarcoFalke:
    re-ACK 7b481f015a 🗣

Tree-SHA512: cbf9dc3af26d7335305026f32ce8472a018309b89b3d81a67357e59fbeed72c37b5b8a6e30325ea68145c3b2403867be82de01f22decefb6e6717cf0c0045633
2021-12-24 10:02:59 +01:00
Jeremy Rubin
7b481f015a Fix Racy ParseOpCode function initialization 2021-12-23 15:53:36 -08:00
Carl Dong
e3544c864e init: Use clang-tidy named args syntax 2021-12-23 17:38:09 -05:00
Carl Dong
3401630417 style-only: Rename *Chainstate return values 2021-12-23 17:28:30 -05:00