Commit graph

36457 commits

Author SHA1 Message Date
MarcoFalke
d4c180ecc9
Merge bitcoin/bitcoin#26960: refactor: Remove c_str from util/check
fab958290b refactor: Remove c_str from util/check (MarcoFalke)

Pull request description:

  Seems confusing and fragile to require calling code to call `c_str()` when passing a read-only view of a std::string.

  Fix that by using std::string_view, which can be constructed from string literals and std::string.

  Also, remove the now unused `c_str()` from `src/wallet/bdb.cpp`.

ACKs for top commit:
  stickies-v:
    ACK fab958290b
  aureleoules:
    ACK fab958290b
  theStack:
    ACK fab958290b

Tree-SHA512: ae39812c6bb8e2ef095e1b843774af2718f48404cb848c3e43b16d3c22240557d69d54a13a038a4a9c48b3ba0e4523e1f87abdd60f91486092f50fd43c0e8483
2023-01-26 09:02:36 +01:00
fanquake
ab98673f05
Merge bitcoin/bitcoin#26929: rpc: Throw more user friendly arg type check error (1.5/2)
fafeddfe0e rpc: Throw more user friendly arg type check error (MarcoFalke)

Pull request description:

  The arg type check error doesn't list which arg (position or name) failed. Fix that.

ACKs for top commit:
  stickies-v:
    ACK fafeddfe0e - although I think the functional test isn't in a logical place (but not blocking)

Tree-SHA512: 17425aa145aab5045940ec74fff28f0e3b2b17ae55f91c4bb5cbcdff0ef13732f8e31621d85964dc2c04333ea37dbe528296ac61be27541384b44e37957555c8
2023-01-25 15:25:49 +00:00
MarcoFalke
0486148f75
Merge bitcoin/bitcoin#26829: init: Remove unnecessary sensitive flag from rpcbind
b9d5674541 init: Remove sensitive flag from rpcbind (Andrew Chow)

Pull request description:

  `-rpcbind` is currently flagged as a sensitive option which means that its value will be masked when the command line args are written to the debug.log file. However this is not useful as if `rpcbind` is actually activated, the bound IP addresses will be written to the log anyways. The test `feature_config_args.py` did not catch this contradiction as the test node was not started with `rpcallowip` and so `rpcbind` was not acted upon.

  This also brings `rpcbind` inline with `bind` as that is not flagged as sensitive either.

ACKs for top commit:
  Sjors:
    re-utACK b9d5674541
  willcl-ark:
    ACK b9d5674
  theStack:
    ACK b9d5674541

Tree-SHA512: 50ab5ad2e18ae70649deb1ac429d404b5f5c41f32a4943b2041480580152df22e72d4aae493379d0b23fcb649ab342376a82119760fbf6dfdcda659ffd3e244a
2023-01-25 15:32:41 +01:00
MarcoFalke
f703c79ad7
Merge bitcoin/bitcoin#26961: ci: Fix APPEND_APT_SOURCES_LIST trying to modify the host system
fa88d42123 ci: Fix APPEND_APT_SOURCES_LIST trying to modify the host system (MarcoFalke)

Pull request description:

  `>>` will be redirected to the host system, unless the CI system is already running in docker.

  This shouldn't lead to any issues, unless someone is running the CI as root, I guess.

  Still, fix it to avoid problems.

ACKs for top commit:
  fanquake:
    ACK fa88d42123

Tree-SHA512: 6c501fd69a62e3cea27d24647e1a02f0f63dad45737dbfed23e3f70d89aacfbe477c71ca8812a47ab4641a31288df5919512542d5d8b49fc57dc3ef2aa0cde33
2023-01-25 15:05:20 +01:00
MarcoFalke
fa88d42123
ci: Fix APPEND_APT_SOURCES_LIST trying to modify the host system 2023-01-24 20:33:55 +01:00
Andrew Chow
50ac8f5774
Merge bitcoin/bitcoin#25987: build: compile depends sqlite with more recommended options
dee690257c build: pass --enable-debug to sqlite when DEBUG=1 (fanquake)
807b61fcca build: use more recommended sqlite3 compile options (fanquake)

