Commit Graph

25661 Commits

Author SHA1 Message Date
Kittywhiskers Van Gogh
bfd33cd2b4
net: move CConnman::RelayInv{Filtered} into PeerManager 2024-04-23 16:08:10 +00:00
Kittywhiskers Van Gogh
313a7e9a50
trivial: cleanup unnecessary headers in context files 2024-04-23 16:06:41 +00:00
Kittywhiskers Van Gogh
c3f1ac2291
net: retire CConnman::RelayTransaction, use PeerManager::RelayTransaction 2024-04-23 16:06:41 +00:00
Kittywhiskers Van Gogh
0323c6ca17
net: move Relay{Inv, InvFiltered, Transaction} out of CConnman 2024-04-23 16:06:41 +00:00
Kittywhiskers Van Gogh
d54ba447a7
net: use ForEachNode instead of manually iterating through vNodes
ForEachNode is publicly available, which will help us extract the
functions from CConnman in a subsequent commit
2024-04-23 16:06:40 +00:00
MarcoFalke
7cc77f3a30
Merge #21373: test: generate fewer blocks in feature_nulldummy to fix timeouts, speed up
ccd976dd3dbb8f991dc1203ada2043f1736be5a4 test: use 327 fewer blocks in feature_nulldummy (Jon Atack)
68c280f19732fb96bc29113ce9c8007d0101868c test, refactor: abstract the feature_nulldummy blockheight values (Jon Atack)

Pull request description:

  The resolved timeout issue seen in the CI can be reproduced locally by running `test/functional/feature_nulldummy.py --valgrind --loglevel=debug`

  Speeds up the normal test runtime for me from 3.8 to 2.2 seconds (debug build). Thanks to Marco Falke for the approach suggestion.

ACKs for top commit:
  AnthonyRonning:
    reACK ccd976dd3dbb8f991dc1203ada2043f1736be5a4 - ran a few times with the rest of the tests and still passing for me with just the fewer block change.
  MarcoFalke:
    review ACK ccd976dd3dbb8f991dc1203ada2043f1736be5a4 🏝

Tree-SHA512: 38339dca4276d1972e3a5a5ee436da64e9e58fd3b50b186e34b07ade9523ac4c03f6c3869c5f2a59c23b43c44f87e712f8297a01a8d83202049c081e3eeb4445
2024-04-23 22:41:11 +07:00
Konstantin Akimov
a933a60b1a
feat: new command line argument -bip147height for bitcoin#21373
This command line argument is substitute for -segwitheight so far as dash does
not have a segwit feature
2024-04-23 22:41:10 +07:00
fanquake
51911388f2
Merge #21377: Speedy trial support for versionbits
ffe33dfbd4c3b11e3475b022b6c1dd077613de79 chainparams: drop versionbits threshold to 90% for mainnnet and signet (Anthony Towns)
f054f6bcd2c2ce5fea84cf8681013f85a444e7ea versionbits: simplify state transitions (Anthony Towns)
55ac5f568a3b73d6f1ef4654617fb76e8bcbccdf versionbits: Add explicit NEVER_ACTIVE deployments (Anthony Towns)
dd07e6da48040dc7eae46bc7941db48d98a669fd fuzz: test versionbits delayed activation (Anthony Towns)
dd85d5411c1702c8ae259610fe55050ba212e21e tests: test versionbits delayed activation (Anthony Towns)
73d4a706393e6dbd6b6d6b6428f8d3233ac0a2d8 versionbits: Add support for delayed activation (Anthony Towns)
9e6b65f6fa205eee5c3b99343988adcb8d320460 tests: clean up versionbits test (Anthony Towns)
593274445004506c921d5d851361aefb3434d744 tests: test ComputeBlockVersion for all deployments (Anthony Towns)
63879f0a4760c0c0f784029849cb5d21ee088abb tests: pull ComputeBlockVersion test into its own function (Anthony Towns)

Pull request description:

  BIP9-based implementation of "speedy trial" activation specification, see https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-March/018583.html

  Edge cases are tested by fuzzing added in #21380.

ACKs for top commit:
  instagibbs:
    tACK ffe33dfbd4
  jnewbery:
    utACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79
  MarcoFalke:
    review ACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79 💈
  achow101:
    re-ACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79
  gmaxwell:
    ACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79
  benthecarman:
    ACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79
  Sjors:
    ACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79
  jonatack:
    Initial approach ACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79 after a first pass of review, building and testing each commit, mostly looking at the changes and diffs. Will do a more high-level review iteration. A few minor comments follow to pick/choose/ignore.
  ariard:
    Code Review ACK ffe33df

Tree-SHA512: f79a7146b2450057ee92155cbbbcec12cd64334236d9239c6bd7d31b32eec145a9781c320f178da7b44ababdb8808b84d9d22a40e0851e229ba6d224e3be747c
2024-04-23 22:41:10 +07:00
W. J. van der Laan
ecade9bc39
Merge bitcoin/bitcoin#21749: test: Bump shellcheck version
08f3dbb1b0cd5ca01d87e488a2fa905adf7df057 test: Bump shellcheck version (Hennadii Stepanov)

