Commit graph

30330 commits

Author SHA1 Message Date
W. J. van der Laan
1bbe289f20
Merge bitcoin/bitcoin#22565: [script] signet's getcoins.py improvements
b0c8246cac Add cleaner errors for unsuccessful faucet transactions (NikhilBartwal)
1c612b274b [script] Update signet getcoins.py for custom network (NikhilBartwal)

Pull request description:

  Currently, using the getcoins.py with a custom signet executes successfully and shows the transfer of 0.001 testBTC as complete, however for obvious reasons, it should not. In fact, upon verification it does not actually execute the transaction, but rather gives the output that it did, as shown below which can be misleading:

  ```
  [nikhilb@nikhil-PC bitcoin]$ echo $datadir
  /home/nikhilb/signet-custom
  [nikhilb@nikhil-PC bitcoin]$ contrib/signet/getcoins.py -- -datadir=$datadir
  Payment of 0.00100000 BTC sent with txid dd22c7d996e95f3e5baf20f73140d517ff48f1b26d0e4fefd61e3c37991b8f86
  [nikhilb@nikhil-PC bitcoin]$ bitcoin-cli -datadir=$datadir getrawtransaction dd22c7d996e95f3e5baf20f73140d517ff48f1b26d0e4fefd61e3c37991b8f86
  error code: -5
  error message:
  No such mempool or blockchain transaction. Use gettransaction for wallet transactions.
  [nikhilb@nikhil-PC bitcoin]$ bitcoin-cli -datadir=$datadir gettransaction dd22c7d996e95f3e5baf20f73140d517ff48f1b26d0e4fefd61e3c37991b8f86
  error code: -5
  error message:
  Invalid or non-wallet transaction id

  ```
  This PR adds a sanity check for custom signet by comparing the current network's first block hash (the block after the genesis block) with global signet's respective block hash (since all signet networks share the same genesis block) and if a custom network is detected, the user is prompted to either work on the global signet or setup their own faucet.

  The PR was checked to be working successfully, giving the output as below:

  ```
  [nikhilb@nikhil-PC bitcoin]$ git checkout update_signet_getcoins
  Switched to branch 'update_signet_getcoins'
  Your branch is ahead of 'upstream/master' by 1 commit.
    (use "git push" to publish your local commits)
  [nikhilb@nikhil-PC bitcoin]$ contrib/signet/getcoins.py -- -datadir=$datadir
  The global faucet cannot be used with a custom Signet network. Please use the global signet or setup your custom faucet for the same.

  You can have a look here for setting up your own faucet: https://en.bitcoin.it/wiki/Signet

  ```

ACKs for top commit:
  prayank23:
    utACK b0c8246cac
  kallewoof:
    ACK b0c8246cac
  arnabsen1729:
    utACK b0c8246
  prakash1512:
    utACK b0c8246
  0xB10C:
    Tested ACK b0c8246cac
  theStack:
    Tested ACK b0c8246cac
  Zero-1729:
    crACK b0c8246 🧉

Tree-SHA512: 144b47a83008521a5cda13f4c1b12809a125a744f865a8e0f792132d52fdb88926d4f4f4d7230452c2e129b5879892cdbeda981b8af10b789e9fc0cda2905a5d
2021-08-23 19:19:00 +02:00
MarcoFalke
dbcb5742c4
Merge bitcoin/bitcoin#20541: Move special CAddress-without-nTime logic to net_processing
75290ae61e Drop us=... message in net debug for sending version message (Pieter Wuille)
5d47860334 refactor: move CAddress-without-nTime logic to net_processing (Pieter Wuille)

Pull request description:

  Historically, the VERSION message contains an "addrMe" and an "addrYou". As these are sent before version negotiation is complete, the protocol version is INIT_PROTO_VERSION (209), and in that protocol, CAddress is serialized without nTime.

  This is in fact the only situation left where a CAddress is (de)serialized without nTime. As it's such a simple structure (CService for ip/port + uint64_t for nServices), just inline that structure in the few places where it occurs, and remove the logic for dealing with missing nTime from CAddress.

ACKs for top commit:
  Zero-1729:
    crACK 75290ae61e
  jonatack:
    ACK 75290ae61e
  vasild:
    ACK 75290ae61e