Pull request description:

  https://www.sqlite.org/compile.html

  [SQLITE_DQS](https://www.sqlite.org/compile.html#dqs)
  > This setting disables the double-quoted string literal misfeature.

  [SQLITE_DEFAULT_MEMSTATUS](https://www.sqlite.org/compile.html#default_memstatus)
  > This setting causes the sqlite3_status() interfaces that track
  > memory usage to be disabled.
  > This helps the sqlite3_malloc() routines run much faster, and since
  > SQLite uses sqlite3_malloc() internally, this helps to make the
  > entire library faster.

  [SQLITE_OMIT_DEPRECATED](https://www.sqlite.org/compile.html#omit_deprecated)
  > Omitting deprecated interfaces and features will not help SQLite
  > to run any faster.
  > It will reduce the library footprint, however. And it is the
  > right thing to do.

  [SQLITE_OMIT_SHARED_CACHE](https://www.sqlite.org/compile.html#omit_shared_cache)
  > Omitting the possibility of using shared cache allows many
  > conditionals in performance-critical sections of the code to be
  > eliminated. This can give a noticeable improvement in performance.

  Also: https://www.sqlite.org/sharedcache.html
  > Shared-cache mode is an obsolete feature.
  > The use of shared-cache mode is discouraged.
  > Most use cases for shared-cache are better served by WAL mode.
  > Applications that build their own copy of SQLite from source code
  > are encouraged to use the -DSQLITE_OMIT_SHARED_CACHE compile-time
  > option, as the resulting binary will be both smaller and faster.

  [SQLITE_OMIT_JSON](https://www.sqlite.org/compile.html#omit_json)
  > Starting with sqlite 3.38.0 the JSON extension became opt-out rather
  than opt-in, so we disable it here.

  --disable-rtree
  > An R-Tree is a special index that is designed for doing range queries.
  > R-Trees are most commonly used in geospatial systems...
  https://www.sqlite.org/rtree.html

  --disable-fts4 --disable-fts5
  > FTS5 is an SQLite virtual table module that provides full-text
  > search functionality to database applications.

  DSQLITE_LIKE_DOESNT_MATCH_BLOBS
  > simplifies the implementation of the LIKE optimization and allows
  > queries that use the LIKE optimization to run faster.

  DSQLITE_OMIT_DECLTYPE
  > By omitting the (seldom-needed) ability to return the declared type of
  > columns from the result set of query, prepared statements can be made
  > to consume less memory.

  DSQLITE_OMIT_PROGRESS_CALLBACK
  > By omitting this interface, a single conditional is removed from the
  > inner loop of the bytecode engine, helping SQL statements to run slightly
  > faster.

  DSQLITE_OMIT_AUTOINIT
  > with the SQLITE_OMIT_AUTOINIT option, the automatic initialization is omitted.
  > This helps many API calls to run a little faster
  > it also means that the application must call sqlite3_initialize()
  manually.

  On my Linux box this results in a `libsqlite3.a` that shrinks from ~1.7mb to ~1.3mb.
  On macOS, `libsqlite3.a` shrinks from ~2.2mb to ~1.3mb.

  Guix Build:
  ```bash
  04626ec7b64086103bfb5537397d7953d0699b31da1b1bc100003c7d30991fdf  guix-build-dee690257c79/output/aarch64-linux-gnu/SHA256SUMS.part
  a77c72052266788e890a0d3d89cc6eee9dd72db6a1b6fdc8aab882b35a315284  guix-build-dee690257c79/output/aarch64-linux-gnu/bitcoin-dee690257c79-aarch64-linux-gnu-debug.tar.gz
  86d782f185ee0fae8e8733ab8a511de2ca2500f02eb3d4aaa20d65b4434dcd77  guix-build-dee690257c79/output/aarch64-linux-gnu/bitcoin-dee690257c79-aarch64-linux-gnu.tar.gz
  d81874ecd378470b01a429f2a4be07fcb4824b56ace146226b77088cc3c41baa  guix-build-dee690257c79/output/arm-linux-gnueabihf/SHA256SUMS.part
  8f24076800e5a19ac9005af8c6e4987b32e0a857a83af84931958505228ef58d  guix-build-dee690257c79/output/arm-linux-gnueabihf/bitcoin-dee690257c79-arm-linux-gnueabihf-debug.tar.gz
  b913f2b0d8f0e32a176bc0e9330106cf1973afe6e8ee955f3eeb89918ab9d565  guix-build-dee690257c79/output/arm-linux-gnueabihf/bitcoin-dee690257c79-arm-linux-gnueabihf.tar.gz
  034b47d8a60a19391e0e18f6fcc8fb3a87be78a9707e3ac3e7ee45eb37687bb7  guix-build-dee690257c79/output/arm64-apple-darwin/SHA256SUMS.part
  9efc5c0ceac05f6efce03fcde0cbe8b79bae43fe0d98aecb817908e76f5c39b7  guix-build-dee690257c79/output/arm64-apple-darwin/bitcoin-dee690257c79-arm64-apple-darwin-unsigned.dmg
  a549cdcbd311d9b025971b13987290f6cd2b93e16c8389e8a7a2ccd3608326ed  guix-build-dee690257c79/output/arm64-apple-darwin/bitcoin-dee690257c79-arm64-apple-darwin-unsigned.tar.gz
  3dd9e26a41596151022aa4288d778dc335a2b38bd391e3f65c0575dd6eb47b54  guix-build-dee690257c79/output/arm64-apple-darwin/bitcoin-dee690257c79-arm64-apple-darwin.tar.gz
  a71685a3ff62fbf456fc1d3c0f78ab7ab1d5a4a094c1f43d3829730d65a3ec51  guix-build-dee690257c79/output/dist-archive/bitcoin-dee690257c79.tar.gz
  d5c74167b2260b7de72fdbac77eedacbbb929214e279e07f41c3236ea20116b6  guix-build-dee690257c79/output/powerpc64-linux-gnu/SHA256SUMS.part
  03c043daa971f70886805c9e4174acd600e5cda03ae0e827043c4df81a6a6426  guix-build-dee690257c79/output/powerpc64-linux-gnu/bitcoin-dee690257c79-powerpc64-linux-gnu-debug.tar.gz
  3884423f67d48f671a90169962f9568dcbd8df582cd269df29a4399dc9c70e99  guix-build-dee690257c79/output/powerpc64-linux-gnu/bitcoin-dee690257c79-powerpc64-linux-gnu.tar.gz
  cee2847d4feeadebfdf4d37110faafa250824c68cfefc3bfa289ae8b09599a20  guix-build-dee690257c79/output/powerpc64le-linux-gnu/SHA256SUMS.part
  ca9f1085184b50e7bd377b68a58afd42ac4055ffe214eede8c6ca7291e00b45a  guix-build-dee690257c79/output/powerpc64le-linux-gnu/bitcoin-dee690257c79-powerpc64le-linux-gnu-debug.tar.gz
  b9cadff5b30244f6cb4f277e1ac610841332cb0d732637fe438fd51c88adf5a4  guix-build-dee690257c79/output/powerpc64le-linux-gnu/bitcoin-dee690257c79-powerpc64le-linux-gnu.tar.gz
  db6e45d9fc8868e5cb25fa3d0789247db10a6bab2a6f3866a27d641ae00bd03b  guix-build-dee690257c79/output/riscv64-linux-gnu/SHA256SUMS.part
  751e90c0aefa249f175c0c1707dc5eee3637e2b9657a9ee1b2068479e9830ff0  guix-build-dee690257c79/output/riscv64-linux-gnu/bitcoin-dee690257c79-riscv64-linux-gnu-debug.tar.gz
  8dd87bb24f1fbdba67fb6b72ab5fc93532452eada8c2942463100b8ed8118ae3  guix-build-dee690257c79/output/riscv64-linux-gnu/bitcoin-dee690257c79-riscv64-linux-gnu.tar.gz
  b53fe650f431e394a5af6bd809401551e3c36e4f7d90c31f39f51c5fe236efaf  guix-build-dee690257c79/output/x86_64-apple-darwin/SHA256SUMS.part
  b35b4ae345a625e42b8315acd9b75bb651f60265f67ec6f7d78a41c8d21c635e  guix-build-dee690257c79/output/x86_64-apple-darwin/bitcoin-dee690257c79-x86_64-apple-darwin-unsigned.dmg
  6748e4c64ae069632624cbec20de7f03eca1a7578fcef96607f3e8cb0ac4106e  guix-build-dee690257c79/output/x86_64-apple-darwin/bitcoin-dee690257c79-x86_64-apple-darwin-unsigned.tar.gz
  6415cbecfa18002a1e4865b996268558b4f26121118fd73b0ef4ca44967f34c7  guix-build-dee690257c79/output/x86_64-apple-darwin/bitcoin-dee690257c79-x86_64-apple-darwin.tar.gz
  f0a8d8837e80e42b5d77c3efc9d746c11ffc9909aece16dcba0a10726e1be7e0  guix-build-dee690257c79/output/x86_64-linux-gnu/SHA256SUMS.part
  418f4607159387ee17657120beda1c741fa6060e4457b304b857aa6c33859e6a  guix-build-dee690257c79/output/x86_64-linux-gnu/bitcoin-dee690257c79-x86_64-linux-gnu-debug.tar.gz
  d384fe8f2d6515c256a371ad84ae76ac9727ffd49887c0e22bb5ada4cd890092  guix-build-dee690257c79/output/x86_64-linux-gnu/bitcoin-dee690257c79-x86_64-linux-gnu.tar.gz
  3f441eb2d68ddd530b32f56a16ff639b27dcc58b5ba395e40f4c2be805f6cd8b  guix-build-dee690257c79/output/x86_64-w64-mingw32/SHA256SUMS.part
  d3d22479adc554ced965c4bde79f4c919e6b216acfca598fac4ebfc3b0e2d39d  guix-build-dee690257c79/output/x86_64-w64-mingw32/bitcoin-dee690257c79-win64-debug.zip
  89de153f5d839df6cd1266f8b3cb3ad455b2f6c43cee7644889da1e3efc7b2f1  guix-build-dee690257c79/output/x86_64-w64-mingw32/bitcoin-dee690257c79-win64-setup-unsigned.exe
  ba30708b9551b3794e4d2726aff27775dd4f1b347ea71b3fe1b00e39e8b7a594  guix-build-dee690257c79/output/x86_64-w64-mingw32/bitcoin-dee690257c79-win64-unsigned.tar.gz
  ab6a2b7a3e899fc58030a44b555e449d64aa69b5215d761bc550946b14f93515  guix-build-dee690257c79/output/x86_64-w64-mingw32/bitcoin-dee690257c79-win64.zip
  ```

ACKs for top commit:
  Sjors:
    tACK dee690257c
  achow101:
    ACK dee690257c
  hebasto:
    ACK dee690257c, I have reviewed the code and it looks OK.

Tree-SHA512: e0605f049404905db94ea61473b2b68df008ceb86b9a09d8562ca3acc1f3a3be3893149fc62d189a6fbf24cfc76c393f2d1a1215292e9ae5dc4afc199e876821
2023-01-24 13:34:01 -05:00
MarcoFalke
30f553d457
Merge bitcoin/bitcoin#26707: clang-tidy: Fix performance-*move* warnings in headers
1308b837dc clang-tidy: Fix `performance-no-automatic-move` in headers (Hennadii Stepanov)
0a5dc030b9 clang-tidy: Fix `performance-move-const-arg` in headers (Hennadii Stepanov)

Pull request description:

  Split from bitcoin/bitcoin#26705 as was requested in https://github.com/bitcoin/bitcoin/pull/26705#issuecomment-1353293405.

  To test this PR, consider applying a diff as follows:
  ```diff
  --- a/src/.clang-tidy
  +++ b/src/.clang-tidy
  @@ -1,16 +1,7 @@
   Checks: '
   -*,
  -bugprone-argument-comment,
  -bugprone-use-after-move,
  -misc-unused-using-decls,
  -modernize-use-default-member-init,
  -modernize-use-nullptr,
  -performance-for-range-copy,
   performance-move-const-arg,
   performance-no-automatic-move,
  -performance-unnecessary-copy-initialization,
  -readability-redundant-declaration,
  -readability-redundant-string-init,
   '
   WarningsAsErrors: '
   bugprone-argument-comment,
  @@ -28,4 +19,4 @@ readability-redundant-string-init,
   CheckOptions:
    - key: performance-move-const-arg.CheckTriviallyCopyableMove
      value: false
  -HeaderFilterRegex: './qt'
  +HeaderFilterRegex: '.'
  ```

ACKs for top commit:
  fanquake:
    ACK 1308b837dc

Tree-SHA512: b7ef9a3e789846130ab4c3fd6fbe8d887bdbcd438e4cbc78e2b1ac01f819ae13d7f69c2a25f480bd36e3e7f58886a7d5a8609a3c3275c315e0697cd4010474bd
2023-01-24 16:28:08 +01:00
MarcoFalke
3ce7b27124
Merge bitcoin/bitcoin#26930: fuzz: Actually use mocked mempool in tx_pool target
9ab62d71fb [fuzz] Actually use mocked mempool in tx_pool target (dergoegge)

Pull request description:

  The current tx_pool target uses the default mempool, making the target non-deterministic. This PR replaces the active chainstate's mempool (i.e. the node's default mempool) with the already present mocked mempool in the target.

ACKs for top commit:
  fanquake:
    ACK 9ab62d71fb

Tree-SHA512: fe9af3dbdd13cb569fdc2ddbb4290b5ce94206ae83d94267c6365ed0ee9bbe072fcfe7fd632a1a8522dce44608e89aba2f398c1e20bd250484bbadb78143320c
2023-01-24 12:54:48 +01:00
fanquake
f1b5d6be57
Merge bitcoin/bitcoin#26955: wallet: permit mintxfee=0
f11eb1fe27 wallet: permit mintxfee=0 (willcl-ark)

Pull request description:

  Fixes #26797

  Permit nodes to use `-mintxfee=0`. Values below 0 are handled by the ParseMoney() check.

ACKs for top commit:
  MarcoFalke:
    review ACK f11eb1fe27
  john-moffett:
    ACK f11eb1fe27

Tree-SHA512: 3bf50362bced4fee8e3a846cfb46f1c65dd607c9c824aa3f8c52294371b0646d167a04772d5302bdbee35bbaf407ef0aa634228f70e522c3e423f4213b4ae071
2023-01-24 11:49:28 +00:00
MarcoFalke
837e9ed611
Merge bitcoin/bitcoin#26898: fuzz: Add PartiallyDownloadedBlock target
a1c36275b5 [fuzz] Assert that omitting missing transactions always fails block reconstruction (dergoegge)
a8ac61ab5e [fuzz] Add PartiallyDownloadedBlock target (dergoegge)
42bd4c7468 [block encodings] Avoid fuzz blocking asserts in PartiallyDownloadedBlock (dergoegge)
1429f83770 [block encodings] Make CheckBlock mockable for PartiallyDownloadedBlock (dergoegge)

Pull request description:

  This PR adds a fuzz target for `PartiallyDownloadedBlock`, which we currently do not have any coverage for.

ACKs for top commit:
  mzumsande:
    Code Review ACK a1c36275b5
  MarcoFalke:
    re-ACK a1c36275b5  🎼

Tree-SHA512: 01ae452fe457da0c8f2b28c72091d40807c56a9e5d0f80b55f166b67be50baf80a02f53d4cbe9736bb22424cca1758b87e4e471b8a24e756c22563a2640e9a5f
2023-01-24 12:38:26 +01:00
MarcoFalke
75e752f134
Merge bitcoin/bitcoin#26954: test: Avoid rpc timeout in p2p_headers_sync_with_minchainwork
fa952fad2f test: Avoid rpc timeout in p2p_headers_sync_with_minchainwork (MarcoFalke)

Pull request description:

  When running a lot of tests in parallel, I get `JSONRPCException: 'generatetoaddress' RPC took longer than 30.000000 seconds.`

  The general recommendation, if running into timeouts, is to increase the `--timeout-factor`. However, I think that the default timeout values should be suitable to run the tests out of the box on reasonable hardware.

ACKs for top commit:
  fanquake:
    ACK fa952fad2f

Tree-SHA512: b7eeda54f8db900f077417c0431f659c67e686e2fc078f8c713e37ed75b8bc862814ce20e8400741638e35e224d7284ad16172bf5f82168f803376d0c9ec4524
2023-01-24 12:24:09 +01:00
MarcoFalke
fab958290b
refactor: Remove c_str from util/check 2023-01-24 12:09:29 +01:00
MarcoFalke
fcff639af1
Merge bitcoin/bitcoin#26958: build: fix usage of -Wloop-analysis
166e0c057c build: fix usage of -Wloop-analysis (fanquake)

Pull request description:

  Looks like I introduced this in
  5ced925283.

ACKs for top commit:
  hebasto:
    ACK 166e0c057c, tested on Ubuntu 22.04:
  jarolrod:
    ACK 166e0c057c

Tree-SHA512: ad1e7f39207da232dd7065e91b3a856c20d88df43908a4bf327fba1afc424f5dd84b546bf89c23da52765839aa8e5e278ee6ed0033ee8fae760a64a800c2dd42
2023-01-24 09:10:23 +01:00
Andrew Chow
b9d5674541 init: Remove sensitive flag from rpcbind 2023-01-23 17:25:02 -05:00
fanquake
166e0c057c
build: fix usage of -Wloop-analysis
Looks like I introduced this in
5ced925283.
2023-01-23 17:57:40 +00:00
fanquake
a62231bca6
Merge bitcoin/bitcoin#26690: wallet: Refactor database cursor into its own object with proper return codes
4aebd832a4 db: Change DatabaseCursor::Next to return status enum (Andrew Chow)
d79e8dcf29 wallet: Have cursor users use DatabaseCursor directly (Andrew Chow)
7a198bba0a wallet: Introduce DatabaseCursor RAII class for managing cursor (Andrew Chow)
69efbc011b Move SafeDbt out of BerkeleyBatch (Andrew Chow)

Pull request description:

  Instead of having database cursors be tied to a particular `DatabaseBatch` object and requiring its setup and teardown be separate functions in that batch, we can have cursors be separate RAII classes. This makes it easier to create and destroy cursors as well as having cursors that have slightly different behaviors.

  Additionally, since reading data from a cursor is a tri-state, this PR changes the return value of the `Next` function (formerly `ReadAtCursor`) to return an Enum rather than the current system of 2 booleans. This greatly simplifies and unifies the code that deals with cursors as now there is no confusion as to what the function returns when there are no records left to be read.

  Extracted from #24914

ACKs for top commit:
  furszy:
    diff ACK 4aebd83
  theStack:
    Code-review ACK 4aebd832a4

Tree-SHA512: 5d0be56a18de5b08c777dd5a73ba5a6ef1e696fdb07d1dca952a88ded07887b7c5c04342f9a76feb2f6fe24a45dc31f094f1f5d9500e6bdf4a44f4edb66dcaa1
2023-01-23 17:56:16 +00:00
dergoegge
a1c36275b5 [fuzz] Assert that omitting missing transactions always fails block reconstruction 2023-01-23 17:29:41 +01:00
dergoegge
a8ac61ab5e [fuzz] Add PartiallyDownloadedBlock target 2023-01-23 17:29:41 +01:00
dergoegge
42bd4c7468 [block encodings] Avoid fuzz blocking asserts in PartiallyDownloadedBlock 2023-01-23 17:18:35 +01:00
dergoegge
1429f83770 [block encodings] Make CheckBlock mockable for PartiallyDownloadedBlock 2023-01-23 17:18:35 +01:00
MarcoFalke
5271c77f83
Merge bitcoin/bitcoin#26826: refactor: remove windows-only compat.h usage in randomenv
b358bde020 randomenv: consolidate WIN32 #ifdefs (fanquake)
fff80cd248 random: remove windows-only compat.h include in randomenv (fanquake)

Pull request description:

  Similar to #26814.

  Having a windows-only include of compat.h is confusing, not-only because it's already included globally via util/time.h, but also because it's unclear why compat.h is included (neither of the required headers are included there).

  This change is related to removing the use of compat.h as a miscellaneous catch-all for unclear/platform specific includes. Somewhat prompted by IWYU-related discussion here: https://github.com/bitcoin/bitcoin/pull/26763/files#r1058861693.

ACKs for top commit:
  hebasto:
    ACK b358bde020.
  TheCharlatan:
    ACK b358bde020

Tree-SHA512: d46dffe36a17ad0f9374a55e0ecaf2d60d0b473c8fc9ad6f3005142014c08a7c10bae4948856531abb443f5e0bd6062958fe574197e282dad22ae50134d71e5f
2023-01-23 16:36:27 +01:00
MarcoFalke
fa952fad2f
test: Avoid rpc timeout in p2p_headers_sync_with_minchainwork 2023-01-23 16:35:13 +01:00
willcl-ark
f11eb1fe27
wallet: permit mintxfee=0
Fixes #26797

Permit nodes to use a mintxfee of `0` if they choose.
Values below 0 are handled by the ParseMoney() check.
2023-01-23 13:35:04 +00:00
fanquake
dee690257c
build: pass --enable-debug to sqlite when DEBUG=1 2023-01-23 10:21:08 +00:00
fanquake
807b61fcca
build: use more recommended sqlite3 compile options
See https://www.sqlite.org/compile.html.

DSQLITE_DQS
> This setting disables the double-quoted string literal misfeature.

DSQLITE_DEFAULT_MEMSTATUS
> This setting causes the sqlite3_status() interfaces that track
> memory usage to be disabled.
> This helps the sqlite3_malloc() routines run much faster, and since
> SQLite uses sqlite3_malloc() internally, this helps to make the
> entire library faster.

DSQLITE_OMIT_DEPRECATED
> Omitting deprecated interfaces and features will not help SQLite
> to run any faster.
> It will reduce the library footprint, however. And it is the
> right thing to do.

DSQLITE_OMIT_SHARED_CACHE
> Omitting the possibility of using shared cache allows many
> conditionals in performance-critical sections of the code to be
> eliminated. This can give a noticeable improvement in performance.

Also: https://www.sqlite.org/sharedcache.html
> Shared-cache mode is an obsolete feature.
> The use of shared-cache mode is discouraged.
> Most use cases for shared-cache are better served by WAL mode.
> Applications that build their own copy of SQLite from source code
> are encouraged to use the -DSQLITE_OMIT_SHARED_CACHE compile-time
> option, as the resulting binary will be both smaller and faster.

DSQLITE_OMIT_JSON
Starting with sqlite 3.38.0 the JSON extension became opt-out rather
than opt-in, so we disable it here.

--disable-rtree
> An R-Tree is a special index that is designed for doing range queries.
> R-Trees are most commonly used in geospatial systems...
https://www.sqlite.org/rtree.html

--disable-fts4 --disable-fts5
> FTS5 is an SQLite virtual table module that provides full-text
> search functionality to database applications.

DSQLITE_LIKE_DOESNT_MATCH_BLOBS
> simplifies the implementation of the LIKE optimization and allows
> queries that use the LIKE optimization to run faster.

DSQLITE_OMIT_DECLTYPE
> By omitting the (seldom-needed) ability to return the declared type of
> columns from the result set of query, prepared statements can be made
> to consume less memory.

DSQLITE_OMIT_PROGRESS_CALLBACK
> By omitting this interface, a single conditional is removed from the
> inner loop of the bytecode engine, helping SQL statements to run slightly
> faster.

DSQLITE_OMIT_AUTOINIT
> with the SQLITE_OMIT_AUTOINIT option, the automatic initialization is omitted.
> This helps many API calls to run a little faster
> it also means that the application must call sqlite3_initialize()
manually.
2023-01-23 10:17:48 +00:00
MarcoFalke
a8c1ea50c7
Merge bitcoin/bitcoin#26919: scripted-diff: use RPCArg::Optional::OMITTED over OMITTED_NAMED_ARG
83f70c8e86 doc: improve doc for RPCArg::Optional::OMITTED (fanquake)
ea8c7daf7a scripted-diff: use RPCArg::Optional::OMITTED over OMITTED_NAMED_ARG (fanquake)

Pull request description:

  Remove deprecated `RPCArg::Optional::OMITTED_NAMED_ARG` in favour of `OMITTED`.

ACKs for top commit:
  kouloumos:
    re-ACK 83f70c8e86
  aureleoules:
    ACK 83f70c8e86

Tree-SHA512: caba82c0f9f7969d7534bdcdcdfd80b94c16750598343ce63af28e0d579bfd49405bf28acd66dbc6c9a720f040b0e146a5efdff79ebc5ac7364dab54ab16c4a6
2023-01-23 10:12:58 +01:00
MarcoFalke
f99b85642f
Merge bitcoin/bitcoin#26944: depends: fix systemtap download URL
d81ca6619a depends: fix systemtap download URL (fanquake)

Pull request description:

  The URL has changed, and the current one 404s.

ACKs for top commit:
  hebasto:
    ACK d81ca6619a, verified each link: the old one returns 404, the new one is OK.
  theStack:
    ACK d81ca6619a
  jarolrod:
    ACK d81ca6619a

Tree-SHA512: e3240efd97003b4063c84bf72638d005f1629d0753359520353e249745fde185ef8e23fcd504037486bce4c4453dcb86f972e33111486ace8ad65746636e1499
2023-01-23 09:23:40 +01:00
fanquake
d81ca6619a
depends: fix systemtap download URL 2023-01-22 15:58:04 +00:00
fanquake
83f70c8e86
doc: improve doc for RPCArg::Optional::OMITTED 2023-01-22 15:05:14 +00:00
fanquake
ea8c7daf7a
scripted-diff: use RPCArg::Optional::OMITTED over OMITTED_NAMED_ARG
-BEGIN VERIFY SCRIPT-
sed -i -e "/Deprecated alias for OMITTED, can be removed/d" src/rpc/util.h src/rpc/util.cpp
sed -i -e "s/OMITTED_NAMED_ARG/OMITTED/g" $(git grep -l "OMITTED_NAMED_ARG" src/)
-END VERIFY SCRIPT-
2023-01-22 15:01:48 +00:00
fanquake
ad09b76275
Merge bitcoin/bitcoin#26471: Reduce default mempool size in -blocksonly mode
8e85164e7d doc: release note on mempool size in -blocksonly (willcl-ark)
ae797463dc doc: Update blocksonly behaviour in reduce-memory (willcl-ark)
1134686ef9 mempool: Don't share mempool with dbcache in blocksonly (willcl-ark)

Pull request description:

  Fixes #9526

  When `-blocksonly` has been set reduce default mempool size to avoid surprising resource usage via sharing un-used mempool cache space with dbcache.

  In comparison to https://github.com/bitcoin/bitcoin/pull/9569 which either set `maxmempool` size to 0 when `-blocksonly` was set or else errored on startup, this change will permit `maxmempool` options being set.

  This preserves the current (surprising?) behaviour of having a functional mempool in `-blocksonly` mode, to permit whitelisted peer transaction relay, whilst reducing average runtime memory usage for blocksonly nodes which either use the default settings or have otherwise configured a `maxmempool` size.

  To use the previous old defaults node operators can configure their node with: `-blocksonly -maxmempool=300`.

ACKs for top commit:
  ajtowns:
    ACK 8e85164e7d
  stickies-v:
    re-ACK 8e85164e7d

Tree-SHA512: 1c461c24b6f14ba02cfe4e2cde60dc629e47485db5701bca3003b8df79e3aa311c0c967979f6a1dca3ba69f5b1e45fa2db6ff83352fdf2d4349d5f8d120e740d
2023-01-22 14:57:16 +00:00
fanquake
bf9361d375
Merge bitcoin/bitcoin#26941: test: Fix intermittent feature_rbf issue
fa88c043d1 test: Fix intermittent feature_rbf issue (MarcoFalke)

Pull request description:

  The miniwallet will rescan the chain and mempool on construction. If the mempools are still in sync, it may lead to crashes. Fix that by moving the sync first.

  Fixes #26937

ACKs for top commit:
  theStack:
    Code-review ACK fa88c043d1

Tree-SHA512: 5ffcd5e91118b57811b62f12454da8ae3ca98ffad175cd895cd41b63d7cf420906b1e15a4d4489d223d6b21ab796f9839676af8a5f340c606868bc249f4ea340
2023-01-22 14:17:49 +00:00
MarcoFalke
fa88c043d1
test: Fix intermittent feature_rbf issue 2023-01-21 11:18:12 +01:00
MarcoFalke
c0b6c40bb0
Merge bitcoin/bitcoin#26934: test: Add unit test for ComputeTapleafHash
f34ada89fd Add unit test for ComputeTapleafHash (Greg Sanders)

Pull request description:

  Quick follow-up to https://github.com/bitcoin/bitcoin/pull/25877

ACKs for top commit:
  sipa:
    ACK f34ada89fd

Tree-SHA512: ebec658c9b33859874a3e5d13ca0a00a2484233f00f2da09c7d3fb47ed7f56fc6d476ddd0473fe1396a514dffd6ea6a200f26c6dbca45bac2473e729ffef04c2
2023-01-20 16:25:21 +01:00
Greg Sanders
f34ada89fd Add unit test for ComputeTapleafHash 2023-01-20 09:36:51 -05:00
willcl-ark
8e85164e7d
doc: release note on mempool size in -blocksonly
Adds a release note detailing the new mempool sizing behaviour when
running in blocksonly mode, and instruction on how to override the new
defaults.
2023-01-20 13:54:05 +00:00
willcl-ark
ae797463dc
doc: Update blocksonly behaviour in reduce-memory
Changes to the default mempool allocation size now documented.

Provides users with guidance on the mempool implications of -blocksonly
mode, along with instructions on how to re-enable old behaviour.
2023-01-20 13:27:07 +00:00
willcl-ark
1134686ef9
mempool: Don't share mempool with dbcache in blocksonly
When -blockonly is set, reduce mempool size to 5MB unless -maxmempool
is also set.

See #9569
2023-01-20 12:53:13 +00:00
MarcoFalke
fafeddfe0e
rpc: Throw more user friendly arg type check error 2023-01-20 13:26:47 +01:00
dergoegge
9ab62d71fb [fuzz] Actually use mocked mempool in tx_pool target 2023-01-20 12:15:01 +01:00
fanquake
392dc68e37
Merge bitcoin/bitcoin#26924: refactor: Add missing includes to fix gcc-13 compile error
fadeb6b103 Add missing includes to fix gcc-13 compile error (MarcoFalke)

Pull request description:

  On current master:

  ```
    CXX      support/libbitcoin_util_a-lockedpool.o
  support/lockedpool.cpp: In member function ‘void Arena::free(void*)’:
  support/lockedpool.cpp:99:20: error: ‘runtime_error’ is not a member of ‘std’
     99 |         throw std::runtime_error("Arena: invalid or double free");
        |                    ^~~~~~~~~~~~~
  support/lockedpool.cpp:22:1: note: ‘std::runtime_error’ is defined in header ‘<stdexcept>’; did you forget to ‘#include <stdexcept>’?
     21 | #include <algorithm>
    +++ |+#include <stdexcept>
     22 | #ifdef ARENA_DEBUG
  support/lockedpool.cpp: In member function ‘void LockedPool::free(void*)’:
  support/lockedpool.cpp:320:16: error: ‘runtime_error’ is not a member of ‘std’
    320 |     throw std::runtime_error("LockedPool: invalid address not pointing to any arena");
        |                ^~~~~~~~~~~~~
  support/lockedpool.cpp:320:16: note: ‘std::runtime_error’ is defined in header ‘<stdexcept>’; did you forget to ‘#include <stdexcept>’?

ACKs for top commit:
  hebasto:
    ACK fadeb6b103.
  fanquake:
    ACK fadeb6b103 - tested this fixes compilation with GCC 13. I don't think theres a need to do anything else here, and that'd also just potentially complicate backporting.

Tree-SHA512: 99f79cf385c913138a9cf9fc23be0a3a067b0a28518b8bdc033a7220b85bbc5d18f5356c5bdad2f628c22abb87c18b232724f606eba6326c031518559054be31
2023-01-20 10:26:36 +00:00
MarcoFalke
eebc24bfc6
Merge bitcoin/bitcoin#26887: RPC: make RPCResult::MatchesType return useful errors
3d1a4d8a45 RPC: make RPCResult::MatchesType return useful errors (Anthony Towns)

Pull request description:

  Currently if you don't correctly update the description of the return value for an RPC call, you essentially just get an assertion failure with no useful information; this generates a description of the problems instead.

ACKs for top commit:
  MarcoFalke:
    re-ACK 3d1a4d8a45 🌷

Tree-SHA512: cf0580b7046faab0128672a74f8cc5a1655dfdca6646a2e38b51f0fb5f672c98aad6cd4c5769454a2d644a67da639ccb1c8ff5d24d3d6b4446a082398a643722
2023-01-20 10:37:23 +01:00
Andrew Chow
58da1619be
Merge bitcoin/bitcoin#25877: refactor: Do not use CScript for tapleaf scripts until the tapleaf version is known
dee89438b8 Abstract out ComputeTapbranchHash (Russell O'Connor)
8e3fc99427 Do not use CScript for tapleaf scripts until the tapleaf version is known (Russell O'Connor)

Pull request description:

  While BIP-341 calls the contents of tapleaf a "script", only in the case that the tapleaf version is `0xc0` is this script known to be a tapscript.  Otherwise the tapleaf "script" is simply an uninterpreted string of bytes.

  This PR corrects the issue where the type `CScript` is used prior to the tapleaf version being known to be a tapscript.  This prevents `CScript` methods from erroneously being called on non-tapscript data.

  A second commit abstracts out the TapBranch hash computation in the same manner that the TapLeaf computation is already abstracted.  These two abstractions ensure that the TapLeaf and TapBranch tagged hashes are always constructed properly.

ACKs for top commit:
  ajtowns:
    ACK dee89438b8
  instagibbs:
    ACK dee89438b8
  achow101:
    ACK dee89438b8
  sipa:
    ACK dee89438b8
  aureleoules:
    reACK dee89438b8 - I verified that there is no behavior change.

Tree-SHA512: 4a1d37f3e9a1890e7f5eadcf65562688cc451389581fe6e2da0feb2368708edacdd95392578d8afff05270d88fc61dce732d83d1063d84d12cf47b5f4633ec7e
2023-01-19 17:51:21 -05:00
Anthony Towns
3d1a4d8a45 RPC: make RPCResult::MatchesType return useful errors 2023-01-20 06:24:15 +10:00
MarcoFalke
fadeb6b103
Add missing includes to fix gcc-13 compile error 2023-01-19 19:30:10 +01:00
MarcoFalke
250598a905
Merge bitcoin/bitcoin#26906: test: add an easy way to run linters locally
b68e5a7fef lint: specify the right commit range when running locally (James O'Beirne)
dff7ed5732 test: add an easy way to run linters locally (James O'Beirne)

Pull request description:

  Adds a Dockerfile configuration ~~(originally written mostly by fanquake)~~ that allows straightforward running of linters with compatible versions locally. This removes a ton of annoyance when trying to appease CI, because many of the linter versions are quite old and difficult to maintain locally.

  I realize that people may not be thrilled to add more ancillary tooling to the repo, but I think this makes a lot of sense given the linter versions listed in this container configuration are dictated by this repo (within the CI configuration), so having these things live in two separate places is a recipe for version mismatches.

  Eventually we can likely just use this container on CI directly to avoid any chance of inconsistencies between local dev experience and CI.

ACKs for top commit:
  aureleoules:
    ACK b68e5a7fef
  stickies-v:
    ACK b68e5a7fe
  john-moffett:
    ACK b68e5a7fef

Tree-SHA512: 7ef7a5dae023d81fdb6296d5d92dfa074ee321c7993e607c9f014d0f21c91558611aa00fc3ce1edc7b5e68371aea0d27fa1931291a79bb867a6c783bb536775f
2023-01-19 19:01:28 +01:00
MarcoFalke
b5c88a5479
Merge bitcoin/bitcoin#26909: net: prevent peers.dat corruptions by only serializing once
5eabb61b23 addrdb: Only call Serialize() once (Martin Zumsande)
da6c7aeca3 hash: add HashedSourceWriter (Martin Zumsande)

Pull request description:

  There have been various reports of corruption of `peers.dat` recently, see #26599.
  As explained in [this post](https://github.com/bitcoin/bitcoin/issues/26599#issuecomment-1381082886) in more detail, the underlying issue is likely that we currently serialize `AddrMan` twice - once for the file stream, once for the hasher that helps create the checksum - and if `AddrMan` changes in between these two calls, the checksum doesn't match the data and the resulting `peers.dat` is corrupted.

  This PR attempts to fix this by introducing and using `HashedSourceWriter` - a class that keeps a running hash while serializing data, similar to the existing `CHashVerifier` which does the analogous thing while unserializing data. Something like this was suggested before, see https://github.com/bitcoin/bitcoin/pull/10248#discussion_r120694343.

  Fixes #26599 (not by changing the behavior in case of a crash, but by hopefully fixing the underlying cause of these corruptions).

ACKs for top commit:
  sipa:
    utACK 5eabb61b23
  naumenkogs:
    utACK 5eabb61b23

Tree-SHA512: f19ad37c37088d3a9825c60de2efe85cc2b7a21b79b9156024d33439e021443ef977a5f8424a7981bcc13d73d11e30eaa82de60e14d88b3568a67b03e02b153b
2023-01-19 16:03:08 +01:00
MarcoFalke
05e3468fb3
Merge bitcoin/bitcoin#26686: fuzz: Enable erlay setting in process_message(s) targets
58c2bbdb55 [fuzz] Enable erlay in process_message(s) targets (dergoegge)

Pull request description:

  The process_message(s) targets can't exercise the Erlay logic at the moment as the config setting is off by default and not switched on in the fuzz targets.

  This PR enables the `-txreconciliation` setting in both targets.

ACKs for top commit:
  fanquake:
    ACK 58c2bbdb55

Tree-SHA512: a2754fd04549bdcac94d8225244c5c83fe4c26114c0c2fdf316257480625e05e4e6b1b791974e1f1021451d3f81cb59a109261fb73178ad03911f0a3db963077
2023-01-19 15:56:58 +01:00
fanquake
2343886217
Merge bitcoin/bitcoin#26920: doc: add release note for #25957 (fast wallet rescan)
783288334c doc: add release note for #25957 (fast wallet rescan) (Sebastian Falbesoner)

Pull request description:

  This PR adds a missing release note for #25957.

ACKs for top commit:
  Sjors:
    ACK 783288334c

Tree-SHA512: 817aa3d27b3f839de3975ace7c8ec59bcc4dbe4b5628bf64153e503cd143599d8923bd7e181ad5b196dacf1a9078347825bc40d4de5c6e2df9ed12e752217094
2023-01-19 13:40:23 +00:00
Sebastian Falbesoner
783288334c doc: add release note for #25957 (fast wallet rescan) 2023-01-19 13:40:26 +01:00