Commit Graph

37007 Commits

Author SHA1 Message Date
Andrew Chow
b7edd55c22
Merge bitcoin/bitcoin#26899: p2p: set -dnsseed and -listen false if maxconnections=0
fabb95e7bf doc: add release note for 26899 (brunoerg)
c84c5f6e89 p2p: set `-dnsseed` and `-listen` false if `maxconnections=0` (brunoerg)

Pull request description:

  If `maxconnections=0`, it means our possible connections are going to be manual (e.g via `addnode`). For this reason, we can skip DNS seeds and set `listen` false.

ACKs for top commit:
  achow101:
    ACK fabb95e7bf
  vasild:
    ACK fabb95e7bf
  1440000bytes:
    reACK fabb95e7bf

Tree-SHA512: 33919a784723a32450f39ee4f6de3e27cc7c7f4c6ab4b8ce673981d461df334197deaf43e3f882039fa1ac36b2fddc6c6ab4413512d6c393d4a6865302dd05e7
2023-03-20 12:49:10 -04:00
Andrew Chow
60f142e395
Merge bitcoin/bitcoin#26531: mempool: Add mempool tracepoints
4b7aec2951 Add mempool tracepoints (virtu)

Pull request description:

  This PR adds multiple mempool tracepoints.

  | tracepoint  | description |
  | ------------- | ------------- |
  | `mempool:added`  | Is called when a transaction enters the mempool  |
  | `mempool:removed`  | ... when a transaction is removed from the mempool |
  | `mempool:replaced`  | ... when a transaction is replaced in the mempool |
  | `mempool:rejected`  | ... when a transaction is rejected from entering the mempool |

  The tracepoints are further documented in `docs/tracing.md`. Usage is demonstrated in the example script `contrib/tracing/mempool_monitor.py`. Interface tests are provided in `test/functional/interface_usdt_mempool.py`.

  The rationale for passing the removal reason as a string instead of numerically is that the benefits of not having to maintain a redundant enum-string mapping seem to outweigh the small cost of string generation. The reject reason is passed as string as well, although in this instance the string does not have to be generated but is readily available.

ACKs for top commit:
  0xB10C:
    ACK 4b7aec2951
  achow101:
    ACK 4b7aec2951

Tree-SHA512: 6deb3ba2d1a061292fb9b0f885f7a5c4d11b109b838102d8a8f4828cd68f5cd03fa3fc64adc6fdf54a08a1eaccce261b0aa90c2b8c33cd5fd3828c8f74978958
2023-03-20 12:42:24 -04:00
virtu
4b7aec2951 Add mempool tracepoints
Tracepoints for added, removed, replaced, and rejected transactions.

The removal reason is passed as string instead of a numeric value, since
the benefits of not having to maintain a redundant enum-string mapping
seem to outweigh the small cost of string generation.  The reject reason
is passed as string as well, although here the string does not have to
be generated but is readily available.

So far, tracepoint PRs typically included two demo scripts: a naive
bpftrace script to show raw tracepoint data and a bcc script for a more
refined view. However, as some of the ongoing changes to bpftrace
introduce a certain degree of unreliability (running some of the
existing bpftrace scripts was not possible with standard kernels and
bpftrace packages on latest stable Ubuntu, Debian, and NixOS), this PR
includes only a single bcc script that fuses the functionality of former
bpftrace and bcc scripts.
2023-03-20 15:57:31 +01:00
fanquake
40e1c4d402
Merge bitcoin/bitcoin#25666: refactor: wallet, do not translate init options names
e43a547a36 refactor: wallet, do not translate init arguments names (furszy)

Pull request description:

  Simple, and not interesting, refactor that someone has to do sooner or later. We are translating some init arguments names when those shouldn't be translated.

ACKs for top commit:
  achow101:
    ACK e43a547a36
  MarcoFalke:
    lgtm ACK e43a547a36
  ryanofsky:
    Code review ACK e43a547a36. Just rebased since last review.

Tree-SHA512: c6eca98fd66d54d5510de03ab4e63c00ba2838af4237d2bb135d01c47f8ad8ca9aa7ae1e45cf668afcfb9dd958b075a1756cc887b3beef2cb494933d4d83eab0
2023-03-19 12:24:21 +00:00
fanquake
0973018067
Merge bitcoin/bitcoin#27265: test: check that sigop limit also affects ancestor/descendant size (27171 follow-up)
6d24d1ef2b test: check that sigop limit also affects ancestor/descendant size (Sebastian Falbesoner)