Tree-SHA512: ccd9f478e1766fb2ad845d512b090e6297b82100640545ca490d930785801da3b429d40400bc2eb2cbe9057d5d12362ab33f8d650a1ca9e9e85857aef36ec414
2021-08-23 18:19:52 +02:00
MarcoFalke
f6f7a12462
Merge bitcoin/bitcoin#22622: util: Check if specified config file cannot be opened
127b4608e9 test: Check if specified config file cannot be opened (nthumann)
6bb54708e6 util: Check if specified config file cannot be opened (nthumann)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/22612.
  When running e.g. `./src/bitcoind -datadir=/tmp/bitcoin -regtest -conf=/tmp/bitcoin/regtest/bitcoin.conf` and the specified config cannot be opened (doesn't exist, permission denied, ...), the initialization silently uses the default config.

  As voidburn already noted:
  > I can't think of a situation in which a config file is specified explicitly (in the startup options, as per service unit linked above), but inaccessible, where the fail condition should be to keep booting using defaults instead.

  With this patch applied, the initialization will fail immediately, if the specified config file cannot be opened. If no config file is explicitly specified, the behavior is unchanged. This not only affects `bitcoind`, but also `bitcoin-cli` and `bitcoin-qt`.

  In the example below the datadir is accessible, but the config file is not due to insufficient permissions:
  ```
  $ ./src/bitcoind -datadir=/tmp/bitcoin -regtest --debug=1 -conf=/tmp/bitcoin/regtest/bitcoin.conf
  Error: Error reading configuration file: specified config file "/tmp/bitcoin/regtest/bitcoin.conf" could not be opened.
  ```

ACKs for top commit:
  0xB10C:
    ACK 127b4608e9
  Zero-1729:
    tACK 127b4608e9
  theStack:
    Tested ACK 127b4608e9

Tree-SHA512: 4fe487921485426f1d1da8d256c388af517b984b639d776aec7b159b3e23b669824093d3bdd31139d9415ed5f5de405b3e6a51b110c8ab471f12b9c99ac67cc1
2021-08-23 12:58:01 +02:00
MarcoFalke
489beb3984
Merge bitcoin/bitcoin#22641: test: Split rpc_signmessage test for disabled wallet
a3b559c970 test: added test for disabled wallet (Shubhankar Gambhir)

Pull request description:

  This PR enables a part of the non-wallet functional test  (rpc_signmessage.py) to be run even with the Bitcoin Core wallet disabled, it is inspired by #20078.

  Divided tests in rpc_signmessage.py into 2 files wallet_signmessagewithaddress.py and rpc_signmessagewithprivkey.py, latter one can run even when wallet is disabled that provides extra test which was not performed earlier.

  * we need bitcoincore wallet to run  rpc_signmessage.py, but it is olny required for signing messages with address and not for signing messages wih private key, so latter one can be in a seperate test which can run without wallet
  * verifying message doesn't require wallet, so it can be used in both tests without any problem
  * 2 tests are named as wallet_signmessagewithaddress.py and rpc_signmessagewithprivkey.py to provide clarity of what they are testing.

ACKs for top commit:
  vasild:
    ACK a3b559c970
  theStack:
    Code-review ACK a3b559c970

Tree-SHA512: 1bfca3baf3123a02f0a2389e55e141d64430c3bed40ff5a5fb97ef2c66e2853c46e4b2dff62b948eb94dc574cb89d061769330f0535e2d5d1be76b60101136ac
2021-08-23 09:34:28 +02:00
MarcoFalke
58b559fab0
Merge bitcoin/bitcoin#20769: net: fixes #20657 - Advertised address where nobody is listening
a38137479b net: do not advertise address where nobody is listening (Jadi)

Pull request description:

  If the bitcoind starts when listen=0 but listenonion=1, the daemon will
  advertise its onion address but nothing is listening for it.

  This update will enforce listenonion=0 when the listen is 0.

ACKs for top commit:
  vasild:
    ACK a38137479b
  jarolrod:
    ACK a38137479b
  amitiuttarwar:
    ACK a38137479b

Tree-SHA512: e84a0a9a51f2217edf35d06c6cd9085d1e664452655ba92027195a1e88ba081d157310c84e9709a99ce5d46c94f231477ca2d36f010648b0c8b4f2a737d54e5d
2021-08-23 09:01:08 +02:00
fanquake
e826b22da2
Merge bitcoin/bitcoin#22275: A few follow-ups for taproot signing
08f57a0057 Assert that IsComplete() in GetSpendData() (Pieter Wuille)
d8f4b976d5 Remove default nHashTypeIn arguments to MutableTransactionSignatureCreator (Pieter Wuille)
c7048aae95 Simplify SignTransaction precomputation loop (Pieter Wuille)
addb9b5a71 Improve comments in taproot signing logic (Pieter Wuille)

Pull request description:

  This addresses a few review comments from #21365 that were left at the time of merge (as well as some from #22166 applying to the commit it shared with #21365).

  I do not think any are blockers for a 22.0 release.

ACKs for top commit:
  theStack:
    re-ACK 08f57a0057 🌴
  Zero-1729:
    crACK 08f57a0
  jonatack:
    Code review ACK 08f57a0057 per `git range-diff e9d6eb1 9336670 08f57a0` followed by re-code review per commit to swap context back into memory and debug build/run unit tests + feature_taproot.py as a sanity check

Tree-SHA512: 968750109ba8d6faf3016035a38f81c6aefb724c632a3cab0bbf43cf31b9d187b6b0fddd8772768f57338df11eb07ab9c4c6dacdf3cf35b71f29699c67a301ea
2021-08-23 12:25:49 +08:00
fanquake
a93e7a4422
Merge bitcoin/bitcoin#22748: refactor: Avoid temporary vectors/uint256s in VerifyTaprootCommitment
2f0190320d Avoid temporary vectors/uint256s in VerifyTaprootCommitment (Pieter Wuille)

Pull request description:

  As XOnlyPubKey has a Span-based constructor, that can be used directly without needing to first convert the byte sequence into a vector, only to convert that to a uint256, which only then can then be passed as a span to the constructor.

  Reported by @ roconnor-blockstream.

ACKs for top commit:
  Zero-1729:
    crACK 2f0190320d
  theStack:
    re-ACK 2f0190320d
  jonatack:
    ACK 2f0190320d

Tree-SHA512: f5e809d693cf6f6e899278cd706548eb4341e73b3f7ca8926b5fb50afb2098077d691579aea84fd7db2a7edd76be8e400aa2ed886091ee3416651b8a36efba37
2021-08-23 11:40:18 +08:00
Pieter Wuille
75290ae61e Drop us=... message in net debug for sending version message
The us=... message in the debug log when sending a version message is
always [::]:0, because we no longer send our own address there.
Therefore, this information is entirely redundant. Remove it.
2021-08-21 19:16:47 -04:00
Pieter Wuille
5d47860334 refactor: move CAddress-without-nTime logic to net_processing
Historically, the VERSION message contains an "addrMe" and an "addrYou". As
these are sent before version negotiation is complete, the protocol version is
INIT_PROTO_VERSION (209), and in that protocol, CAddress is serialized without
nTime.

This is in fact the only situation left where a CAddress is (de)serialized
without nTime. As it's such a simple structure (CService for ip/port + uint64_t
for nServices), just inline that structure in the few places where it occurs,
and remove the logic for dealing with missing nTime from CAddress.
2021-08-21 19:16:47 -04:00
MarcoFalke
f5a406f003
Merge bitcoin/bitcoin#22633: refactor: Replace remaining binascii method calls
021daedfa1 refactor: replace remaining binascii method calls (Zero-1729)