Pull request description:

  The changelog for v0.7.2 is available [here](https://github.com/koalaman/shellcheck/blob/v0.7.2/CHANGELOG.md).

  Only [SC2268](https://github.com/koalaman/shellcheck/wiki/SC2268) requires to update our code.

ACKs for top commit:
  jarolrod:
    ACK  08f3dbb1b0cd5ca01d87e488a2fa905adf7df057

Tree-SHA512: 4585cd1f4d9def2fbaafe5a2a57761288d432781eb8c6c6d37064727d7ca8fc3f35c552e6a2ffdf0820d753d4bde2c8e43e5f3f57d242f5f57591a9b1b03558d
2024-04-23 22:41:10 +07:00
fanquake
eeec2f2799
Merge bitcoin/bitcoin#21884: fuzz: Remove unused --enable-danger-fuzz-link-all option
fa27d6d3ac065684a1219e9a948514d27929cf7c fuzz: Remove unused --enable-danger-fuzz-link-all option (MarcoFalke)

Pull request description:

  Remove the unused build option, which was *dangerous* (as the name implies). Also remove the fuzzbuzz config, which was never used as part of this repo and seems redundant now that we integrate with oss-fuzz.

ACKs for top commit:
  practicalswift:
    cr ACK fa27d6d3ac065684a1219e9a948514d27929cf7c: patch looks correct and rationale makes sense
  hebasto:
    ACK fa27d6d3ac065684a1219e9a948514d27929cf7c, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 9bd65ed6a76d13d8d9c7a88aaae30f701215d5d0619693a3115d5ec350808aaf6a1aa4737466a5b96f3948513ec4d063808fe16219818366720e247880a15177
2024-04-23 22:41:09 +07:00
MarcoFalke
51633d70ea
Merge bitcoin/bitcoin#21874: fuzz: Add WRITE_ALL_FUZZ_TARGETS_AND_ABORT
fa5cb6b268554fe0f272833794a98106872ac6a5 fuzz: Add WRITE_ALL_FUZZ_TARGETS_AND_ABORT (MarcoFalke)

Pull request description:

  This is needed when stdout is polluted by the fuzz engine. stderr can't be used instead because it is polluted by aborting the program.

Top commit has no ACKs.

Tree-SHA512: bf0a2a6bcd964ff1f0f3ef6e7e297b4c780430c4d6312332ed99ace0e1c58243c1483fd387e39405837d39b36072dfeb9ae03d2a7aa728ad6955159754fd5766
2024-04-23 22:41:09 +07:00
MarcoFalke
a02a2c0322
Merge bitcoin/bitcoin#21681: validation: fix ActivateSnapshot to use hardcoded nChainTx
91d93aac4e3fe6fff5ef492ed152c4d8fa6f2672 validation: remove nchaintx from assumeutxo metadata (James O'Beirne)
931684b24a89aba884cb18c13fa67ccca339ee8c validation: fix ActivateSnapshot to use hardcoded nChainTx (James O'Beirne)

Pull request description:

  This fixes an oversight from the move of nChainTx from the user-supplied
  snapshot metadata into the hardcoded assumeutxo chainparams.

  Since the nChainTx is now unused in the metadata, it should be removed
  in a future commit.

  See: https://github.com/bitcoin/bitcoin/pull/19806#discussion_r612165410

ACKs for top commit:
  Sjors:
    utACK 91d93aac4e3fe6fff5ef492ed152c4d8fa6f2672
  ryanofsky:
    Code review ACK 91d93aac4e3fe6fff5ef492ed152c4d8fa6f2672. No change to previous commit, just new commit removing now unused utxo snapshot field and updating tests.

Tree-SHA512: 445bdd738faf007451f40bbcf360dd1fb4675e17a4c96546e6818c12e33dd336dadd95cf8d4b5f8df1d6ccfbc4bf5496864bb5528e416cea894857b6b732140c
2024-04-23 22:41:09 +07:00
MarcoFalke
71f23d6e33
Merge bitcoin/bitcoin#21814: test: Fix feature_config_args.py intermittent issue
fab1eb65b196d62466fdc2ed319ffa19d3560a0c test: Fix feature_config_args.py intermittent issue (MarcoFalke)

Pull request description:

  Fix #21448

ACKs for top commit:
  laanwj:
    Code review ACK fab1eb65b196d62466fdc2ed319ffa19d3560a0c

Tree-SHA512: cad9f684f43aa801d0c1cb5f1684ffa624df1216be225cea46b1389ba2b67cbd6159ffb786fe144bf1ca865623dd9a10289d4293cfabb678bdb243d4ea00734d
2024-04-23 22:41:08 +07:00
MarcoFalke
de4d2a839d
Merge bitcoin/bitcoin#21714: refactor: Drop CCoinControl::SetNull
c5a470eee1ac864b7c02b6a1669327b68411d806 refactor: Drop CCoinControl::SetNull (João Barbosa)

Pull request description:

  The only external call to `SetNull` is changed as follow

  ```diff
  - m_coin_control->SetNull();
  + m_coin_control = std::make_unique<CCoinControl>();
  ```

ACKs for top commit:
  theStack:
    Code-Review ACK c5a470eee1ac864b7c02b6a1669327b68411d806
  MarcoFalke:
    review ACK c5a470eee1ac864b7c02b6a1669327b68411d806 🍤

Tree-SHA512: 2588828720cdcf405fc4fb06f2aa17ad4eef2a645e12d820311006127e732258dd084993f17f23742f8e7f782e18289a6199dcec3690efc9b92458f90b816a8f
2024-04-23 22:41:08 +07:00
Hennadii Stepanov
a63f9c31cc
Merge bitcoin-core/gui#284: refactor: Simplify SendCoinsDialog::updateCoinControlState
5f438d66c1fbc0e524d12fef233f2ed2952e6f17 refactor, qt: Simplify SendCoinsDialog::updateCoinControlState (João Barbosa)

Pull request description:

  This PR doesn't change behaviour, removes the coin control argument from `updateCoinControlState` since it's a class member.

ACKs for top commit:
  hebasto:
    ACK 5f438d66c1fbc0e524d12fef233f2ed2952e6f17, I have reviewed the code and it looks OK, I agree it can be merged.
  jonatack:
    Code review ACK 5f438d66c1fbc0e524d12fef233f2ed2952e6f17
  kristapsk:
    utACK 5f438d66c1fbc0e524d12fef233f2ed2952e6f17. Code looks correct.

Tree-SHA512: 14abaa3d561f8c8854fed989b6aca886dcca42135880bac76070043f61c0042ec8967f2b83e50bbbb82050ef0f074209e97fa300cb4dc51ee182316e0846506d
2024-04-23 22:41:08 +07:00
MarcoFalke
b2d889380c
Merge bitcoin/bitcoin#21792: test: Fix intermittent issue in p2p_segwit.py
fad6269916dbf8adc14d757a18f19c74e95cf659 test: Assert that exit code indicates failure (MarcoFalke)
faecb72c3ca744f1adb77bd910c643cedec3b445 test: Fix intermittent issue in p2p_segwit.py (MarcoFalke)

Pull request description:

  Calling `start_node` might call `wait_for_rpc_connection`, which will fail.

  https://cirrus-ci.com/task/5669555591708672?logs=ci#L3504

  ```
    File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_segwit.py", line 1974, in test_upgrade_after_activation
      self.start_node(2, extra_args=["-reindex", f"-segwitheight={SEGWIT_HEIGHT}"])
    File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 508, in start_node
      node.wait_for_rpc_connection()
    File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_node.py", line 224, in wait_for_rpc_connection
      raise FailedToStartError(self._node_msg(
  test_framework.test_node.FailedToStartError: [node 2] bitcoind exited with status 1 during initialization

ACKs for top commit:
  jnewbery:
    ACK fad6269916dbf8adc14d757a18f19c74e95cf659
  dhruv:
    ACK fad6269

Tree-SHA512: 4c5e39ce25e135717ea433258518f93f09d1c528c4538a8627d3da13bc0c0ba4b45911703c26392ff0f5e0cb7831a6c7cc53e6e29102d3da9c8cfce7cef333cc
2024-04-23 22:41:07 +07:00
pasta
6194e454d7
Merge #5983: backport: Merge bitcoin#22138, 21939, bitcoin-core/gui#163, 20373, 22144, 22013, 21719, 20786
18169f4957 Merge #20786: net: [refactor] Prefer integral types in CNodeStats (MarcoFalke)
751c9e66c4 Merge bitcoin/bitcoin#21719: refactor: Add and use EnsureConnman in rpc code (MarcoFalke)
74b20eb309 Merge bitcoin/bitcoin#22013: net: ignore block-relay-only peers when skipping DNS seed (fanquake)
366ca98b39 Merge bitcoin/bitcoin#22144: Randomize message processing peer order (fanquake)
4d20cb7173 Merge #20373: refactor, net: Increase CNode data member encapsulation (MarcoFalke)
b8b3c4c289 Merge bitcoin-core/gui#163: Peer details: replace Direction with Connection Type (MarcoFalke)
00b828c0f5 Merge bitcoin/bitcoin#21939: refactor: Replace memset calls with array initialization (W. J. van der Laan)
7bcc56c9b6 Merge bitcoin/bitcoin#22138: script: fix spelling linter raising spuriously on "invokable" (MarcoFalke)

Pull request description:

  bitcoin backports

Top commit has no ACKs.

Tree-SHA512: 28dd3c672be847a376aaf1683a665b658b132364b4903fa360810dead7f30bd6496c231b6496e55572e09f1908febdba385d863e5e1d714cb784cc4350126be9
2024-04-23 09:58:20 -05:00
MarcoFalke
18169f4957
Merge #20786: net: [refactor] Prefer integral types in CNodeStats
faecb74562d012a336837d3b39572c235ad2eb9d Expose integral m_conn_type in CNodeStats, remove m_conn_type_string (Jon Atack)

Pull request description:

  Currently, strings are stored for what are actually integral (strong) enum types. This is fine, because the strings are only used as-is for the debug log and RPC. However, it complicates using them in the GUI. User facing strings in the GUI should be translated and only string literals can be picked up for translation, not runtime `std::string`s.

  Fix that by removing the `std::string` members and replace them by strong enum integral types.

ACKs for top commit:
  jonatack:
    Code review ACK faecb74562d012a336837d3b39572c235ad2eb9d
  theStack:
    Code review ACK faecb74562d012a336837d3b39572c235ad2eb9d 🌲

Tree-SHA512: 24df2bd0645432060e393eb44b8abaf20fe296457d07a867b0e735c3e2e75af7b03fc6bfeca734ec33ab816a7c8e1f8591a5ec342f3afe3098a4e41f5c2cfebb
2024-04-23 09:53:08 -05:00
MarcoFalke
751c9e66c4
Merge bitcoin/bitcoin#21719: refactor: Add and use EnsureConnman in rpc code
fafb68add5e16e8bd5b9428bcffcaee2639747cf refactor: Add and use EnsureConnman in rpc code (MarcoFalke)
faabeb854a6e46b46e4f26b22dc2c81e68e2d863 refactor: Mark member functions const (MarcoFalke)

Pull request description:

  This removes the 10 occurrences of `throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");` and replaces them with `EnsureConnman`.

ACKs for top commit:
  jarolrod:
    re-ACK fafb68add5e16e8bd5b9428bcffcaee2639747cf
  theStack:
    ACK fafb68add5e16e8bd5b9428bcffcaee2639747cf
  ryanofsky:
    Code review ACK fafb68add5e16e8bd5b9428bcffcaee2639747cf

Tree-SHA512: 84c63cfe31e548645d906f7191a3526c7bea99ed0d54c2a75c2041452a44fe149ede343d8e1943b0e7770816c828bb047dfec8bc541a1f2b89920a126ee54d68
2024-04-23 09:53:07 -05:00
fanquake
74b20eb309
Merge bitcoin/bitcoin#22013: net: ignore block-relay-only peers when skipping DNS seed
fe3d17df04decc4e856121eb311636977d60f80f net: ignore block-relay-only peers when skipping DNS seed (Anthony Towns)

Pull request description:

  Since #17428 bitcoind will attempt to reconnect to two block-relay-only anchors before doing any other outbound connections. When determining whether to use DNS seeds, it will currently see these two peers and decide "we're connected to the p2p network, so no need to lookup DNS" -- but block-relay-only peers don't do address relay, so if your address book is full of invalid addresses (apart from your anchors) this behaviour will prevent you from recovering from that situation.

  This patch changes it so that it only skips use of DNS seeds when there are two full-outbound peers, not just block-relay-only peers.

ACKs for top commit:
  Sjors:
    utACK fe3d17d
  amitiuttarwar:
    ACK fe3d17df04decc4e856121eb311636977d60f80f, this impacts the very common case where we stop/start a node, persisting anchors & have a non-empty addrman (although, to be clear, wouldn't be particularly problematic in the common cases where the addrman has valid addresses)
  mzumsande:
    ACK fe3d17df04decc4e856121eb311636977d60f80f
  jonatack:
    ACK fe3d17df04decc4e856121eb311636977d60f80f
  prayank23:
    tACK fe3d17df04

Tree-SHA512: 9814b0d84321d7f45b5013eb40c420a0dd93bf9430f5ef12dce50d1912a18d5de2070d890a8c6fe737a3329b31059b823bc660b432d5ba21f02881dc1d951e94
2024-04-23 09:53:07 -05:00
fanquake
366ca98b39
Merge bitcoin/bitcoin#22144: Randomize message processing peer order
79c02c88b347f1408a2db307db2654917f9b0bcc Randomize message processing peer order (Pieter Wuille)

Pull request description:

  Right now, the message handling loop iterates the list of nodes always in the same order: the order they were connected in (see the `vNodes` vector). For some parts of the net processing logic, this order matters. Transaction requests are assigned explicitly to peers since #19988, but many other parts of processing work on a "first-served-by-loop-first" basis, such as block downloading. If peers can predict this ordering, it may be exploited to cause delays.

  As there isn't anything particularly optimal about the current ordering, just make it unpredictable by randomizing.

  Reported by Crypt-iQ.

ACKs for top commit:
  jnewbery:
    ACK 79c02c88b3
  Crypt-iQ:
    ACK 79c02c88b347f1408a2db307db2654917f9b0bcc
  sdaftuar:
    utACK 79c02c88b347f1408a2db307db2654917f9b0bcc
  achow101:
    Code Review ACK 79c02c88b347f1408a2db307db2654917f9b0bcc
  jamesob:
    crACK 79c02c88b3
  jonatack:
    ACK 79c02c88b347f1408a2db307db2654917f9b0bcc
  vasild:
    ACK 79c02c88b347f1408a2db307db2654917f9b0bcc
  theStack:
    ACK 79c02c88b347f1408a2db307db2654917f9b0bcc

Tree-SHA512: 9a87c4dcad47c2d61b76c4f37f59674876b78f33f45943089bf159902a23e12de7a5feae1a73b17cbc3f2e37c980ecf0f7fd86af9e6fa3a68099537a3c82c106
2024-04-23 09:53:07 -05:00
MarcoFalke
4d20cb7173
Merge #20373: refactor, net: Increase CNode data member encapsulation
3642b2ed34e6609e8de558b352516daadb12cac1 refactor, net: Increase CNode data member encapsulation (Hennadii Stepanov)
acebb79d3f45eb18f820ca5bbc1e16e80fac55f1 refactor, move-only: Relocate CNode private members (Hennadii Stepanov)

Pull request description:

  All protected `CNode` data members could be private.

ACKs for top commit:
  jnewbery:
    utACK 3642b2ed34e6609e8de558b352516daadb12cac1
  MarcoFalke:
    review ACK 3642b2ed34e6609e8de558b352516daadb12cac1 🏛

Tree-SHA512: 8435e3c43c3b7a3107d58cb809b8b5e1a1c0068677e249bdf0fc6ed24140ac4fc4efe2a280a1ee86df180d738c0c9e10772308690607954db6713000cf6e728d
2024-04-23 09:53:07 -05:00
MarcoFalke
b8b3c4c289
Merge bitcoin-core/gui#163: Peer details: replace Direction with Connection Type
06ba9b300866f33e21512af9d7d2891ee1501bf4 rpc: move getpeerinfo connection_type help to correct place (Jon Atack)
c95fe6e38f542f9fe8ddb1522b5ff1cac17db4bf gui: improve connection type tooltip (Hennadii Stepanov)
2c19ba2e1d26e2077da8b469f44588c20af87e23 gui: replace Direction with Connection Type in peer details (Jon Atack)
7e2beab2d28d8ab039d9554744a11592a7d7dc76 gui: create GUIUtil::ConnectionTypeToQString utility function (Jon Atack)

Pull request description:

  ![Screenshot from 2021-01-09 11-23-17](https://user-images.githubusercontent.com/2415484/104089297-c5e18d80-5265-11eb-9251-49afcfdb562b.png)

  Closes #159.

ACKs for top commit:
  hebasto:
    re-ACK 06ba9b300866f33e21512af9d7d2891ee1501bf4, the tooltip content is organized as unordered list.
  jarolrod:
    re-ACK 06ba9b300866f33e21512af9d7d2891ee1501bf4

Tree-SHA512: 24f46494ceb42ed308e4a4f2a543dbc4f4e6409a6f738c145a9f16e175bf69d411cbc944a4fd969f1829d57644dfbc194182fa8d4e9e6bce82acbeca8c673748
2024-04-23 09:53:06 -05:00
W. J. van der Laan
00b828c0f5
Merge bitcoin/bitcoin#21939: refactor: Replace memset calls with array initialization
1c9255c7dd2d4f12bfb508bcc8d123a6354d8842 refactor: Replace memset calls with array initialization (João Barbosa)

Pull request description:

  Follow up to https://github.com/bitcoin/bitcoin/pull/21905#pullrequestreview-657045699.

ACKs for top commit:
  laanwj:
    re-ACK 1c9255c7dd2d4f12bfb508bcc8d123a6354d8842
  Crypt-iQ:
    Code review ACK 1c9255c7dd2d4f12bfb508bcc8d123a6354d8842

Tree-SHA512: 4b61dec2094f4781ef1c0427ee3bda3cfea12111274eebc7bc40a84f261d9c1681dd0860c57200bea2456588e44e8e0aecd18545c25f1f1250dd331ab7d05f28
2024-04-23 09:53:06 -05:00
MarcoFalke
7bcc56c9b6
Merge bitcoin/bitcoin#22138: script: fix spelling linter raising spuriously on "invokable"
8050eb43bf15501e33ec5312918d926e47e4fc8d script: fix spelling linter raising spuriously on "invokable" (Jon Atack)

Pull request description:

  "invokable" is a valid word that means to be callable, but the linter is raising on it:
  ```
  $ test/lint/lint-spelling.sh
  contrib/guix/guix-attest:18: invokable ==> invocable
  contrib/guix/guix-clean:18: invokable ==> invocable
  contrib/guix/guix-verify:18: invokable ==> invocable
  ^ Warning: codespell identified likely spelling errors. Any false positives? Add them to the list of ignored words in test/lint/lint-spelling.ignore-words.txt
  ```

ACKs for top commit:
  MarcoFalke:
    cr ACK 8050eb43bf15501e33ec5312918d926e47e4fc8d

Tree-SHA512: 43f8dc7b7adb00ae563ccfe04a64a7ceb50237f24ff87209062bf57b2564b4d38a409df80e0183aa4f40ab306b5e07d7a5fad1600d41705bd3c443ed66a6d1c1
2024-04-23 09:53:04 -05:00
pasta
5c240bbc5e
Merge #5986: trivial: remove boost::{function, lexical_cast} usage, backport bitcoin#25550, #24624, #24406, cleanup some gArgs usage in init
740d25c062 merge bitcoin#24406: Fix Wambiguous-reversed-operator compiler warnings (Kittywhiskers Van Gogh)
3265b54a2f merge bitcoin#24624: Avoid potential -Wdeprecated-enum-enum-conversion warnings (Kittywhiskers Van Gogh)
65585e68e6 merge bitcoin#25550: remove note on arm cross-compilation from build-unix.md (Kittywhiskers Van Gogh)
fbc6bc88cf init: use local ArgsManager variable instead of global when possible (Kittywhiskers Van Gogh)
9ae39f9ba7 qt: drop leftover `boost::function` usage in Qt, drop header from list (Kittywhiskers Van Gogh)
c47e9e78ed bench: drop leftover `boost::lexical_cast` benches, drop header from list (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  When building Dash with `clang-16`, I use the following `CXXFLAGS`:

  ```
  -Werror -Werror=reorder -Werror=thread-safety -Wno-unused-command-line-argument -Wno-deprecated-builtins -Wno-deprecated-volatile -Wno-ambiguous-reversed-operator -Wno-deprecated-enum-enum-conversion
  ```
  The explanations of the `-Wno*` flags are as follows:

  | Argument                               | Reason                                                       |
  | -------------------------------------- | ------------------------------------------------------------ |
  | `-Wno-unused-command-line-argument`    | Lingering use of `-static-libstdc++`, a GCC-ism that isn't recognized as a valid argument in Clang (no longer an issue thanks to https://github.com/dashpay/dash/pull/5958, thanks knst!) |
  | `-Wno-deprecated-builtins`             | Due to usage of [deprecated builtins](2dacfb08bd/src/bench/nanobench.h (L104-L110)) in `nanobench` that exist even in the [most current version](a5a50c2b33/src/include/nanobench.h (L115-L121)) (see below) |
  | `-Wno-deprecated-volatile`             | The detection code for C++20 in the CI image (based on Ubuntu `focal`) relies on deprecated volatiles (see below) |
  | `-Wno-ambiguous-reversed-operator`     | Due to an ambiguous operator in a Dash unit test ([source](2dacfb08bd/src/test/fuzz/addrman.cpp (L145))) (see below) |
  | `-Wno-deprecated-enum-enum-conversion` | Due to key combination code in Dash Qt ([source](2dacfb08bd/src/qt/bitcoingui.cpp (L376))) (see below) |

  <details>
  <summary>-Wno-deprecated-builtins</summary>

  ```
  > make
  Making all in src
  make[1]: Entering directory '/src/dash/src'
  make[2]: Entering directory '/src/dash/src'
  make[3]: Entering directory '/src/dash'
  make[3]: Leaving directory '/src/dash'
    CXX      bench/bench_dash-addrman.o
  In file included from bench/addrman.cpp:6:
  In file included from ./bench/bench.h:16:
  ./bench/nanobench.h:952:13: error: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
      return !ANKERL_NANOBENCH_IS_TRIVIALLY_COPYABLE(Decayed) || sizeof(Decayed) > sizeof(long) || std::is_pointer<Decayed>::value;
              ^
  ./bench/nanobench.h:107:57: note: expanded from macro 'ANKERL_NANOBENCH_IS_TRIVIALLY_COPYABLE'
  #    define ANKERL_NANOBENCH_IS_TRIVIALLY_COPYABLE(...) __has_trivial_copy(__VA_ARGS__)
                                                          ^
  1 error generated.
  make[2]: *** [Makefile:14567: bench/bench_dash-addrman.o] Error 1
  make[2]: Leaving directory '/src/dash/src'
  make[1]: *** [Makefile:18568: all-recursive] Error 1
  make[1]: Leaving directory '/src/dash/src'
  make: *** [Makefile:800: all-recursive] Error 1
  ```

  </details>

  <details>
  <summary>-Wno-deprecated-volatile</summary>

  ```
  > ./configure [...]
  [...]
  checking whether clang++-16 supports C++20 features with -h std=c++20... no
  checking whether clang++-16 supports C++20 features with -std=c++2a... no
  checking whether clang++-16 supports C++20 features with +std=c++2a... no
  checking whether clang++-16 supports C++20 features with -h std=c++2a... no
  configure: error: *** A compiler with support for C++20 language features is required.

  > cat config.log
  This file contains any messages produced by compilers while
  running configure, to aid debugging if configure makes a mistake.

  It was created by Dash Core configure 21.0.0, which was
  generated by GNU Autoconf 2.69.  Invocation command line was

    $ ./configure --prefix=/src/dash/depends/x86_64-pc-linux-gnu --enable-zmq --enable-reduce-exports --disable-crash-hooks --disable-stacktraces --enable-c++20 --enable-suppress-external-warnings --enable-debug --disable-ccache --with-sanitizers=thread
  [...]
  configure:4450: checking whether clang++-16 accepts -g
  configure:4470: clang++-16 -c -g -I/src/dash/depends/x86_64-pc-linux-gnu/include/ -DDEBUG_LOCKORDER -DENABLE_DASH_DEBUG -DARENA_DEBUG conftest.cpp >&5
  configure:4470: $? = 0
  configure:4511: result: yes
  configure:4537: checking whether make supports the include directive
  configure:4552: make -f confmf.GNU && cat confinc.out
  this is the am__doit target
  configure:4555: $? = 0
  configure:4574: result: yes (GNU style)
  configure:4599: checking dependency style of clang++-16
  configure:4710: result: gcc3
  configure:4756: checking whether clang++-16 supports C++20 features with -std=c++20
  configure:5558: clang++-16 -std=c++20 -c -pipe -O2 -Werror -Werror=reorder -Werror=thread-safety -Wno-deprecated-builtins -I/src/dash/depends/x86_64-pc-linux-gnu/include/ -DDEBUG_LOCKORDER -DENABLE_DASH_DEBUG -DARENA_DEBUG conftest.cpp >&5
  conftest.cpp:109:36: error: volatile-qualified parameter type 'volatile int' is deprecated [-Werror,-Wdeprecated-volatile]
      test(const int c, volatile int v) // 'volatile is deprecated in C++20'
                                     ^
  1 error generated.
  ```

  </details>

  <details>

  <summary>-Wno-ambiguous-reversed-operator</summary>

  ```
  > make
  Making all in src
  make[1]: Entering directory '/src/dash/src'
  make[2]: Entering directory '/src/dash/src'
  make[3]: Entering directory '/src/dash'
  make[3]: Leaving directory '/src/dash'
  [...]
    CXX      test/fuzz/fuzz-addrman.o
  test/fuzz/addrman.cpp:329:22: error: ISO C++20 considers use of overloaded operator '==' (with operand types 'CAddrManDeterministic' and 'CAddrManDeterministic') to be ambiguous despite there being a unique best viable function [-Werror,-Wambiguous-reversed-operator]
      assert(addr_man1 == addr_man2);
             ~~~~~~~~~ ^  ~~~~~~~~~
  /usr/include/assert.h:93:27: note: expanded from macro 'assert'
       (static_cast <bool> (expr)                                         \
                            ^~~~
  test/fuzz/addrman.cpp:145:10: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
      bool operator==(const CAddrManDeterministic& other)
           ^
  test/fuzz/addrman.cpp:145:10: note: mark 'operator==' as const or add a matching 'operator!=' to resolve the ambiguity
  1 error generated.
  make[2]: *** [Makefile:15393: test/fuzz/fuzz-addrman.o] Error 1
  make[2]: *** Waiting for unfinished jobs....
  make[3]: Leaving directory '/src/dash/src/dashbls'
  make[2]: Leaving directory '/src/dash/src'
  make[1]: *** [Makefile:18568: all-recursive] Error 1
  make[1]: Leaving directory '/src/dash/src'
  make: *** [Makefile:800: all-recursive] Error 1
  ```

  </details>

  <details>

  <summary>-Wno-deprecated-enum-enum-conversion</summary>

  ```
  > make
  Making all in src
  make[1]: Entering directory '/src/dash/src'
  make[2]: Entering directory '/src/dash/src'
  make[3]: Entering directory '/src/dash'
  make[3]: Leaving directory '/src/dash'
  [...]
    CXX      qt/libbitcoinqt_a-bitcoingui.o
  qt/bitcoingui.cpp:376:51: error: arithmetic between different enumeration types ('Qt::Modifier' and 'Qt::Key') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
      quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
                                           ~~~~~~~~ ^ ~~~~~~~~~
  qt/bitcoingui.cpp:609:56: error: arithmetic between different enumeration types ('Qt::Modifier' and 'Qt::Key') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
      minimize_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
                                                ~~~~~~~~ ^ ~~~~~~~~~
  2 errors generated.
  make[2]: *** [Makefile:12803: qt/libbitcoinqt_a-bitcoingui.o] Error 1
  make[2]: *** Waiting for unfinished jobs....
  make[2]: Leaving directory '/src/dash/src'
  make[1]: *** [Makefile:18568: all-recursive] Error 1
  make[1]: Leaving directory '/src/dash/src'
  make: *** [Makefile:800: all-recursive] Error 1
  ```

  </details>

  This pull request removes the need for the last two `-Wno*` flags, removes some leftover `boost::`{`function`, `lexical_cast`} usage and some `gArgs` usage where a local variable would be more applicable.

  Additionally, in some builds, there is an deprecation warning (`-Wdeprecation`) for using `[=]` and relying on its implicit capture of `this` (see below), this can be seen during GCC builds but not Clang builds and correspond to a proposal to the C++20 standard ([proposal](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0806r2.html)).

  It has also been mentioned at https://en.cppreference.com/w/cpp/language/lambda, "The implicit capture of `*this` when the capture default is `=` is deprecated. _(since C++20)_". This has also been remedied as part of this PR.

  <details>

  <summary>-Wdeprecated</summary>

  ```
  > make -j10
  [...]
    CXX      qt/libbitcoinqt_a-trafficgraphwidget.o
  qt/optionsdialog.cpp: In lambda function:
  qt/optionsdialog.cpp:195:63: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
    195 |     connect(appearance, &AppearanceWidget::appearanceChanged, [=](){
        |                                                               ^
  qt/optionsdialog.cpp:195:63: note: add explicit 'this' or '*this' capture
  qt/optionsdialog.cpp: In lambda function:
  qt/optionsdialog.cpp:277:55: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
    277 |     connect(ui->coinJoinEnabled, &QCheckBox::clicked, [=](bool fChecked) {
        |                                                       ^
  qt/optionsdialog.cpp:277:55: note: add explicit 'this' or '*this' capture
  qt/optionsdialog.cpp: In lambda function:
  qt/optionsdialog.cpp:293:45: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
    293 |     connect(this, &OptionsDialog::rejected, [=]() {
        |                                             ^
  qt/optionsdialog.cpp:293:45: note: add explicit 'this' or '*this' capture
    CXX      qt/libbitcoinqt_a-utilitydialog.o
    CXX      qt/libbitcoinqt_a-addressbookpage.o
  [...]
  ```

  </details>

  ## Checklist

  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)**
  - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)**
  - [x] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  PastaPastaPasta:
    utACK 740d25c062
  knst:
    utACK 740d25c062

Tree-SHA512: 52793f9862192ccb556debcac2ec766c4f86e69ec4bedc2fdbaaff965ab4ac478b65b3983b1cb3a92610db85aee6f8668b0ded3494c617c5af7d8801284e461b
2024-04-23 09:45:43 -05:00
Kittywhiskers Van Gogh
740d25c062
merge bitcoin#24406: Fix Wambiguous-reversed-operator compiler warnings 2024-04-23 15:34:50 +00:00
Kittywhiskers Van Gogh
3265b54a2f
merge bitcoin#24624: Avoid potential -Wdeprecated-enum-enum-conversion warnings 2024-04-23 15:34:49 +00:00
Kittywhiskers Van Gogh
65585e68e6
merge bitcoin#25550: remove note on arm cross-compilation from build-unix.md 2024-04-23 15:34:49 +00:00
Kittywhiskers Van Gogh
fbc6bc88cf
init: use local ArgsManager variable instead of global when possible
We don't touch `CleanupBlockRevFiles` as the function is moved to
blockstorage in bitcoin#21727, where it would need access to the global.
GetBlocksDirPath() is non-const and invocations of that aren't included
either.
2024-04-23 15:34:49 +00:00
Kittywhiskers Van Gogh
9ae39f9ba7
qt: drop leftover boost::function usage in Qt, drop header from list 2024-04-23 15:34:48 +00:00
Kittywhiskers Van Gogh
c47e9e78ed
bench: drop leftover boost::lexical_cast benches, drop header from list
`boost::lexical_cast` isn't used anywhere in Dash Core, the sole remaining
use being in a benchmark, despite it no longer being used in Dash Core.
Let's drop the benchmark and drop `boost/lexical_cast.hpp` from allowed
Boost headers
2024-04-23 15:34:48 +00:00
pasta
0bb188a077
Merge #5988: test: disable ipv6 tests for now
10a006e626 test: disable ipv6 tests for now (UdjinM6)

Pull request description:

  ## Issue being fixed or feature implemented
  Our CI nodes on Amazon have issues running tests using ipv6.

  ## What was done?
  Pretend we don't have ipv6 when we run tests for now

  ## How Has This Been Tested?
  See CI results for this PR.

  ## Breaking Changes
  n/a but we'll have ipv6 not being tested for some time.

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  kwvg:
    ACK 10a006e626
  PastaPastaPasta:
    utACK 10a006e

Tree-SHA512: 75da180b916a5a99b1363f152494cbdd1031c7daf2d5eb370ca74547dee694ad04db3e9c677f0f738b9dbb15760d685a6b43b032dde642a4c1d49fff671e2aac
2024-04-23 09:30:24 -05:00
pasta
45bdfa582d
Merge #5979: backport: Merge bitcoin#21902, 22187, 21795, 22902,(followup) 19940, 22121, 21353, 21936
6c242da723 Merge bitcoin/bitcoin#21936: fuzz: Terminate immediately if a fuzzing harness tries to create a TCP socket (belt and suspenders) (MarcoFalke)
26ff28a028 Merge bitcoin/bitcoin#21353: interfaces: Stop exposing wallet destdata to gui (W. J. van der Laan)
348f4a8b9e Merge bitcoin/bitcoin#22121: doc: Various validation doc fixups (fanquake)
2996daad4c (followup) bitcoin#19940 (Vijay)
b6dbd8bd7d Merge bitcoin/bitcoin#22092: test: convert documentation into type annotations (fanquake)
cc70886b4d Merge bitcoin/bitcoin#21795: fuzz: Terminate immediately if a fuzzing harness tries to perform a DNS lookup (belt and suspenders) (MarcoFalke)
f3bc9535da Merge bitcoin/bitcoin#22187: test: Add sync_blocks in wallet_orphanedreward.py (MarcoFalke)
16ccb90bbb Merge bitcoin/bitcoin#21902: refactor: Remove useless extern keyword (fanquake)

Pull request description:

  backport: Merge bitcoin#21902, 22187, 21795, 22902,(followup) 19940, 22121, 21353, 21936

Top commit has no ACKs.

Tree-SHA512: 26de87da5d18fd36a38253a077131b36a278bc681bb47a9b893b6caad8520fc535b1675c3d79d312d455d710dd6ae7235d6cef1fb031a76e0559a200c2fc9b04
2024-04-23 09:15:50 -05:00
MarcoFalke
6c242da723
Merge bitcoin/bitcoin#21936: fuzz: Terminate immediately if a fuzzing harness tries to create a TCP socket (belt and suspenders)
393992b049d3bcf0b2a3439be128d13d6567f0b1 fuzz: Terminate immediately if a fuzzing harness ever tries to create a TCP socket (belt and suspenders) (practicalswift)

Pull request description:

  Terminate immediately if a fuzzing harness ever to create a TCP socket (belt and suspenders).

  Obviously this _should_ never happen, but if it _does_ happen we want immediate termination instead of a TCP socket :)

ACKs for top commit:
  MarcoFalke:
    ACK 393992b049d3bcf0b2a3439be128d13d6567f0b1

Tree-SHA512: 5bbff1f7e9a58b3eae24f742b7daf3fc870424c985f29bed5931e47a708d9c0984bfd8762f43658cffa9c69d32f86d56deb48bc7e43821e3398052174b6a160e
2024-04-23 09:15:21 -05:00
W. J. van der Laan
26ff28a028
Merge bitcoin/bitcoin#21353: interfaces: Stop exposing wallet destdata to gui
f5ba424cd44619d9b9be88b8593d69a7ba96db26 wallet: Add IsAddressUsed / SetAddressUsed methods (Russell Yanofsky)
62252c95e5aa55f33a5ef22292d5d8161fcb892a interfaces: Stop exposing wallet destdata to gui (Russell Yanofsky)
985430d9b2e183c1f59a34472e413a8d00a7e6da test: Add gui test for wallet receive requests (Russell Yanofsky)

Pull request description:

  Stop giving GUI access to destdata rows in database. Replace with narrow API just for saving and reading receive request information.

  This simplifies code and should prevent the GUI from interfering with other destdata like address-used status. It also adds some more GUI test coverage.

  There are no changes in behavior.

ACKs for top commit:
  jarolrod:
    tACK f5ba424cd44619d9b9be88b8593d69a7ba96db26
  laanwj:
    Code review ACK f5ba424cd44619d9b9be88b8593d69a7ba96db26

Tree-SHA512: 5423df4786e537a59013cb5bfb9e1bc29a7ca4b8835360c00cc2165a59f925fdc355907a4ceb8bca0285bb4946ba235bffa7645537a951ad03fd3b4cee17b6b0
2024-04-23 09:15:20 -05:00
fanquake
348f4a8b9e
Merge bitcoin/bitcoin#22121: doc: Various validation doc fixups
fa4245d88409091a3a6115a96a200b70be663725 doc: Various validation doc fixups (MarcoFalke)

Pull request description:

ACKs for top commit:
  michaelfolkson:
    Re-ACK fa4245d88409091a3a6115a96a200b70be663725
  jnewbery:
    ACK fa4245d884

Tree-SHA512: fa1086b09941247a4ffcbc1d7d27dc77a17a3ae093a5146dbb703db9ff4ba5d73ea77bd5b7747af79ea8a7dfe2c4c56a7e19ac5aac3417090e9ae127836022ae
2024-04-23 09:15:20 -05:00
Vijay
2996daad4c
(followup) bitcoin#19940 2024-04-23 09:15:20 -05:00
fanquake
b6dbd8bd7d
Merge bitcoin/bitcoin#22092: test: convert documentation into type annotations
68ace23fa3bc01baa734ddf2c0963acae1c75ed1 test: convert docs into type annotations in test_framework/test_node.py (fanquake)
8bfcba36db974326d258c610456bd55cf5818b1e test: convert docs into type annotations in test_framework/wallet.py (fanquake)
b043ca8e8b65199061ebe4bbed2200504dfc6ce9 test: convert docs into type annotations in test_framework/util.py (fanquake)

Pull request description:

  Rather than having function types exist as documentation, make them type annotations, which enables more `mypy` checking.

ACKs for top commit:
  instagibbs:
    utACK 68ace23fa3

Tree-SHA512: b705f26b48baabde07b9b2c0a8d547b4dcca291b16eaf5ac70462bb3a1f9e9c2783d93a9d4290889d0cbb3f7db3671446754411a1f498b265d336f6ff33478df
2024-04-23 09:15:20 -05:00
MarcoFalke
cc70886b4d
Merge bitcoin/bitcoin#21795: fuzz: Terminate immediately if a fuzzing harness tries to perform a DNS lookup (belt and suspenders)
3737d35fee283968f12e0772aa27aee4981fce41 fuzz: Terminate immediately if a fuzzing harness ever tries to perform a DNS lookup (belts and suspenders) (practicalswift)

Pull request description:

  Terminate immediately if a fuzzing harness tries to perform a DNS lookup (belt and suspenders).

  Obviously this _should_ never happen, but if it _does_ happen we want immediate termination instead of a DNS lookup :)

ACKs for top commit:
  MarcoFalke:
    review ACK 3737d35fee283968f12e0772aa27aee4981fce41

Tree-SHA512: 51cd2d32def7f9f052e02f99c354656af1f807cc9fdf592ab765e620bfe660f1ed26e0484763f94aba650424b44959eafaf352bfd0f81aa273e350510e97356e
2024-04-23 09:15:19 -05:00
MarcoFalke
f3bc9535da
Merge bitcoin/bitcoin#22187: test: Add sync_blocks in wallet_orphanedreward.py
7a681d61b0d98a310fbb1b8e095ab8fbc5d5741c Add sync_blocks in wallet_orphanedreward.py. (Daniel Kraft)

Pull request description:

  Add an explicit `sync_blocks` call in `wallet_orphanedreward.py`, which was missing and could lead to intermittent failures of the test due to race conditions.

  This will presumably fix #22181.

ACKs for top commit:
  MarcoFalke:
    review ACK 7a681d61b0d98a310fbb1b8e095ab8fbc5d5741c

Tree-SHA512: bb226c31bf3f2e7c52beb829d7b67496e5b38781245db5f9184e3f28c93ac3aa4d21fcf5bf3055e79d384cfd0ed916e79dccb3d77486e86fe1fedb5e35f894ad
2024-04-23 09:15:19 -05:00
fanquake
16ccb90bbb
Merge bitcoin/bitcoin#21902: refactor: Remove useless extern keyword
fa4bbd306e1ca369d02eb864983fbb4d64b50ca9 refactor: Remove useless extern keyword (MarcoFalke)

Pull request description:

  It is redundant, confusing and useless.

  https://en.cppreference.com/w/cpp/language/storage_duration#external_linkage

ACKs for top commit:
  practicalswift:
    cr ACK fa4bbd306e1ca369d02eb864983fbb4d64b50ca9: patch looks correct
  Talkless:
    utACK fa4bbd306e1ca369d02eb864983fbb4d64b50ca9, built successfully on Debian Sid, looks OK.
  jonatack:
    Light code review ACK fa4bbd306e1ca369d02eb864983fbb4d64b50ca9
  hebasto:
    ACK fa4bbd306e1ca369d02eb864983fbb4d64b50ca9, I've verified that all of the remained `extern` keywords specify either (a) a variable with external linkage, or (b) a symbol with "C" language linkage.
  promag:
    Code review ACK fa4bbd306e1ca369d02eb864983fbb4d64b50ca9.

Tree-SHA512: 1d77d661132defa52ccb2046f7a287deb3669b68835e40ab75a0d9d08fe6efeaf3bea7c0e76c754fd18bfe45972c253a39462014080d014cc5d810498784e3e4
2024-04-23 09:15:19 -05:00
pasta
eb7d24419a
Merge #5928: backport: Merge bitcoin#20406, 21370, 21395, 21007, 20040, 21418, 21447, 20197, 21613, 21602
daacafb539 Merge #21426: rpc: remove scantxoutset EXPERIMENTAL warning (MarcoFalke)
b8aec5cb86 Merge #20197: p2p: protect onions in AttemptToEvictConnection(), add eviction protection test coverage (Wladimir J. van der Laan)
dd92322962 Merge #21447: Always add -daemonwait to known command line arguments (Wladimir J. van der Laan)
3325620ce1 Merge #21418: contrib: Make systemd invoke dependencies only when ready (Wladimir J. van der Laan)
99f09a0be6 Merge #20040: wallet: Refactor OutputGroups to handle fees and spending eligibility on grouping (Samuel Dobson)
6ca0eb189e Merge #21007: bitcoind: Add -daemonwait option to wait for initialization (Wladimir J. van der Laan)
666e6e2015 Merge #20406: util: Avoid invalid integer negation in FormatMoney and ValueFromAmount (Wladimir J. van der Laan)
1a07e04a0e Merge #21370: Use C++11 member initializer in CNodeState (fanquake)
6423f6bc5d Merge #21395: Net processing: Remove unused CNode.address member (MarcoFalke)

Pull request description:

  bitcoin backports

Top commit has no ACKs.

Tree-SHA512: dc9490c6c99cc08e8c8ffbd6b71f48e8df8b51dd2d7ca940de44ff47ab28ec3e2d45b7e381a7124d513f7e29ad13300c9df68acd7ddec3022a603eca162b12f3
2024-04-22 09:45:36 -05:00
MarcoFalke
daacafb539
Merge #21426: rpc: remove scantxoutset EXPERIMENTAL warning
2f0b25a1564e275dc090e4ad6dafcfdf8701494e rpc: remove scantxoutset EXPERIMENTAL warning (Jon Atack)

Pull request description:

  Remove old warning per IRC wallet meeting discussion at http://www.erisian.com.au/bitcoin-core-dev/log-2021-03-12.html#l-467

  This RPC was merged 3 years ago in #12196.

ACKs for top commit:
  MarcoFalke:
    cr ACK 2f0b25a1564e275dc090e4ad6dafcfdf8701494e

Tree-SHA512: 874ccd5bd19ecbbe91912171ac85af7a4658dc92f6db484ff3d03f07f1b9ba97e1c69d33a5c3ae5c5ec46cac3595a211f55fec0fbf81bac30d66a891c376ce26
2024-04-22 09:42:17 -05:00
Wladimir J. van der Laan
b8aec5cb86
Merge #20197: p2p: protect onions in AttemptToEvictConnection(), add eviction protection test coverage
0cca08a8ee33b4e05ff586ae4fd914f5ea860cea Add unit test coverage for our onion peer eviction protection (Jon Atack)
caa21f586f951d626a67f391050c3644f1057f57 Protect onion+localhost peers in ProtectEvictionCandidatesByRatio() (Jon Atack)
8f1a53eb027727a4c0eaac6d82f0a8279549f638 Use EraseLastKElements() throughout SelectNodeToEvict() (Jon Atack)
8b1e156143740a5548dc7b601d40fb141e6aae1c Add m_inbound_onion to AttemptToEvictConnection() (Jon Atack)
72e30e8e03f880eba4bd1c3fc18b5558d8cef680 Add unit tests for ProtectEvictionCandidatesByRatio() (Jon Atack)
ca63b53ecdf377ce777fd959d400748912266748 Use std::unordered_set instead of std::vector in IsEvicted() (Jon Atack)
41f84d5eccd4c2620bf6fee616f2f8f717dbd6f6 Move peer eviction tests to a separate test file (Jon Atack)
f126cbd6de6e1a8fee0e900ecfbc14a88e362541 Extract ProtectEvictionCandidatesByRatio from SelectNodeToEvict (Jon Atack)

Pull request description:

  Now that #19991 and #20210 have been merged, we can determine inbound onion peers using `CNode::m_inbound_onion` and add it to the localhost peers protection in `AttemptToEvictConnection`, which was added in #19670 to address issue #19500.

  Update 28 February 2021: I've updated this to follow gmaxwell's suggestion in https://github.com/bitcoin/bitcoin/pull/20197#issuecomment-713865992.

  This branch now protects up to 1/4 onion peers (connected via our tor control service), if any, sorted by longest uptime. If any (or all) onion slots remain after that operation, they are then allocated to protect localhost peers, or a minimum of 2 localhost peers in the case that no onion slots remain and 2 or more onion peers were protected, sorted as before by longest uptime.

  This patch also adds test coverage for the longest uptime, localhost, and onion peer eviction protection logic to build on the welcome initial unit testing of #20477.

  Suggest reviewing the commits that move code with `colorMoved = dimmed-zebra` and `colorMovedWs = allow-indentation-change`.

  Closes #11537.

ACKs for top commit:
  laanwj:
    Code review ACK 0cca08a8ee33b4e05ff586ae4fd914f5ea860cea
  vasild:
    ACK 0cca08a8ee33b4e05ff586ae4fd914f5ea860cea

Tree-SHA512: 2f5a63f942acaae7882920fc61f0185dcd51da85e5b736df9d1fc72343726dd17da740e02f30fa5dc5eb3b2d8345707aed96031bec143d48a2497a610aa19abd
2024-04-22 09:42:17 -05:00
Wladimir J. van der Laan
dd92322962
Merge #21447: Always add -daemonwait to known command line arguments
4d008f908e18abee9513560e36a92a0e97c65d68 Always add -daemonwait to known command line arguments (Hennadii Stepanov)

Pull request description:

  This is a follow up of #21007.

  When `AC_CHECK_DECLS([fork])` fails:

  - on master (8e6532053f580003869346510fc1dc20c46c8067):
  ```
  $ src/bitcoind -daemonwait
  Error: Error parsing command line arguments: Invalid parameter -daemonwait

  ```

  - with this PR:
  ```
  $ src/bitcoind -daemonwait
  Error: -daemon is not supported on this operating system

  ```

ACKs for top commit:
  laanwj:
    Code review ACK 4d008f908e18abee9513560e36a92a0e97c65d68

Tree-SHA512: 7fcb5e9d76958adcf57e04fa74bd2a98d62459d81a3c57a97bd74c346cbf47c53e560a15455fb024e912c3b44e8487a83499e993b282871ba069953e665d88a9
2024-04-22 09:42:17 -05:00
Wladimir J. van der Laan
3325620ce1
Merge #21418: contrib: Make systemd invoke dependencies only when ready
663f6cd9ddadeec30b27ec12f0f5ed49f3146cc9 contrib: Use -daemonwait in systemd init script (Wladimir J. van der Laan)

Pull request description:

  Make systemd invoke dependencies only when ready by using `-daemonwait` in the service file instead of `-daemon`.

  Closes #21322 by making bitcoind conform to behavior specified for `type=forking`.

  This may need some tuning of timeouts.

ACKs for top commit:
  darosior:
    ACK 663f6cd
  hebasto:
    re-ACK 663f6cd9ddadeec30b27ec12f0f5ed49f3146cc9

Tree-SHA512: 890005852b632a202caa578e6c796ebdc9da0b2379a9157a4f56f7db9d193c0ffbb78d120bbf112ab2f273855f2a08c3da000b1f7a9fb5222a3b94dcdb16b878
2024-04-22 09:42:16 -05:00
Samuel Dobson
99f09a0be6
Merge #20040: wallet: Refactor OutputGroups to handle fees and spending eligibility on grouping
5d4597666d589e39354e0d8dd5b2afbe1a5d7d8e Rewrite OutputGroups to be clearer and to use scriptPubKeys (Andrew Chow)
f6b305273910db0e46798d361413a7e878cb45f7 Explicitly filter out partial groups when we don't want them (Andrew Chow)
416d74fb1687ae1d47a58c153d09d9afe0b6dc60 Move OutputGroup positive only filtering into Insert (Andrew Chow)
d895e98b594b873f3d34c8ba63e9b55125d51b5a Move EligibleForSpending into GroupOutputs (Andrew Chow)
99b399aba5d27476b61b4865cc39553d03965d57 Move fee setting of OutputGroup to Insert (Andrew Chow)
6148a8acda5e594bb9b3b2d989056f9e03ddbdbd Move GroupOutputs into SelectCoinsMinConf (Andrew Chow)
2acad036575ec998f8bbe4f10f6206b1c8ad3d23 Remove OutputGroup non-default constructors (Andrew Chow)

Pull request description:

  Even after #17458, we still deal with setting fees of an `OutputGroup` and filtering the `OutputGroup` outside of the struct. We currently make all of the `OutputGroup`s in `SelectCoins` and then copy and modify them within each `SelectCoinsMinConf` scenario. This PR changes this to constructing the `OutputGroup`s within the `SelectCoinsMinConf` so that the scenario can be taken into account during the group construction. Furthermore, setting of fees and filtering for effective value is moved into `OutputGroup::Insert` itself so that we don't add undesirable outputs to an `OutputGroup` rather than deleting them afterwards.

  To facilitate fee calculation and effective value filtering during `OutputGroup::Insert`, `OutputGroup` now takes the feerates in its constructor and computes the fees and effective value for each output during `Insert`.

  While removing `OutputGroup`s in accordance with the `CoinEligibilityFilter` still requires creating the `OutputGroup`s first, we can do that within the function that makes them - `GroupOutput`s.

ACKs for top commit:
  Xekyo:
    Code review ACK: 5d4597666d
  fjahr:
    Code review ACK 5d4597666d589e39354e0d8dd5b2afbe1a5d7d8e
  meshcollider:
    Light utACK 5d4597666d589e39354e0d8dd5b2afbe1a5d7d8e

Tree-SHA512: 35965b6d49a87f4ebb366ec4f00aafaaf78e9282481ae2c9682b515a3a9f2cbcd3cd6e202fee29489d48fe7f3a7cede4270796f5e72bbaff76da647138fb3059
2024-04-22 09:42:16 -05:00
Wladimir J. van der Laan
6ca0eb189e
Merge #21007: bitcoind: Add -daemonwait option to wait for initialization
e017a913d0d78ef0766cf73586fe7a38488e1a26 bitcoind: Add -daemonwait option to wait for initialization (Wladimir J. van der Laan)
c3e6fdee6d39d3f52dec421b48a0ac8bad5006f7 shutdown: Use RAII TokenPipe in shutdown (Wladimir J. van der Laan)
612f746a8ffa265b6877bedbbe21fcbb392f1516 util: Add RAII TokenPipe (Wladimir J. van der Laan)

Pull request description:

  This adds a `-daemonwait` flag that does the same as `-daemon` except that it, from a user perspective, backgrounds the process only after initialization is complete. This is similar to the behaviour of some other software such as c-lightning.

  This can be useful when the process launching bitcoind wants to guarantee that either the RPC server is running, or that initialization failed, before continuing. The exit code indicates the initialization result.

  The use of the libc function `daemon()` is replaced by a custom implementation which is inspired by the [glibc implementation](https://github.com/lattera/glibc/blob/master/misc/daemon.c#L44), but which also creates a pipe from the child to the parent process for communication.

  An additional advantage of having our own `daemon()` implementation is that no MACOS-specific pragmas are needed anymore to silence a deprecation warning.

  TODO:

  - [x] Factor out `token_read` and `token_write` to an utility, and use  them in `shutdown.cpp` as well—this is exactly the same kind of communication mechanism.

      - [x] RAII-ify pipe endpoints.

  - [x] Improve granularity of the `configure.ac` checks. This currently  still checks for the function `daemon()` which makes no sense as  it's not used. It should check for individual functions such as
    `fork()` and `setsid()` etc—the former being required, the second optional.

  - [-] ~~Signal propagation during initialization: if say, pressing Ctrl-C during `-daemonwait` it would be good to pass this SIGINT on to the child process instead of detaching the parent process and letting the child run free.~~ This is not necessary, see https://github.com/bitcoin/bitcoin/pull/21007#issuecomment-769007341.

  Future:

  - Consider if it makes sense to use this in the RPC tests (there would be no more need for "is RPC ready" polling loops). I think this is out of scope for this PR.

ACKs for top commit:
  jonatack:
    Tested ACK e017a913d0d78ef0766cf73586fe7a38488e1a26 checked change since previous review is move-only

Tree-SHA512: 53369b8ca2247e4cf3af8cb2cfd5b3399e8e0e3296423d64be987004758162a7ddc1287b01a92d7692328edcb2da4cf05d279b1b4ef61a665b71440ab6a6dbe2
2024-04-22 09:42:16 -05:00
Wladimir J. van der Laan
666e6e2015
Merge #20406: util: Avoid invalid integer negation in FormatMoney and ValueFromAmount
1f05dbd06d896849d16b026bfc3315ee8b73a89f util: Avoid invalid integer negation in ValueFromAmount: make ValueFromAmount(const CAmount& n) well-defined also when n is std::numeric_limits<CAmount>::min() (practicalswift)
7cc75c9ba38e516067e5a4ab84311c62ddddced7 util: Avoid invalid integer negation in FormatMoney: make FormatMoney(const CAmount& n) well-defined also when n is std::numeric_limits<CAmount>::min() (practicalswift)

Pull request description:

  Avoid invalid integer negation in `FormatMoney` and `ValueFromAmount`.

  Fixes #20402.

  Before this patch:

  ```
  $ CC=clang CXX=clang++ ./configure --with-sanitizers=undefined
  $ make -C src/ test/test_bitcoin
  $ src/test/test_bitcoin -t rpc_tests/rpc_format_monetary_values -t util_tests/util_FormatMoney
  core_write.cpp:21:29: runtime error: negation of -9223372036854775808 cannot be represented in type 'CAmount'
    (aka 'long'); cast to an unsigned type to negate this value to itself
  SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior core_write.cpp:21:29 in
  test/rpc_tests.cpp(186): error: in "rpc_tests/rpc_format_monetary_values":
    check ValueFromAmount(std::numeric_limits<CAmount>::min()).write() == "-92233720368.54775808" has failed
    [--92233720368.-54775808 != -92233720368.54775808]
  util/moneystr.cpp:16:34: runtime error: negation of -9223372036854775808 cannot be represented in type 'CAmount'
    (aka 'long'); cast to an unsigned type to negate this value to itself
  SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior util/moneystr.cpp:16:34 in
  test/util_tests.cpp(1188): error: in "util_tests/util_FormatMoney":
    check FormatMoney(std::numeric_limits<CAmount>::min()) == "-92233720368.54775808" has failed
    [--92233720368.-54775808 != -92233720368.54775808]
  ```

  After this patch:

  ```
  $ CC=clang CXX=clang++ ./configure --with-sanitizers=undefined
  $ make -C src/ test/test_bitcoin
  $ src/test/test_bitcoin -t rpc_tests/rpc_format_monetary_values -t util_tests/util_FormatMoney
  ```

ACKs for top commit:
  laanwj:
    re-ACK 1f05dbd06d896849d16b026bfc3315ee8b73a89f

Tree-SHA512: 5aaeb8e2178f1597921f53c12bdfc2f3d5993d10c41658dcd25943e54e8cc2116a411bc71d928f890b33bc0b3761a8ee4449b0532bce41125b6c60692808c8c3
2024-04-22 09:42:16 -05:00