Pull request description:

  This is a follow-up to #27171, adding a check that the sigop-limit vsize logic is also respected for {ancestor,descendant}size calculation (as suggested in https://github.com/bitcoin/bitcoin/pull/27171#pullrequestreview-1331143909). For simplicity, we use a one-parent-one-child cluster here and only check for the case that the sigop-limit equivalent size is larger than the serialized vsize.

ACKs for top commit:
  glozow:
    code review ACK 6d24d1ef2b, thanks for taking!

Tree-SHA512: dc65e455d06cfef1f1d6a53b959f99ec1ca3fe51c98dc1ed5826614b5619773d34aff0171c43a0ede4fd45605b2eb7a9278e027196128bb7ad8586b859f1cf70
2023-03-19 12:11:47 +00:00
fanquake
053b2d3377
Merge bitcoin/bitcoin#27264: p2p: Improve diversification of new connections
72e8ffd7f8 p2p: Account for MANUAL conns when diversifying persistent outbound conns (Gleb Naumenko)
3faae99c3d p2p: Diversify connections only w.r.t *persistent* outbound peers (Gleb Naumenko)

Pull request description:

  Revives #19860.

  In order to make sure that our persistent outbound slots belong to different netgroups, distinct net groups of our peers are added to [`setConnected`](8c4958bd4c/src/net.cpp (L1716)). We’d only open a persistent outbound connection to peers which have a different netgroup compared to those netgroups present in `setConnected`.

  **behaviour on master**

  we open persistent outbound connections to peers which have different netgroups compared to outbound full relay, block relay, addrfetch and feeler connection peers.

  **behaviour on PR**

  netgroup diversity is based on outbound full relay, block relay and manual connection peers.

  **rationale**

  - addrfetch and feeler connections are short lived connections and shouldn’t affect how we select outbound peers from addrman.
  - manual connections are like regular connections when viewed from addrman’s netgroup diversity point of view and should affect how we select outbound peers from addrman

ACKs for top commit:
  amitiuttarwar:
    code review ACK 72e8ffd7f8
  vasild:
    ACK 72e8ffd7f8
  mzumsande:
    Code Review ACK 72e8ffd7f8
  brunoerg:
    crACK 72e8ffd7f8

Tree-SHA512: 359451945a707b312ef6c2696a3a9d4256ab14dab9bd461cca4a52dae034db099012df6de3faef2f3fb38184b05996402ac280b681959483824419b6deb4db1a
2023-03-19 12:08:53 +00:00
fanquake
50171df26c
Merge bitcoin/bitcoin#27212: test: Make the unlikely race in p2p_invalid_messages impossible
fa1eb0ecae test: Make the unlikely race in p2p_invalid_messages impossible (MarcoFalke)

Pull request description:

  After `add_p2p_connection` both sides have the verack processed.
  However the pong from conn in reply to the ping from the node has not
  been processed and recorded in totalbytesrecv.
  Flush the pong from conn by sending a ping from conn.

  This should make the unlikely race impossible.

ACKs for top commit:
  mzumsande:
    ACK fa1eb0ecae
  pinheadmz:
    ACK fa1eb0ecae

Tree-SHA512: 44166587572e8c0c758cac460fcfd5cf403b2883880128b13dc62e7f74ca5cb8f145bb68a903df177ff0e62faa360f913fd409b009d4cd1360f1f4403ade39ae
2023-03-17 14:55:48 +00:00
MarcoFalke
fa1eb0ecae
test: Make the unlikely race in p2p_invalid_messages impossible 2023-03-17 09:25:32 +01:00
Andrew Chow
db03248070
Merge bitcoin/bitcoin#27199: test: fix race condition in encrypted wallet rescan tests
dbeca792a9 test: fix race condition in encrypted wallet rescan tests (ishaanam)

Pull request description:

  This fixes https://github.com/bitcoin/bitcoin/pull/26347#discussion_r1123340738

ACKs for top commit:
  MarcoFalke:
    nice re-ACK dbeca792a9  🚜
  achow101:
    ACK dbeca792a9

Tree-SHA512: 7127254ac0274b5bc8ba0242736e77464acbf1f6e3f6af098b4e47742124c336cd67dffdb385e1e8dbd3a8ae74acd073c99e82fa35c44a615fd7d22b29a0daf7
2023-03-16 17:28:39 -04:00
Andrew Chow
09e86d7a1a
Merge bitcoin/bitcoin#27200: test: psbt: check non-witness UTXO removal for segwit v1 input
3dd2f6461b test: psbt: check non-witness UTXO removal for segwit v1 input (Sebastian Falbesoner)
dd78e3fa43 test: speedup rpc_psbt.py by whitelisting peers (immediate tx relay) (Sebastian Falbesoner)
e194e3e93d test: PSBT: eliminate magic numbers for global unsigned tx key (0) (Sebastian Falbesoner)