Pull request description:

  This PR removes the remaining `binascii` method calls outside `test/functional` and `test_framework`, as pointed out here  https://github.com/bitcoin/bitcoin/pull/22619#pullrequestreview-722153458.

  Follow-up to #22593 and #22619
  Closes #22605

ACKs for top commit:
  josibake:
    re-ACK 021daedfa1
  theStack:
    re-ACK 021daedfa1

Tree-SHA512: 2ae9fee8917112c91a5406f219ca70f24cd8902b903db5a61fc2de85ad640d669a772f5c05970be0fcee6ef1cdd32fae2ca5d1ec6dc9798b43352c8160ddde6f
2021-08-21 16:29:55 +02:00
Pieter Wuille
2f0190320d Avoid temporary vectors/uint256s in VerifyTaprootCommitment
As XOnlyPubKey has a Span-based constructor, that can be used directly
without needing to first convert the byte sequence into a vector, only
to convert that to a uint256, which only then can then be passed as a
span to the constructor.
2021-08-20 14:30:59 -04:00
Pieter Wuille
08f57a0057 Assert that IsComplete() in GetSpendData() 2021-08-20 14:29:23 -04:00
Pieter Wuille
d8f4b976d5 Remove default nHashTypeIn arguments to MutableTransactionSignatureCreator
These were unused except in tests, and were also overlooked when changing
SIGHASH_ALL -> SIGHASH_DEFAULT.
2021-08-20 14:29:23 -04:00
Pieter Wuille
c7048aae95 Simplify SignTransaction precomputation loop 2021-08-20 14:29:23 -04:00
Pieter Wuille
addb9b5a71 Improve comments in taproot signing logic 2021-08-20 14:29:23 -04:00
MarcoFalke
4fc15d1566
Merge bitcoin/bitcoin#22707: test: refactor use of getrawmempool in functional tests for efficiency
47c48b5f35 test: only use verbose for getrawmempool when necessary in functional tests (Michael Dietz)
77349713b1 test: use getmempoolentry instead of getrawmempool in functional tests when appropriate (Michael Dietz)
86dbd54ae8 test: improve mempool_updatefrom efficiency by using getmempoolentry for specific txns (Michael Dietz)

Pull request description:

  I don't think this changes the intention of the test. But it does shave ~30 seconds off the time it takes to run. From what I've seen our CI `macOS 11 native [gui] [no depends]` runs `mempool_updatefrom.py` in ~135 seconds. After this PR it should run in ~105 seconds

  I noticed this improvement should probably be made when testing performance/runtimes of https://github.com/bitcoin/bitcoin/pull/22698. But I wanted to separate this out from that PR so the affects of each is decoupled

  Edit: The major change in this PR is improving mempool_updatefrom.py's runtime as this is a very long running test. Then made the same efficiency improvements across all the functional tests as it made since to do that here

ACKs for top commit:
  theStack:
    Tested ACK 47c48b5f35

Tree-SHA512: 40f553715f3d4649dc18c2738554eafaca9ea800c4b028c099217896cc1c466ff457ae814d59cf8564c782a8964d8fac3eda60c1b6ffb08bbee1439b2d34434b
2021-08-20 17:39:17 +02:00
MarcoFalke
192a959b65
Merge bitcoin/bitcoin#22749: ci: Run arm task on arm64 hardware
fa35efa84b ci: Run arm task on arm64 hardware (MarcoFalke)

Pull request description:

  It will still run cross-compilation to armhf, but run the binaries on the hardware itself, not qemu.

  There shouldn't be any significant difference, other than maybe a slight speedup.

ACKs for top commit:
  hebasto:
    re-ACK fa35efa84b

Tree-SHA512: d03bb2b55d0a6b5021243eedff6e143f4fad03a1a8913000c2c5c74665e4bb1c77cb30aa112dbddbc0bb7c645bec18f6b8b8ba91049587b464bbe5ec07dd46bd
2021-08-20 11:21:15 +02:00
fanquake
ff1e633897
Merge bitcoin/bitcoin#22730: ci: Run fuzzer task for the master branch only
5a9e255e5a ci: Run fuzzer task for the master branch only (Hennadii Stepanov)

Pull request description:

  https://github.com/bitcoin/bitcoin/pull/22629#issuecomment-896454270:
  > I think we need to decide whether running the fuzzer CI in any branch other than master is something we want to be doing / maintaining. This seems pretty unsustainable unless we at least make changes in regards to the fuzz inputs being used by the different branches. I'm pretty sure Marco has mentioned this before.

  This PR makes CI ignore fuzz tests by forcing `RUN_FUZZ_TESTS=false` for all cases when it is not the master branch or a PR based on it.

  See #22731 as a demo for the 22.x branch.

ACKs for top commit:
  MarcoFalke:
    cr ACK 5a9e255e5a no opinion on the concept, also didn't test
  fanquake:
    ACK 5a9e255e5a - didn't test other than to look at #22731.

Tree-SHA512: 48f8f02f1814d4f15293a8804b76d544a08784ea7acd930b5c6d4608564d30aa5a608b1a511386ffda6975feec700c1bbeb86a30a75a7e48a1c5b167a227dbdd
2021-08-20 15:17:01 +08:00
fanquake
d3169349a9
Merge bitcoin/bitcoin#22654: guix: Don't include directory name in SHA256SUMS
132cae44f2 doc: Mention the flat directory structure for uploads (Andrew Chow)
fb17c99e35 guix: Don't include directory name in SHA256SUMS (Andrew Chow)

Pull request description:

  The SHA256SUMS file can be used in a sha256sum -c command to verify downloaded binaries. However users are likely to download just a single file and not place this file in the correct directory relative to the SHA256SUMS file for the simple verification command to work. By not including the directory name in the SHA256SUMS file, it will be easier for users to verify downloaded binaries.

ACKs for top commit:
  Zero-1729:
    re-ACK 132cae44f2
  fanquake:
    ACK 132cae44f2

Tree-SHA512: c9ff416b8dfb2f3ceaf4d63afb84aac9fcaefbbf9092f9e095061b472884ec92c7a809e6530c7132a82cfe3ab115a7328e47994a412072e1d4feb26fc502c8c5
2021-08-20 15:10:26 +08:00
fanquake
602c8eb8f0
Merge bitcoin/bitcoin#22697: addrman: Remove CAddrMan::Clear() function
4d2fa97031 [addrman] Clean up ctor (John Newbery)
7e6e65918f [addrman] inline Clear() into CAddrMan ctor (John Newbery)
406be5ff96 [addrman] Remove all public uses of CAddrMan.Clear() from the tests (John Newbery)
ed9ba8af08 [tests] Remove CAddrMan.Clear() call from CAddrDB::Read() (John Newbery)
e8e7392311 [addrman] Don't call Clear() if parsing peers.dat fails (John Newbery)
181a1207ba [addrman] Move peers.dat parsing to init.cpp (John Newbery)

Pull request description:

  `CAddrMan::Clear()` exists to reset the internal state of `CAddrMan`. It's currently used in two places:

  - on startup, if deserializing peers.dat fails, `Clear()` is called to reset to an empty addrman
  - in tests, `Clear()` is called to reset the addrman for more tests

  In both cases, we can simply destruct the `CAddrMan` and construct a new, empty addrman. That approach is safer - it's possible that `Clear()` could 'reset' the addrman to a state that's not equivalent to a freshly constructed addrman (one actual example of this is that `Clear()` does not clear the `m_tried_collisions` set). On the other hand, if we destruct and then construct a fresh addrman, we're guaranteed that the new object is empty.

  This wasn't possible when addrman was initially implemented, since it was a global, and so it would only be destructed on shutdown. However, addrman is now owned by `node.context`, so we have control over its destruction/construction.

ACKs for top commit:
  laanwj:
    Code review ACK 4d2fa97031
  vasild:
    ACK 4d2fa97031
  Zero-1729:
    crACK 4d2fa97031

Tree-SHA512: f715bf2cbff4f8c3a9dbc613f8c7f11846b065d6807faf3c7d346a0b0b29cbe7ce1dc0509465c2c9b88a8ad55299c9182ea53f5f743e47502a69a0f375e09408
2021-08-20 14:33:25 +08:00
MarcoFalke
0263583ad9
Merge bitcoin/bitcoin#22750: ci: Followups for #22710
e9cf506ab0 ci: Make git available for all merge commits (Hennadii Stepanov)
040e4deddc scripted-diff: Rename template to avoid CI configuration parsing warning (Hennadii Stepanov)