Pull request description:

  This PR adds missing test coverage for dropping non-witness UTXOs from PSBTs for segwit v1+ inputs (see commit 103c6fd279). The formerly [disabled](4600479058) method `test_utxo_conversion` is re-enabled and adapted to spend a Taproot (`bech32m`) instead of a wrapped SegWit (`p2sh-segwit`) output. Note that in contrast to the original test, we have to add the non-witness UTXO manually here using the test framework's PSBT module, since the constructing node knows that the output is segwit v1 and hence doesn't add the non-witness UTXO in the first place (see also [BIP371]( https://github.com/bitcoin/bips/blob/master/bip-0371.mediawiki#user-content-UTXO_Types)).

  I strongly assume that most wallets would behave the same as Bitcoin Core here and wouldn't create PSBTs with non-witness UTXOs for Taproot inputs, but it's still good to test everything works as expected if it's still done and that the non-witness UTXO is simply dropped in that case.

  The first two commits contain a small refactor (magic number elimination in PSBT module) and test speedup of ~2-3x (using whitelisting peers / immediate tx relay).

ACKs for top commit:
  achow101:
    ACK 3dd2f6461b
  instagibbs:
    ACK 3dd2f6461b

Tree-SHA512: b8d7f7ea5d7d21def024b70dfca61991cc96a4193be8857018b4d7cf3ca1465d185619fd4a77623803d9da309aa489c53273e9b7683d970ce12e2399b5b50031
2023-03-16 14:48:10 -04:00
fanquake
e695d8536e
Merge bitcoin/bitcoin#26177: refactor / kernel: Move non-gArgs chainparams functionality to kernel
b3e78dc91d refactor: Don't use global chainparams in chainstatemanager method (TheCharlatan)
382b692a50 Split non/kernel chainparams (Carl Dong)
edabbc78a3 Add factory functions for Main/Test/Sig/Reg chainparams (Carl Dong)
d938098398 Remove UpdateVersionBitsParameters (Carl Dong)
84b85786f0 Decouple RegTestChainParams from ArgsManager (Carl Dong)
76cd4e7c96 Decouple SigNetChainParams from ArgsManager (Carl Dong)

Pull request description:

  This pull request is part of the `libbitcoinkernel` project https://github.com/bitcoin/bitcoin/issues/24303 https://github.com/bitcoin/bitcoin/projects/18 and more specifically its "Step 2: Decouple most non-consensus code from libbitcoinkernel". dongcarl is the original author of this patchset, these commits were taken from https://github.com/dongcarl/bitcoin/tree/2022-03-libbitcoinkernel-chainparams-args-only.

  #### Context

  The bitcoin kernel library currently relies on code containing user configurations through the `ArgsManager`. This is not optimal, since as a stand-alone library it should not rely on bitcoind's argument parsing logic. Instead, its interfaces should accept control and options structs that control the kernel library's desired configuration.

  Similar work towards decoupling the `ArgsManager` from the kernel has been done in
  https://github.com/bitcoin/bitcoin/pull/25290, https://github.com/bitcoin/bitcoin/pull/25487, https://github.com/bitcoin/bitcoin/pull/25527 and https://github.com/bitcoin/bitcoin/pull/25862.

  #### Changes

  By moving the `CChainParams` class definition into the kernel and giving it new factory functions `CChainParams::{RegTest,SigNet,Main,TestNet}`it can be constructed without an `ArgsManager` reference, unlike the current factory function `CreateChainParams`.

  The first few commits remove uses of `ArgsManager` within `CChainParams`. Then the `CChainParams` definition is moved to a new file in the `kernel/` subdirectory.

ACKs for top commit:
  MarcoFalke:
    re-ACK b3e78dc91d 🛁
  ryanofsky:
    Code review ACK b3e78dc91d. Only changes since last review were recent review suggestions.
  ajtowns:
    ACK b3e78dc91d

Tree-SHA512: 3835aca1d3e3c75cc3303dd584bab3a77e58f6c678724a5e359fe4b0e17e0763a00931ee6191f516b9fde50496f59cc691f0709c0254206db3863bbf7ab2cacd
2023-03-16 13:56:35 +00:00
Andrew Chow
ebb15ea75a
Merge bitcoin/bitcoin#26207: rest: add verbose and mempool_sequence query params for mempool/contents
1ff5d61dfd doc: add mempool/contents rest verbose and mempool_sequence args (Andrew Toth)
52a31dccc9 tests: mempool/contents verbose and mempool_sequence query params tests (Andrew Toth)
a518fff0f2 rest: add verbose and mempool_sequence query params for mempool/contents (Andrew Toth)

Pull request description:

  The verbose mempool json response can get very large. This adds an option to return the non-verbose response of just the txids. It is identical to the rpc response so the diff here is minimal. This also adds the mempool_sequence parameter for rpc consistency. Verbose defaults to true to remain backwards compatible.

  It uses query parameters to be compatible with the efforts in https://github.com/bitcoin/bitcoin/issues/25752.

ACKs for top commit:
  achow101:
    ACK 1ff5d61dfd
  stickies-v:
    re-ACK [1ff5d61](1ff5d61dfd)
  pablomartin4btc:
    tested ACK 1ff5d61dfd.

Tree-SHA512: 1bf08a7ffde2e7db14dc746e421feedf17d84c4b3f1141e79e36feb6014811dfde80e1d8dbc476c15ff705de2d3c967b3081dcd80536d76b7edf888f1a92e9d1
2023-03-15 19:39:30 -04:00
Andrew Chow
609c95d4a8
Merge bitcoin/bitcoin#27227: wallet: 25806 follow-up
475c20aa56 wallet: remove coin control arg from AutomaticCoinSelection (furszy)
8a5583131c wallet: remove unused methods (furszy)
8471967d7b wallet: GroupOutput, remove unneeded "spendable" check (furszy)
a9aa04183c wallet: OutputGroup, remove unused effective_feerate member (furszy)
99034b2b72 wallet: APS, don't create empty groups (furszy)
805f399b17 wallet: do not make two COutputs, use shared_ptr (furszy)

Pull request description:

  Few small findings post-#25806 and extra cleanups, nothing biggie.

ACKs for top commit:
  S3RK:
    Code review ACK 475c20aa56
  Xekyo:
    utACK 475c20aa56
  achow101:
    ACK 475c20aa56

Tree-SHA512: df45efebd6e2e4ecac619d6ecef794979c328a2d6ef532e25124d0dc1c72b55ccf13498f61fb65958b907bfba6a72ed569bf34eb5fbe35419632fe0406e78798
2023-03-15 19:07:19 -04:00
Andrew Chow
cbfbf46e57
Merge bitcoin/bitcoin#25781: Remove almost all blockstorage globals
fadf8b8182 refactor: Add and use PRUNE_TARGET_MANUAL constexpr (MarcoFalke)
fa9bd7be47 Move ::fImporting to BlockManager (MarcoFalke)
fa442b1377 Pass fImporting to ImportingNow helper class (MarcoFalke)
fa177d7b6b Move ::fPruneMode into BlockManager (MarcoFalke)
fa721f1cab Move ::nPruneTarget into BlockManager (MarcoFalke)

Pull request description:

  It seems preferable to assign globals to a class (in this case `BlockManager`), than to leave them dangling. This should clarify scope for code-readers, as well as clarifying unit test behaviour.

ACKs for top commit:
  TheCharlatan:
    Code review ACK fadf8b8182
  achow101:
    ACK fadf8b8182
  dergoegge:
    Code review ACK fadf8b8182

Tree-SHA512: d261b69257560c9f460bbe85944ca478d0390b498a5af514bafcb4f6444841e5ea58c2e8982f38c48685d6f649039234aec853a934e24ebf23e20d975991a5dc
2023-03-15 18:52:35 -04:00
ishaanam
dbeca792a9 test: fix race condition in encrypted wallet rescan tests 2023-03-15 17:27:57 -04:00
Sebastian Falbesoner
6d24d1ef2b test: check that sigop limit also affects ancestor/descendant size 2023-03-15 19:39:25 +01:00
TheCharlatan
b3e78dc91d
refactor: Don't use global chainparams in chainstatemanager method
The chainstatemanager m_options.chainparams member variable gets its
value from the global chainparams in init.cpp. This allows
validation.cpp to only include the the kernel chainparams file.
2023-03-15 16:43:33 +01:00
Carl Dong
382b692a50
Split non/kernel chainparams
Moves chainparams code not using the ArgsManager to the kernel.

Subsequently use the kernel chainparams header now where possible in
order to further decouple chainparams call sites from gArgs.
2023-03-15 16:43:31 +01:00
Carl Dong
edabbc78a3
Add factory functions for Main/Test/Sig/Reg chainparams
This normalizes the behavior of initializing Main/Test/Sig/Reg
chainparams with RegTest/SigNet chainparams. These factory functions can
also easily be used from a context without an instantiated ArgsManager,
e.g. from libbitcoin kernel code, unlike the existing CreateChainParams
method.
2023-03-15 16:43:29 +01:00
Carl Dong
d938098398
Remove UpdateVersionBitsParameters
Moves setting struct member fields from a function to its call site.
This improves readability by surfacing the code.
2023-03-15 16:43:27 +01:00
Carl Dong
84b85786f0
Decouple RegTestChainParams from ArgsManager
RegTest chain params can now be initialized by configuring a
RegTestOptions struct, or with ArgsManager. This offers an interface for
creating RegTestChainParams without a gArgs object.
2023-03-15 16:42:42 +01:00
Carl Dong
76cd4e7c96
Decouple SigNetChainParams from ArgsManager
SigNet chain params can now be initialized by configuring a
SigNetOptions struct, or with ArgsManager. This offers an interface for
creating SigNetChainParams without a gArgs object.
2023-03-15 16:10:09 +01:00
MarcoFalke
fadf8b8182
refactor: Add and use PRUNE_TARGET_MANUAL constexpr 2023-03-15 16:02:47 +01:00
MarcoFalke
fa9bd7be47
Move ::fImporting to BlockManager 2023-03-15 15:48:44 +01:00
MarcoFalke
fa442b1377
Pass fImporting to ImportingNow helper class 2023-03-15 15:47:48 +01:00
MarcoFalke
fa177d7b6b
Move ::fPruneMode into BlockManager 2023-03-15 15:47:42 +01:00
Gleb Naumenko
72e8ffd7f8 p2p: Account for MANUAL conns when diversifying persistent outbound conns
Previously, we would make connections to peer from the netgroups to which
our MANUAL outbound connections belong.
However, they should be seen as regular connections from Addrman when it comes to netgroup diversity check, since the same rationale can be applied.

Note, this has nothing to do with how we connect to MANUAL connections:
we connect to them unconditionally.
2023-03-15 20:12:05 +05:30
Gleb Naumenko
3faae99c3d p2p: Diversify connections only w.r.t *persistent* outbound peers
ADDR_FETCH and FEELER are short-lived connections,
and they should not affect our choice of peers.

Also, improve comments.
2023-03-15 20:12:03 +05:30
MarcoFalke
fa721f1cab
Move ::nPruneTarget into BlockManager 2023-03-15 15:33:12 +01:00
fanquake
8c4958bd4c
Merge bitcoin/bitcoin#27153: guix: pass --enable-initfini-array to release GCC
127c637cf0 guix: pass --enable-initfini-array to release GCC (fanquake)

Pull request description:

  This returns us to pre-Guix behaviour, where the compilers we were using to build releases, were configured with this option.

  > [--enable-initfini-array](https://gcc.gnu.org/install/configure.html)
  > Force the use of sections .init_array and .fini_array (instead of .init and .fini) for constructors and destructors. Option --disable-initfini-array has the opposite effect. If neither option is specified, the configure script will try to guess whether the .init_array and .fini_array sections are supported and, if they are, use them.

ACKs for top commit:
  TheCharlatan:
    ACK 127c637cf0
  vincenzopalazzo:
    utACK 127c637cf0

Tree-SHA512: fa61227054d52d4dfb4524af3888203a501f680661bdef00bb0970d4e8f7c96cf7f592686c4795be5a0debca267b8e564a4960859297c31f6b261c0729238382
2023-03-15 08:41:21 +01:00
Hennadii Stepanov
460e394625
Merge bitcoin-core/gui#708: Mask values on Transactions View
4492de1be1 qt: mask values on transactions view (pablomartin4btc)

Pull request description:

  Currently the mask values option (Settings menu->Mask values) hides the wallet balances shown on the Overview page including the recent transactions list from the right panel but it doesn't hide the amounts from the transaction view.

  ![mask values - hiding wallet balances on overview tab but not on transactions tab](https://user-images.githubusercontent.com/110166421/216876325-56a68006-1be0-4b3f-b1e2-a0575c377cf5.gif)

  This enhancement has been mentioned on PR #701 as a [desirable follow-up](https://github.com/bitcoin-core/gui/pull/701#issuecomment-1401350037).

  First approach was to hide the amounts on the  transactions view when mask values option is checked:

  ![mask values - hiding amounts on transactions tab](https://user-images.githubusercontent.com/110166421/216876440-0ff1a2ec-2ef2-405c-8b62-e4a94b9221cc.gif)

  But later on as reviewer **furszy** recommended, I've disabled the Transaction tab directly and switch to the Overview tab if the mask values option is set, check the new screenshots in the [comment below](https://github.com/bitcoin-core/gui/pull/708#issuecomment-1449025828).

ACKs for top commit:
  achow101:
    ACK 4492de1be1
  furszy:
    ACK 4492de1
  hernanmarino:
    ACK 4492de1be1

Tree-SHA512: 94c04064cde456ab916cb91fc4619353cf4c8ef0e92aa1522a6b2c18a8d0fa641db9fddac04c2e1a290128879db598a9dfc4a0003dcf6e3413543908ada95afb
2023-03-14 10:03:31 +00:00
fanquake
b175bdb9b2
Merge bitcoin/bitcoin#27238: refactor: Split logging utilities from system.h
aaced5633b refactor: Move error() from util/system.h to logging.h (Ben Woosley)
e7333b420e refactor: Extract util/exception from util/system (Ben Woosley)

Pull request description:

  This pull request is part of the `libbitcoinkernel` project https://github.com/bitcoin/bitcoin/issues/24303 https://github.com/bitcoin/bitcoin/projects/18 and more specifically its "Step 2: Decouple most non-consensus code from libbitcoinkernel". These commits were originally authored by empact and are taken from their parent PR #25152.

  #### Context

  There is an ongoing effort to decouple the `ArgsManager` used for command line parsing user-provided arguments from the libbitcoinkernel library (https://github.com/bitcoin/bitcoin/pull/25290, https://github.com/bitcoin/bitcoin/pull/25487, https://github.com/bitcoin/bitcoin/pull/25527, https://github.com/bitcoin/bitcoin/pull/25862, https://github.com/bitcoin/bitcoin/pull/26177, and https://github.com/bitcoin/bitcoin/pull/27125). The `ArgsManager` is defined in `system.h`.

  #### Changes

  Next to providing better code organization, this PR removes some reliance of the tree of libbitcoinkernel header includes on `system.h` (and thus the `ArgsManager` definition) by moving some logging functions out of the `system.*` files.

  Further commits splitting more functionality out of `system.h` are still in #25152 and will be submitted in separate PRs once this PR has been processed.

ACKs for top commit:
  MarcoFalke:
    re-ACK aaced5633b 🐍

Tree-SHA512: cb39f4cb7a77e7dc1887b1cbf340d53decab8880fc00878a2f12dc627fe67245b4aafd4cc31a9eab0fad1e5bb5d0eb4cdb8d501323ca200fa6ab7b201ae34aea
2023-03-14 09:56:40 +01:00
glozow
f50fb178c3
Merge bitcoin/bitcoin#27235: Avoid integer overflow in CheckDiskSpace
05eeba2c5f [test] Add manual prune startup test case (dergoegge)
4517419628 [util] Avoid integer overflow in CheckDiskSpace (dergoegge)

Pull request description:

  Starting a fresh node with `-prune=1` causes an integer overflow to happen in `CheckDiskSpace` ([here](f7bdcfc83f/src/init.cpp (L1633-L1648))) because `nPruneTarget` is to the max `uint64_t` value.
  ```
   node1 stderr util/system.cpp:138:51: runtime error: unsigned integer overflow: 52428800 + 18446744073709551615 cannot be represented in type 'unsigned long'
      #0 0x564a482b5088 in CheckDiskSpace(fs::path const&, unsigned long) src/./src/util/system.cpp:138:51
      #1 0x564a4728dc59 in AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*) src/./src/init.cpp:1639:14
      #2 0x564a47256e6a in AppInit(node::NodeContext&, int, char**) src/./src/bitcoind.cpp:221:43
      #3 0x564a47256087 in main src/./src/bitcoind.cpp:265:13
      #4 0x7fcb7cbffd8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d)
      #5 0x7fcb7cbffe3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d)
      #6 0x564a471957f4 in _start (/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/bitcoind+0xca07f4) (BuildId: 035cb22302d37317a630900a15a26ecb326d395c)
  SUMMARY: UndefinedBehaviorSanitizer: unsigned-integer-overflow util/system.cpp:138:51 in
  ```

  I think side stepping the overflow for this specific case, is better than adding an exception to the UB suppresions file.

ACKs for top commit:
  MarcoFalke:
    ACK 05eeba2c5f 🥝
  john-moffett:
    ACK 05eeba2c5f

Tree-SHA512: 1d8e6bcb49818139f04b5ab2cbef7f9b422bf0c38a804cd532b6bd0ba4c4fd07f959ba977e59896343f213086c8ecc48180f50d006638dc84649c66ec379d58a
2023-03-13 17:01:48 +00:00
glozow
73a9892bce
Merge bitcoin/bitcoin#26514: Improve address decoding errors
962a0930e6 Improve address decoding errors (Aurèle Oulès)

Pull request description:

  Attempt to fix #21741.

ACKs for top commit:
  MarcoFalke:
    lgtm ACK 962a0930e6
  davidgumberg:
    ACK 962a0930e6
  1440000bytes:
    utACK 962a0930e6

Tree-SHA512: 6f216eeaeccf6bfdf0730d38835fdf26c935a5e1fc35006660393a9ad76bf38c85340f0f20e92f87840463d83d891d9714cfad313aab301a16bb8efa4490df06
2023-03-13 16:57:31 +00:00
Ben Woosley
aaced5633b
refactor: Move error() from util/system.h to logging.h
error is a low-level function with a sole dependency on LogPrintf, which
is defined in logging.h

The background of this commit is an ongoing effort to decouple the
libbitcoinkernel library from the ArgsManager defined in system.h.
Moving the function out of system.h allows including it from a separate
source file without including the ArgsManager definitions from system.h.
2023-03-13 17:09:54 +01:00
Ben Woosley
e7333b420e
refactor: Extract util/exception from util/system
This is a minimal extraction of a single function, but also the only use
of std::exception in util/system.

The background of this commit is an ongoing effort to decouple the
libbitcoinkernel library from the ArgsManager defined in system.h.
Moving the function out of system.h allows including it from a separate
source file without including the ArgsManager definitions from system.h.
2023-03-13 17:09:47 +01:00
fanquake
f088949fcf
Merge bitcoin/bitcoin#27221: test: Default timeout factor to 4 under --valgrind
fa27cf4cc7 test: Default timeout factor to 4 under --valgrind (MarcoFalke)

Pull request description:

  valgrind will incur a slowdown of at least 2, so increase the default timeout factor.

  This should reduce the number of reported issues. See also https://github.com/bitcoin/bitcoin/issues/27112#issuecomment-1455762739

ACKs for top commit:
  fanquake:
    ACK fa27cf4cc7 - I still see at least one actual issue when running the functional tests under `--valgrind` (outside the CI system), but will follow up separately with that. Increasing the timeout here seems fine.

Tree-SHA512: 4467559a3bfd98f5735f300f6ed54c68f951191d65a2b1294d71d72cc5d0864964de562d5dfa0a4855fc541ccb269a538b7aeb3d408d2d012a5369513397c395
2023-03-13 16:15:04 +01:00
dergoegge
05eeba2c5f [test] Add manual prune startup test case 2023-03-13 13:10:11 +01:00
fanquake
1884b71b1d
Merge bitcoin/bitcoin#27230: Update src/secp256k1 subtree to upstream release v0.3.0
763079a3f1 Squashed 'src/secp256k1/' changes from 21ffe4b22a9..bdf39000b9c (Pieter Wuille)

Pull request description:

  This updates the libsecp256k1 subtree to [v0.3.0](https://github.com/bitcoin-core/secp256k1/releases/tag/v0.3.0). I don't believe there are code changes that are particularly important to Bitcoin Core, apart from the added CMake build system support.

ACKs for top commit:
  jonasnick:
    ACK e5c7fcb361
  fanquake:
    ACK e5c7fcb361

Tree-SHA512: eda42e44d6d4ae43e9fab8a15854e41c8d9e14b645945039dbc35402bec501d73caa5d293264bd03ec6a7fe4919b9a725560f1831a58a6364dc6edaf259145a0
2023-03-12 16:35:57 +01:00
fanquake
40d0b0a524
Merge bitcoin/bitcoin#27239: refactor: Consistently use context args over gArgs in node/interfaces
fa3e9b420f refactor: Consistently use args over gArgs in init.cpp (MarcoFalke)
fa891120c8 refactor: Consistently use context args over gArgs in node/interfaces (MarcoFalke)

Pull request description:

  Currently `node/interfaces.cpp` uses a mix of `gArgs` vs `m_context->args`. This is fine, because outside of tests those should be identical. However, it makes the code inconsistent and harder to use in tests.

  Fix that by using `args` from the context consistently. Do the same in `init.cpp`, where `gArgs` and `args` are inconsistently used in the same scope or even line.

ACKs for top commit:
  ryanofsky:
    Code review ACK fa3e9b420f

Tree-SHA512: bcd52f176794ebb1ecb9e1922411f7b84d212ae13bad314a1961b85f3077f645fca71fb0124c0889ebfdd8b59a0903b99b9985b1a4fb8f152aa6d7f0126fe5c7
2023-03-11 11:20:01 +01:00
fanquake
87af64a1a1
Merge bitcoin/bitcoin#27236: util: fix argsman dupe key error
8fcbdadfad util: fix argsman dupe key error (willcl-ark)

Pull request description:

  fixes #22638

  Make GUI "Settings file could not be read. Do you want to reset settings to default values?" dialog actually clear all settings instead of partially keeping them when `settings.json` contains duplicate keys. This change has no effect on `bitcoind` because it treats a corrupt `settings.json` file as a hard error and doesn't attempt to modify it.

  If we find a duplicate key and error, clear `values` before returning so that `WriteSettings()` will write an empty file, therefore clearing it.

  This aligns with GUI behaviour added in 1ee6d0b.

  The test added only checks that `values` is empty after a duplicate key is detected. This paves the way for the `abort` option in the GUI to properly clear `settings.json`, if the user selects the option, but the test does not currently check this entire mechanism (e.g. the file contents).

ACKs for top commit:
  TheCharlatan:
    Code review ACK 8fcbdadfad
  ryanofsky:
    Code review ACK 8fcbdadfad. Thanks for the fix! I would maybe update the PR description or add to it to describe behavior change of this PR:

Tree-SHA512: a5fd49b30ede0a24188623192825bccb952e427cc35f96ff9bfdc737361dcc35ac6480589ddf7f0ddeaebd34361bdaee31e7a91f2c0d857e4ff682614bb6bc04
2023-03-11 11:09:47 +01:00
fanquake
3d53a85ddf
Merge bitcoin/bitcoin#27220: doc: update broken str util reference links on developer-notes
da347de530 doc: update broken links (pablomartin4btc)

Pull request description:

  References to `utilstrencodings` and `lint-locale-dependence.sh` where incorrect, updating them accordingly.

  Also, adding another reference to util function [`LocaleIndependentAtoi`](https://github.com/bitcoin/bitcoin/blob/master/src/util/strencodings.h#L108-L118), which is related with the updated section of the guide:

  ```
  // LocaleIndependentAtoi is provided for backwards compatibility reasons.
  //
  // New code should use ToIntegral or the ParseInt* functions
  // which provide parse error feedback.
  //
  // The goal of LocaleIndependentAtoi is to replicate the defined behaviour of
  // std::atoi as it behaves under the "C" locale, and remove some undefined
  // behavior. If the parsed value is bigger than the integer type's maximum
  // value, or smaller than the integer type's minimum value, std::atoi has
  // undefined behavior, while this function returns the maximum or minimum
  // values, respectively.
  ```

ACKs for top commit:
  MarcoFalke:
    lgtm ACK da347de530

Tree-SHA512: c8f4cd9cff1fb3ea367ac9dbe5aa45dc187fc60114f2e2106e02e0e17fea4ee34d6e0c408fe920c2d8765e06b4dc30c231f0454fa35469c4399e0cadbcd341ba
2023-03-11 11:02:03 +01:00
pablomartin4btc
4492de1be1 qt: mask values on transactions view 2023-03-10 14:52:01 -03:00
brunoerg
fabb95e7bf doc: add release note for 26899 2023-03-10 13:42:32 -03:00
brunoerg
c84c5f6e89 p2p: set -dnsseed and -listen false if maxconnections=0
If `maxconnections=0`, it means our possible connections are
going to be manual (e.g via `addnode`). For this reason, we
can skip DNS seeds and set `listen` false.
2023-03-10 13:42:32 -03:00
fanquake
c7f1d95f52
Merge bitcoin/bitcoin#27205: doc: Show how less noisy clang-tidy output can be achieved
54c4d03578 doc: Show how less noisy clang-tidy output can be achieved (TheCharlatan)

Pull request description:

  Adds a paragraph to the clang-tidy section explaining how to de-noise its output. By default clang-tidy will print errors arrising from included headers in leveldb and other dependencies. By passing `--enable-suppress-external-warnings` flag to configure, errors arising from external dependencies are suppressed. Additional errors arrising from internal dependencies such as leveldb are suppressed by passing the `src/.bear-tidy-config` configuration file to bear. This file includes exclusionary rules for leveldb.

ACKs for top commit:
  MarcoFalke:
    utACK 54c4d03578

Tree-SHA512: c3dd8fb0600157582a38365a587e02e1d249fb246d6b8b4949a800fd05d3473dee49e2a4a556c60e51d6508feff810024e55fe09f5a0875f560fde30f3b6817c
2023-03-10 17:38:56 +01:00
MarcoFalke
fa3e9b420f
refactor: Consistently use args over gArgs in init.cpp 2023-03-10 17:29:51 +01:00
MarcoFalke
fa891120c8
refactor: Consistently use context args over gArgs in node/interfaces 2023-03-10 17:29:04 +01:00
TheCharlatan
54c4d03578
doc: Show how less noisy clang-tidy output can be achieved 2023-03-10 16:47:41 +01:00
dergoegge
4517419628 [util] Avoid integer overflow in CheckDiskSpace 2023-03-10 15:50:26 +01:00