Pull request description:

  1) Remove Cirrus CI configuration parsing warning:
  ![Screenshot from 2021-08-20 01-13-57](https://user-images.githubusercontent.com/32963518/130151265-551873cb-6670-48a6-b0c4-687cb341a342.png)
  ![Screenshot from 2021-08-20 01-13-41](https://user-images.githubusercontent.com/32963518/130151273-920fb316-e7e1-457b-8933-2ac31e9c605f.png)

  2) Make `git` available for merge commits, because it is now required for `depends_sources_cache` and `depends_built_cache`.

Top commit has no ACKs.

Tree-SHA512: d5cfb49492d2635fc2019220b0023179e09608bcb5a77c3d445e53c4cd714b145d6107ae02f2e3d0e2b196c2974b4688ae3e4fc233beb0917da29771795ed08e
2021-08-20 08:28:26 +02:00
fanquake
5b6104edf0
Merge bitcoin/bitcoin#22746: doc: Update GitHub documentation links
470c6aa280 doc: Update GitHub documentation links (Suriyaa Rocky Sundararuban)

Pull request description:

  Removing URL redirecting for GitHub documentation links.

ACKs for top commit:
  fanquake:
    ACK 470c6aa280 - updates look correct.

Tree-SHA512: 5359aaddf1a1adabd0dc0e36cffcdb7b1ed83d9022314804655e010c84bf6143b7a2c8553a4e6c7793f02973868ad4b7554431ad61df82130ce47af74ebf0e99
2021-08-20 08:59:41 +08:00
Hennadii Stepanov
e9cf506ab0
ci: Make git available for all merge commits 2021-08-20 01:33:04 +03:00
Hennadii Stepanov
040e4deddc
scripted-diff: Rename template to avoid CI configuration parsing warning
-BEGIN VERIFY SCRIPT-
sed -i 's/\btask_template/main_template/' .cirrus.yml
sed -i 's/\bTASK_TEMPLATE/MAIN_TEMPLATE/' .cirrus.yml
-END VERIFY SCRIPT-
2021-08-20 01:33:04 +03:00
Andrew Chow
132cae44f2 doc: Mention the flat directory structure for uploads
The uploaded binaries need to match the same flat directory structure of
the SHA256SUMS file in order for torrent downloaders to be able to
verify the download without moving files. Mention this in the release
process doc.
2021-08-19 16:48:39 -04:00
MarcoFalke
999f8b24cc
Merge bitcoin/bitcoin#22568: test: add addr-fetch peer connection state and timeout coverage
f8d8eb5fda test: add addr-fetch timeout connection coverage in p2p_addrfetch.py (Jon Atack)
9321086af7 test: add assert_getpeerinfo method and coverage in p2p_addrfetch.py (Jon Atack)

Pull request description:

  This patch adds additional addr-fetch peer connection state and timeout coverage as a follow-up to #22096.

ACKs for top commit:
  Saviour1001:
    Tested ACK <code>[f8d8eb5](f8d8eb5fda)</code>
  mzumsande:
    Code review ACK f8d8eb5fda

Tree-SHA512: 9a13a705d1da6b308d6dcbc6930575205e2e88bfe9f2e7cb4e0c4c40d26538430e6b02c6c772d0cee64e534777348291469a139f99afbf9d4f93f31b9e7b0818
2021-08-19 21:56:15 +02:00
MarcoFalke
fa35efa84b
ci: Run arm task on arm64 hardware 2021-08-19 21:09:44 +02:00
Suriyaa Rocky Sundararuban
470c6aa280
doc: Update GitHub documentation links 2021-08-19 20:42:26 +02:00
MarcoFalke
92f3a4b4d0
Merge bitcoin/bitcoin#22742: test: Use proper target in do_fund_send
8dcbbbea64 test: fix bug in 22686 (S3RK)

Pull request description:

  It seems there is a bug in the test in #22686, the code behaviour itself looks correct.

  Instead of verifying the scenario from #22670 with both `upper_bound` and `lower_bound` for the transaction amount, the tests verified `lower_bound` two times. This fix is to properly use function parameter instead of a variable from the scope. The test still passes with both values, so no code changes are required.

ACKs for top commit:
  achow101:
    ACK 8dcbbbea64

Tree-SHA512: 82837b2e00bd075a7b6b7a31031f4d3ba1ab4bd5967e90488f527fcc618aeb3945d6ae3ed66b9eb11616dda3ef376c5001559d2a7a79a759fc6800358bf52537
2021-08-19 19:16:09 +02:00
MarcoFalke
b6a8e68b4e
Merge bitcoin/bitcoin#22710: ci: Invalidate depends caches when sources have been changed
f52a72af56 ci: Invalidate depends caches when sources have been changed (Hennadii Stepanov)
939640f87e ci: Reorder scripts to make git available before depends_sources_cache (Hennadii Stepanov)

Pull request description:

  On master (502d22ceed) the Cirrus CI do _not_ invalidate depends caches when their sources has been changed, i.e. source version updates, a new dependency etc.

  This behavior causes:
  - breaking CI build for Android APK  (see #22708)
  - the cache sizes growing

  It is assumed that caches could be invalidated via Cirrus CI API/GUI, but it is inconvenient and it does not work as expected in all cases.

  The common part of `fingerprint_key`s for both `depends_sources_cache` and `depends_built_cache` is the recent commit that changes sources in the `src/depends` sub-directory.

  For `depends_built_cache` additionally `CIRRUS_TASK_NAME` is used to avoid sharing of the same cache between tasks with different OSes and different `DEP_OPTS`.

  ---

  The `depends_sources` cache:
  - in master (502d22ceed)

  ![Screenshot from 2021-08-16 11-10-17](https://user-images.githubusercontent.com/32963518/129532207-56c09e06-c8d0-4f1e-a692-f198da011b20.png)

  - with this PR

  ![Screenshot from 2021-08-16 11-10-42](https://user-images.githubusercontent.com/32963518/129532253-f5426814-4f58-448f-ad52-da26cc312af7.png)

ACKs for top commit:
  MarcoFalke:
    cr ACK f52a72af56
  Zero-1729:
    crACK f52a72af56

Tree-SHA512: 0d14814ff308317c7c18cc725cf69055139030c207200af003872068f5567bd4b9c1f6783845d11742e314ebcc1dc5cae16aa86475376b623d921af5fcda14dd
2021-08-19 15:07:29 +02:00
John Newbery
4d2fa97031 [addrman] Clean up ctor
Use default initialization and initializer lists, and use range-based
for loops for resetting the buckets.
2021-08-19 11:29:54 +01:00
John Newbery
7e6e65918f [addrman] inline Clear() into CAddrMan ctor
Clear() is now only called from the ctor, so just inline the code into
that function.

The LOCK(cs) can be removed, since there can be no data races in the ctor.

Also move the function definition out of the header and into the cpp file.
2021-08-19 11:29:54 +01:00
John Newbery
406be5ff96 [addrman] Remove all public uses of CAddrMan.Clear() from the tests
Just use unique_ptr<CAddrMan>s and reset the pointer if a frest addrman is required.
Also make CAddrMan::Clear() private to ensure that no call sites are missed.
2021-08-19 11:26:53 +01:00
S3RK
8dcbbbea64 test: fix bug in 22686 2021-08-19 10:09:36 +02:00
fanquake
b784ab10f5
Merge bitcoin/bitcoin#22739: doc: link to managing-wallets from docs README
1ea11e10ac doc: link to managing-wallets from doc readme (fanquake)

Pull request description:

  This was forgotten in #22523.

ACKs for top commit:
  achow101:
    ACK 1ea11e10ac
  jarolrod:
    ACK 1ea11e10ac

Tree-SHA512: b82664b282cc0fe733b752c011621593df0f846d2188f12dbc5fedb7ffed2bd161293ce2a369ca973926030795b5f7acde7a1cbf5e337042a6f665906069c656
2021-08-19 09:44:20 +08:00
fanquake
638855af63
Merge bitcoin/bitcoin#19101: refactor: remove ::vpwallets and related global variables
62a09a3077 refactor: remove ::vpwallets and related global variables (Russell Yanofsky)

Pull request description:

  Get rid of global wallet list variables by moving them to WalletContext struct

  - [`cs_wallets`](e638acf697/src/wallet/wallet.cpp (L56)) is now [`WalletContext::wallet_mutex`](4be544c7ec/src/wallet/context.h (L37))
  - [`vpwallets`](e638acf697/src/wallet/wallet.cpp (L57)) is now [`WalletContext::wallets`](4be544c7ec/src/wallet/context.h (L38))
  - [`g_load_wallet_fns`](e638acf697/src/wallet/wallet.cpp (L58)) is now [`WalletContext::wallet_load_fns`](4be544c7ec/src/wallet/context.h (L39))

ACKs for top commit:
  achow101:
    ACK 62a09a3077
  meshcollider:
    re-utACK 62a09a3077

Tree-SHA512: 74428180d57b4214c3d96963e6ff43e8778f6f23b6880262d1272f2de67d02714fdc3ebb558f62e48655b221a642c36f80ef37c8f89d362e2d66fd93cbf03b8f
2021-08-19 09:42:21 +08:00
fanquake
607a6338a7
Merge bitcoin/bitcoin#22331: crypto: Fix K1/K2 use in ChaCha20-Poly1305 AEAD
cd37356ff9 [crypto] Fix K1/K2 use in ChaCha20-Poly1305 AEAD (Dhruv Mehta)

Pull request description:

  BIP324 mentions K1 is used for the associated data and K2 is used for the payload. The code does the opposite. This is not a security problem but will be a problem across implementations based on the HKDF key derivations.

  BIP324 author Jonas Schnelli thinks a [code update will be better](https://github.com/bitcoin/bitcoin/pull/15649#discussion_r440780669) than a BIP update.

  If this PR is merged:

  - [ ] We need to update the test vector 3 in BIP324

ACKs for top commit:
  jonasschnelli:
    utACK cd37356ff9

Tree-SHA512: e2165117bfbf7a031060e7376912f9af1c1bfc57916383799a0fa2c040e2caaab0d6aafc3425c083a233b96c84fafec75c938e00ceb6bd7d52607d58607cb145
2021-08-19 09:16:28 +08:00
fanquake
1ea11e10ac
doc: link to managing-wallets from doc readme
This was forgotten in #22523.
2021-08-19 08:52:25 +08:00
Andrew Chow
fb17c99e35 guix: Don't include directory name in SHA256SUMS
The SHA256SUMS file can be used in a sha256sum -c command to verify
downloaded binaries. However users are likely to download just a single
file and not place this file in the correct directory relative to the
SHA256SUMS file for the simple verification command to work. By not
including the directory name in the SHA256SUMS file, it will be easier
for users to verify downloaded binaries.

Co-authored-by: Carl Dong <contact@carldong.me>
2021-08-18 20:07:32 -04:00
fanquake
cabbd01d85
Merge bitcoin/bitcoin#22724: windres: use PACKAGE_VERSION rather than building more version numbers
f12fbad5a1 windres: use PACKAGE_VERSION rather than building more version numbers (fanquake)

Pull request description:

  Rather than defining more strings, reuse PACKAGE_VERSION, which is already available.

  We also already use PACKAGE_VERSION for `ProductVersion` and `FileVersion` in setup.nsi.

ACKs for top commit:
  MarcoFalke:
    cr ACK f12fbad5a1
  laanwj:
    Code review ACK f12fbad5a1

Tree-SHA512: b74a37cbba105d208d4da9264d295d7e052009fdd6b0ed54a0d9968bbe2deeba1766d6d310438b2939a81555faa0cbd67d5e53f0c8a2de669ce56353c1c67d22
2021-08-19 07:58:03 +08:00
Samuel Dobson
e9d6eb1b80
Merge bitcoin/bitcoin#22217: refactor: Avoid wallet code writing node settings file
49ee2a0ad8 Avoid wallet code writing node settings file (Russell Yanofsky)

Pull request description:

  Change wallet loading code to access settings through the Chain interface instead of writing settings.json directly. This is for running wallet and node in separate processes, since multiprocess code wouldn't easily work with different processes updating the same file.

  ---

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10). The commit was first part of larger PR #10102.

ACKs for top commit:
  jamesob:
    ACK 49ee2a0ad8 ([`jamesob/ackr/22217.1.ryanofsky.refactor_avoid_wallet_co`](https://github.com/jamesob/bitcoin/tree/ackr/22217.1.ryanofsky.refactor_avoid_wallet_co))
  ryanofsky:
    > ACK [49ee2a0](49ee2a0ad8) ([`jamesob/ackr/22217.1.ryanofsky.refactor_avoid_wallet_co`](https://github.com/jamesob/bitcoin/tree/ackr/22217.1.ryanofsky.refactor_avoid_wallet_co))
  Zero-1729:
    crACK 49ee2a0ad8
  meshcollider:
    Code review ACK 49ee2a0ad8

Tree-SHA512: a81c63b87816f739e02e3992808f314294d6c7213babaafdaaf3c4650ebc97ee4f98f9a4684ce4ff87372df59989b8ad5929159c5686293a7cce04e97e2fabba
2021-08-19 10:44:25 +12:00
MarcoFalke
38975eccd4
Merge bitcoin/bitcoin#22229: test: consolidate to f-strings (part 1)
68faa87881 test: use f-strings in mining_*.py tests (fanquake)
c2a5d560df test: use f-strings in interface_*.py tests (fanquake)
86d958262d test: use f-strings in feature_proxy.py (fanquake)
31bdb33dcb test: use f-strings in feature_segwit.py (fanquake)
b166d54c3c test: use f-strings in feature_versionbits_warning.py (fanquake)
cf6d66bf94 test: use f-strings in feature_settings.py (fanquake)
6651d77f22 test: use f-strings in feature_pruning.py (fanquake)
961f5813ba test: use f-strings in feature_notifications.py (fanquake)
1a546e6f6c test: use f-strings in feature_minchainwork.py (fanquake)
6679eceacc test: use f-strings in feature_logging.py (fanquake)
fb633933ab test: use f-strings in feature_loadblock.py (fanquake)
e9ca8b254d test: use f-strings in feature_help.py (fanquake)
ff7e330999 test: use f-strings in feature_filelock.py (fanquake)
d5a6adc5e4 test: use f-strings in feature_fee_estimation.py (fanquake)
a2de33cbdc test: use f-strings in feature_dersig.py (fanquake)
a2502cc63f test: use f-strings in feature_dbcrash.py (fanquake)
3e2f84e7a9 test: use f-strings in feature_csv_activation.py (fanquake)
e2f1fd8ee9 test: use f-strings in feature_config_args.py (fanquake)
36d33d32b1 test: use f-strings in feature_cltv.py (fanquake)
dca173cc04 test: use f-strings in feature_blocksdir.py (fanquake)
5453e87062 test: use f-strings in feature_backwards_compatibility.py (fanquake)
6f3d5ad67a test: use f-strings in feature_asmap.py (fanquake)

Pull request description:

  Rather than using 3 different ways to build/format strings (sometimes all in the same test, i.e [`feature_config_args.py`](https://github.com/bitcoin/bitcoin/blob/master/test/functional/feature_config_args.py)), consolidate to using [f-strings (3.6+)](https://docs.python.org/3/reference/lexical_analysis.html#f-strings), which are generally more concise / readable, as well as more performant than existing methods.

  This deals with the `feature_*.py`, `interface_*.py` and `mining_*.py` tests.

  See also: [PEP 498](https://www.python.org/dev/peps/pep-0498/)

ACKs for top commit:
  mjdietzx:
    reACK 68faa87881
  Zero-1729:
    crACK 68faa87881

Tree-SHA512: d4e1a42e07d96d2c552387a46da1534223c4ce408703d7568ad2ef580797dd68d9695b8d19666b567af37f44de6e430e8be5db5d5404ba8fcecf9f5b026a6efb
2021-08-18 21:11:31 +02:00
Hennadii Stepanov
5a9e255e5a
ci: Run fuzzer task for the master branch only 2021-08-18 20:18:32 +03:00
Hennadii Stepanov
f52a72af56
ci: Invalidate depends caches when sources have been changed 2021-08-18 19:32:01 +03:00
W. J. van der Laan
90499358e9
Merge bitcoin/bitcoin#22645: scripts: prevent GCC optimising test symbols in test-symbol-check
5449d44e37 scripts: prevent GCC optimising test symbols in test-symbol-check (fanquake)

Pull request description:

  I noticed in #22381 that when the test-symbol-check target was being built with Clang and run in the CI it would fail due to using a too-new version of `pow` (used [here](d67330d112/contrib/devtools/test-symbol-check.py (L85))). Our CIs use Focal (glibc 2.31) and the version of `pow` was the optimized version introduced in [glibc 2.29](https://lwn.net/Articles/778286/):
  ```bash
  * Optimized generic exp, exp2, log, log2, pow, sinf, cosf, sincosf and tanf.
  ```
  This made sense, except for that if it was failing when built using Clang, why hadn't it also been failing when being built with GCC?

  Turns out GCC is optimizing away that call to `pow` at all optimization levels, including `-O0`, see: https://godbolt.org/z/53MhzMxT7, and this has been the case forever, or at least since GCC 5.x. Clang on the other hand, will only optimize away the `pow` call at `-O1` and `-O2`, not `-O0`: https://godbolt.org/z/Wbnqj3q6c. Thus when this test was built with Clang (we don't pass `-O` so we default to `-O0`) it was failing in the CI environment, because it would actually have a call to the "new" `pow`.

  Avoid this issue by using a symbol that won't be optimized away, or that we are unlikely to ever have versioning issues with.

ACKs for top commit:
  laanwj:
    ACK 5449d44e37

Tree-SHA512: 3a26c5c3a5f2905fd0dd90892470e241ba625c0af3be2629d06d5da3a97534c1d6a55b796bbdd41e2e6a26a8fab7d981b98c45d4238565b0eb7edf3c5da02007
2021-08-18 17:16:11 +02:00
John Newbery
ed9ba8af08 [tests] Remove CAddrMan.Clear() call from CAddrDB::Read()
`bool CAddrDB::Read(CAddrMan& addr, CDataStream& ssPeers)` is _only_
called from the tests, and the call to addr.Clear() only exists so that
a test that Clear() is called passes. Remove that test and the call.
2021-08-18 14:00:52 +01:00
John Newbery
e8e7392311 [addrman] Don't call Clear() if parsing peers.dat fails
Now that we manage the lifespan of node.addrman, we can just reset
node.addrman to a newly initialized CAddrMan if parsing peers.dat
fails, eliminating the possibility that Clear() leaves some old state
behind.
2021-08-18 14:00:52 +01:00
John Newbery
181a1207ba [addrman] Move peers.dat parsing to init.cpp 2021-08-18 14:00:52 +01:00
fanquake
e35c4a3d80
Merge bitcoin/bitcoin#22732: net: use m_client_interface rather than uiInterface
d8ba6327b2 scripted-diff: replace clientInterface with m_client_interface in net (fanquake)
f68c6cebe6 net: use clientInterface rather than uiInterface (fanquake)

Pull request description:

  First commit fixes two cases where we were using `uiInterface`, rather than `clientInterface`.
  Second commit renames `clientInterface` to `m_client_interface`, to match banman.

ACKs for top commit:
  hebasto:
    ACK d8ba6327b2, verified that `uiInterface` is replaced in all sites.
  Zero-1729:
    crACK d8ba6327b2

Tree-SHA512: 9c893d8799b0bc7737836c16e11b77b6f9dffa31041ec6678e63cad958ea06da09a841b99cc61c1b4d9f6f4f1be397ca5a8d2fb2fb7ab08c9437043f8a57c3dc
2021-08-18 20:12:39 +08:00
fanquake
d8ba6327b2
scripted-diff: replace clientInterface with m_client_interface in net
-BEGIN VERIFY SCRIPT-

sed -i -e "s/clientInterface/m_client_interface/g" src/net.cpp src/net.h

-END VERIFY SCRIPT-
2021-08-18 13:54:43 +08:00