Commit Graph

36222 Commits

Author SHA1 Message Date
jonatack
0ed9cc5892 doc: clarify -i2pacceptincoming help documentation
and also hoist the default setting to a constexpr and
remove unused f-string operators in a related functional test.
2023-01-09 08:18:47 -08:00
Andrew Chow
b4fb0a3255
Merge bitcoin/bitcoin#26761: wallet: fully migrate address book entries for watchonly/solvable wallets
730e14a317 test: wallet: check that labels are migrated to watchonly wallet (Sebastian Falbesoner)
d5f4ae7fac wallet: fully migrate address book entries for watchonly/solvable wallets (Sebastian Falbesoner)

Pull request description:

  Currently `migratewallet` migrates the address book (i.e. labels and purposes) for watchonly and solvable wallets only in RAM, but doesn't persist them on disk. Fix this by adding another loop for both of the special wallet types after which writes the corresponding NAME and PURPOSE entries to the database in a single batch. Also adds a corresponding test that checks if labels were migrated correctly for a watchonly wallet.

ACKs for top commit:
  achow101:
    ACK 730e14a317
  furszy:
    code ACK 730e14a3, left a non-blocking nit.
  aureleoules:
    ACK 730e14a317

Tree-SHA512: 159487e11e858924ef762e0190ccaea185bdff239e3d2280c8d63c4ac2649ec71714dc4d53dec644f03488f91c3b4bbbbf3434dad23bc0fcecb6657f353ea766
2023-01-05 12:22:51 -05:00
MarcoFalke
3212d104f4
Merge bitcoin/bitcoin#23829: refactor: use braced init for integer literals instead of c style casts
f2fc03ec85 refactor: use braced init for integer constants instead of c style casts (Pasta)

Pull request description:

  See https://github.com/bitcoin/bitcoin/pull/23810 for more context. This is broken out from that PR, as it is less breaking, and should be trivial to review and merge.

  EDIT: Long term, the intention is to remove all C-style casts, as they can dangerously introduce reinterpret_casts. This is one step which removes a number of trivially removable C-style casts

ACKs for top commit:
  aureleoules:
    ACK f2fc03ec85

Tree-SHA512: 2fd11b92c9147e3f970ec3e130e3b3dce70e707ff02950a8c697d4b111ddcbbfa16915393db20cfc8f384bc76f13241c9b994a187987fcecd16a61f8cc0af14c
2023-01-05 17:30:52 +01:00
MarcoFalke
61f35159ff
Merge bitcoin/bitcoin#26818: test: Fix feature_startupnotify intermittent issue
fac810bb0a test: Fix feature_startupnotify intermittent issue (MarcoFalke)

Pull request description:

  Might fix #25644

ACKs for top commit:
  aureleoules:
    ACK fac810bb0a
  brunoerg:
    ACK fac810bb0a

Tree-SHA512: 870bf65da8120b6897d02e3bb70eea018d4761396abe64c3533bbc5237e65be9f77d35f62cd5d08cf7132dd53b504bf58229c33e18833c191495ad229c84d7c2
2023-01-05 17:22:28 +01:00
MarcoFalke
fac810bb0a
test: Fix feature_startupnotify intermittent issue 2023-01-05 14:10:07 +01:00
MarcoFalke
296e882250
Merge bitcoin/bitcoin#26598: contrib: remove builder keys
e6864fa157 contrib: remove builder keys (fanquake)

Pull request description:

  This has been superseded by adding a builder-keys/ directory in
  guix.sigs, where the presence of keys, and validity of signatures
  is checked. Preventing issues like missing keys or invalid signatures.

  New (or exisiting) Guix builders can add their key in the next PR
  they open adding attestations.

  Related to issues like #26566, #26563.

  Also follows up with the comment here: https://github.com/bitcoin/bitcoin/pull/26565#issuecomment-1326053939.

ACKs for top commit:
  hebasto:
    ACK e6864fa157, modulo s/update/remove/ in the PR tittle.

Tree-SHA512: 095b4cf12ed0baeaf0ee7b8edcb3e2647e9c0f812e8fd63915ddb454f81dacc9c2d2b409de2773b7adb5ff643893d614d8aad1bc44c26da648e1bbbe19e11e05
2023-01-05 09:18:16 +01:00
Andrew Chow
360e047a71
Merge bitcoin/bitcoin#26747: wallet: fix confusing error / GUI crash on cross-chain legacy wallet restore
21ad4e26ec test: add coverage for cross-chain wallet restore (Sebastian Falbesoner)
8c7222bda3 wallet: fix GUI crash on cross-chain legacy wallet restore (Sebastian Falbesoner)

Pull request description:

  Restoring a wallet backup from another chain should result in a dedicated error message (we have _"Wallet files should not be reused across chains. Restart bitcoind with -walletcrosschain to override."_ for that). Unfortunately this is currently not the case for legacy wallet restores, as in the course of cleaning up the newly created wallet directory a `filesystem_error` exception is thrown due to the directory not being empty; the wallet database did indeed load successfully (otherwise we wouldn't know that the chain doesn't match) and hence BDB-related files and directories are already created in the wallet directory.

  For bitcoind, this leads to a very confusing error message:
  ```
  $ ./src/bitcoin-cli restorewallet test123 ~/.bitcoin/regtest/wallets/regtest_wallet/wallet.dat
  error code: -1
  error message: filesystem error: in remove: Directory not empty ["/home/thestack/.bitcoin/wallets/test123"]
  ```

  Even worse, the GUI crashes in such a scenario:
  ```
  libc++abi: terminating with uncaught exception of type std::__1::__fs::filesystem::filesystem_error: filesystem error: in remove: Directory not empty ["/home/thestack/.bitcoin/wallets/foobar"]
  Abort trap (core dumped)
  ```

  Fix this by simply deleting the whole folder via `fs::remove_all`. With this, the expected error message appears both for the `restorewallet` RPC call and in the GUI (as a message-box):

  ```
  $ ./src/bitcoin-cli restorewallet test123 ~/.bitcoin/regtest/wallets/regtest_wallet/wallet.dat
  error code: -4
  error message:
  Wallet loading failed. Wallet files should not be reused across chains. Restart bitcoind with -walletcrosschain to override.
  ```

ACKs for top commit:
  achow101:
    ACK 21ad4e26ec
  aureleoules:
    ACK 21ad4e26ec
  furszy:
    utACK 21ad4e26

Tree-SHA512: 313f6494c2fbe823bff9b975cb2d9410bb518977a1e59a5159ee9836bc012947fa50b56be0e41b1a2f50d9c0c7f4fddfdf4fbe479d8a59a6ee44bb389c804abc
2023-01-04 17:46:37 -05:00
Andrew Chow
cabeae43ea
Merge bitcoin/bitcoin#26809: compat: use STDIN_FILENO over 0
585c672212 compat: use STDIN_FILENO over 0 (fanquake)

Pull request description:

  This is already used throughout this file, and is self-documenting.

ACKs for top commit:
  john-moffett:
    ACK 585c672212
  achow101:
    ACK 585c672212
  hebasto:
    ACK 585c672212, I have reviewed the code and it looks OK, I agree it can be merged.
  kristapsk:
    utACK 585c672212
  aureleoules:
    ACK 585c672212

Tree-SHA512: c0114ae896ba5404be70b804ee9f454d213f1d789c8f5a578c422dd15a308a214e6851fee76c0ec736a212bc86fb33ec17af1b22e5d23422c375ca4458251356
2023-01-04 17:30:47 -05:00
glozow
196a43eddb
Merge bitcoin/bitcoin#26603: doc: CalculateSequenceLocks: prevHeights entries are set to 0, not removed
f537127271 doc: fix: prevHeights entries are set to 0, not removed (stickies-v)

Pull request description:

  In [`CalculateSequenceLocks`](a035b6a0c4/src/consensus/tx_verify.h (L69)) no items are removed from `prevHeights`, they are just set to 0:

  a035b6a0c4/src/consensus/tx_verify.cpp (L69-L73)

  This PR updates the docs to reflect the actual implementation. Seems to have been wrongly documented since introduction in #7184 already ([implementation](https://github.com/bitcoin/bitcoin/pull/7184/files#diff-34d21af3c614ea3cee120df276c9c4ae95053830d7f1d3deaf009a4625409ad2R742-R749) and [documentation](https://github.com/bitcoin/bitcoin/pull/7184/files#diff-34d21af3c614ea3cee120df276c9c4ae95053830d7f1d3deaf009a4625409ad2R712-R713))

ACKs for top commit:
  hebasto:
    ACK f537127271

Tree-SHA512: 3661501660f6832b2116fd83466ffe95a60b341c14cb09a37489e2a587bea3290b0528690120a0f644c3eea02177aa1fb8968258482fa43b0303e016abb17418
2023-01-04 18:07:31 +00:00
glozow
65ecf24b5c
Merge bitcoin/bitcoin#26752: wallet: Remove mempool_sequence from interface methods
55696a0ac3 wallet: remove `mempool_sequence` from `transactionRemovedFromMempool` (w0xlt)
bf19069c53 wallet: remove `mempool_sequence` from `transactionAddedToMempool` (w0xlt)

Pull request description:

  This PR removes `mempool_sequence` from `transactionRemovedFromMempool` and `transactionAddedToMempool`.

  `mempool_sequence` is  not used in these methods, only in ZMQ notifications.

ACKs for top commit:
  instagibbs:
    ACK 55696a0ac3

Tree-SHA512: 621e89230bcb6edfed83e2758601a2b093822fc2dc4e9bfb00487e340f2bc4c5ac3bf6df3ca00b7fe55bb3df15858820f2bf698f403d2e48b915dd9eb47b63e0
2023-01-04 17:53:58 +00:00
Andrew Chow
a273241480
Merge bitcoin/bitcoin#26020: test: Change coinselection parameter location to make tests independent
b942c94d15 test: Change coinselection parameter location to make tests independent (yancy)

Pull request description:

  the `subtract_fee_outputs` param is expected to be `true` for all subsequent tests.  It should be defined outside of a single test so that if it's removed or changed, all subsequent tests won't fail.  Currently if you remove this [test](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/test/coinselector_tests.cpp#L304:L325) the following [test](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/test/coinselector_tests.cpp#L327:L345) fails.  This change makes the tests independent.

ACKs for top commit:
  achow101:
    ACK b942c94d15
  aureleoules:
    ACK b942c94d15.
  rajarshimaitra:
    tACK b942c94d15
  theStack:
    ACK b942c94d15

Tree-SHA512: 461e19d15351318102ef9f96c68442365d8ca238c48ad7aefe23e8532b33b91dadf6c7840c7894574bccede6da162a55ad7a6f6a330d61a11ce804e68ddc5e9c
2023-01-04 12:41:47 -05:00
Andrew Chow
139ba2bf12
Merge bitcoin/bitcoin#25234: bench: add benchmark for wallet 'AvailableCoins' function.
3a4f8bc242 bench: add benchmark for wallet 'AvailableCoins' function. (furszy)

Pull request description:

  #### Rationale

  `AvailableCoins` is part of several important flows for the wallet; from RPC commands that create transactions like `fundrawtransaction`, `send`, `walletcreatefundedpsbt`, get the available balance, list the available coins with `listunspent` etc. to GUI connected processes that perform the same or similar actions: tx creation, available balance calculation, present the spendable coins in the coin control dialog.

  As we are improving this process in #24699, #25005 and there are more structural changes coming on the way. This benchmark aims to ensure us that, at least, there are no regressions (obviously performance improvements are great but, at least for me, this heads into the direction of having a base metric to compare future structural changes).

  #### Implementation Notes

  There are 5 new benchmarks, one per wallet supported output type (LEGACY, P2SH_SEGWIT, BECH32, BECH32M), plus a multi-output-type wallet benchmark which contains outputs from all the descriptor types.

  The test, by default, fills-up the wallet with 1k transactions, 2k outputs. Mainly to not consume much time if the user just want to verify that no substantial regressions were introduced. But, my expectation for those who are focused on this process is to use a much higher number locally to really note the differences across commits.

ACKs for top commit:
  achow101:
    ACK 3a4f8bc242
  hernanmarino:
    ACK 3a4f8bc242
  aureleoules:
    ACK 3a4f8bc242

Tree-SHA512: d0bb4c165f1efa181b47cb31561e6217eff9135bcd1b6761a7292f9018e456d13d18a1b886c2e2268d35c52f9e1fd8e0f252972424e5c5f00c280620b79c5a1b
2023-01-04 12:11:44 -05:00
MarcoFalke
bf3b589413
Merge bitcoin/bitcoin#26791: ci: Properly set COMMIT_RANGE in lint task
fa5cbf2290 ci: Properly set COMMIT_RANGE in lint task (MarcoFalke)

Pull request description:

  Currently the variable holds (apart from the commits in the pull request) all commits to master since the pull was opened.

  This is problematic, because already merged commits are linted in unrelated pulls, leading to:

  * Wasted resources. For example, currently the lint task may take 9 minutes, when it should take 1. See https://cirrus-ci.com/task/6032782770569216?logs=lint#L1449
  * False failures. For example, when a "wrong" commit is in master it can lead to some pulls failing unrelatedly, and others not.

  Now that the CI has the `/merge` commit (since commit fad7281d78), `COMMIT_RANGE` can simply be set to `HEAD~..HEAD` to only hold the changes in the pull.

ACKs for top commit:
  fanquake:
    ACK fa5cbf2290

Tree-SHA512: e85fca4ca9d2615ddd2544403485e06885769a3f70bca297e23eefda2a1d28f47c5271f6adfa6ce0e5e972335c78098b76e0db4b109f59d0986bf508cef7528f
2023-01-04 13:56:45 +01:00
MarcoFalke
4bb840a453
Merge bitcoin/bitcoin#26802: test: Use same Python executable for subprocesses as for all-lint.py
f6eadaa413 Use same Python executable for subprocesses as for all-lint.py (Kristaps Kaupe)

Pull request description:

  Before this all linters were ran by `/usr/bin/env python3`, no matter what was used to run `test/lint/all-lint.py`. This change allows to use non-default Python executable for `test/lint/all-lint.py` and then all subprocesses will also use same Python interpreter (for example, `python3.10 ./test/lint/all-lint.py`). See https://github.com/bitcoin/bitcoin/issues/26792#issuecomment-1369558866 as use case.

ACKs for top commit:
  fanquake:
    ACK f6eadaa413 - did not test

Tree-SHA512: 4da3b5581a0dd8ab9a6387829495019091a93a7ceaf2135d65d40a1983fd11a0b92b20891ef30d2a132abb0a690cd9b2f7eb5fcc38df06a340394ef449d640af
2023-01-04 13:53:27 +01:00
fanquake
585c672212
compat: use STDIN_FILENO over 0
This is already used throughout this file, and is self-documenting.
2023-01-04 12:00:25 +00:00
fanquake
2ec97825e7
Merge bitcoin/bitcoin#26771: doc: Correct linked Microsoft URLs
f84e445dee doc: Correct linked Microsoft URLs (Suriyaa Sundararuban)

Pull request description:

  Update Microsoft-related links.

Top commit has no ACKs.

Tree-SHA512: 40c7b25a96772259fb04da1946d52f6aac9562262aef472ae75807bfbd246de47d72118140a12f7553037b94b89f95d69dea6ce30e611ac3d71a32d102355150
2023-01-04 11:40:56 +00:00
fanquake
4717a5aa31
Merge bitcoin/bitcoin#26772: contrib: fix sha256 check in install_db4.sh for FreeBSD
22e9afe40d use sha256 command instead of sha256sum on FreeBSD (Murray Nesbitt)

Pull request description:

  The FreeBSD version of `sha256sum` takes different arguments than the GNU version.

  The `sha256_check` function in `contrib/install_db4.sh` has code specific to FreeBSD, however it doesn't get reached because while the `sha256sum` command does exist on FreeBSD, it is incompatible and results in an error:

  ```
  sha256sum: option requires an argument -- c
  usage: sha256sum [-pqrtx] [-c file] [-s string] [files ...]
  ```

  This change moves the FreeBSD-specific code before the check for the `sha256sum` command.

  Fixes: #26774

Top commit has no ACKs.

Tree-SHA512: 2485e2e7d8fdca3b072b29fb22bbdfd69e520740537b331b33c64cc645b63da712cfa63a23bdf039bbc92a6558fc7bf03323a51784bf601ff360ff0ef59506c8
2023-01-04 10:24:00 +00:00
MarcoFalke
53653060c1
Merge bitcoin/bitcoin#26795: rpc: Correct RPCHelpMan for fundrawtransaction's input_weights field
927b8d4e0c rpc: Correct RPCHelpMan for fundrawtransaction's input_weights field (jdjkelly@gmail.com)

Pull request description:

  `input_weights` is incorrectly documented as a fixed length JSON array, but it is actually a JSON array of JSON objects - this commit changes `input_weights` to use `RPCArg::Type::OBJ`

  The behavior of `input_weights` as an object exists as a functional test in [wallet_fundrawtransaction.py](https://github.com/bitcoin/bitcoin/blob/master/test/functional/wallet_fundrawtransaction.py).

ACKs for top commit:
  achow101:
    ACK 927b8d4e0c

Tree-SHA512: 384f5e16be36dba670d64d96f16f1fde2d0d51357e1094ae13eb71d004af0f4dc8bac965b4d2d724ccf64fb671faad37b73055152a9882af24f65dfceaf1e5fb
2023-01-04 11:09:57 +01:00
glozow
03254c2229
Merge bitcoin/bitcoin#19909: refactor: Remove unused CTxMemPool::clear() helper
fa818e103c txmempool: Remove unused clear() member function (MarcoFalke)

Pull request description:

  Seems odd to have code in Bitcoin Core that is unused.

  Moreover the function was broken (see https://github.com/bitcoin/bitcoin/pull/24145) and is brittle, as there is nothing that prevents similar bugs from re-appearing.

  Fix both issues by replacing it with C++11 member initializers.

ACKs for top commit:
  glozow:
    ACK fa818e103c

Tree-SHA512: e79e44cac7d5a84d9ecc8e3f3b0b9a50e1e3ebec358b20ba5dac175ef07d1fbe338a20f83ee80f746f7c726c79e77f8be49e14bca57a41063da8a5302123c3a9
2023-01-04 08:44:26 +00:00
Pasta
f2fc03ec85
refactor: use braced init for integer constants instead of c style casts 2023-01-03 19:31:29 -06:00
Andrew Chow
3f8591d46b
Merge bitcoin/bitcoin#26661: wallet: Coin Selection, return accurate error messages
76dc547ee7 gui: create tx, launch error dialog if backend throws runtime_error (furszy)
f4d79477ff wallet: coin selection, add duplicated inputs checks (furszy)
0aa065b14e wallet: return accurate error messages from Coin Selection (furszy)
7e8340ab1a wallet: make SelectCoins flow return util::Result (furszy)
e5e147fe97 wallet: refactor eight consecutive 'AttemptSelection' calls into a loop (furszy)

Pull request description:

  Work decoupled from #25806, which cleanup and improves the Coin Selection flow further.

  Adding the capability to propagate specific error messages from the Coin Selection process to the user.
  Instead of always returning the general "Insufficient funds" message which is not always accurate to what happened internally.
  Letting us instruct the user how to proceed under certain circumstances.

  The following error messages were added:

  1) If the selection result exceeds the maximum transaction weight,
     we now will return:
  -> "The inputs size exceeds the maximum weight. Please try sending
  a smaller amount or manually consolidating your wallet's UTXOs".

  2) If the user pre-selected inputs and disallowed the automatic coin
     selection process (no other inputs are allowed), we now will
     return:
  -> "The preselected coins total amount does not cover the transaction
  target. Please allow other inputs to be automatically selected or include
  more coins manually".

  3) The double-counted preset inputs during Coin Selection error will now
  throw an "internal bug detected" message instead of crashing the node.

  The essence of this work comes from several comments:
  1. https://github.com/bitcoin/bitcoin/pull/26560#discussion_r1037395665
  2. https://github.com/bitcoin/bitcoin/pull/25729#discussion_r940619491
  3. https://github.com/bitcoin/bitcoin/pull/25269#pullrequestreview-1135240825
  4. https://github.com/bitcoin/bitcoin/issues/23144 (which is connected to #24845)

ACKs for top commit:
  ishaanam:
    crACK 76dc547ee7
  achow101:
    ACK 76dc547ee7
  aureleoules:
    ACK 76dc547ee7
  theStack:
    ACK 76dc547ee7 🌇

Tree-SHA512: 9de30792d7a5849cae77747aa978e70390b66ee9d082779a56088a024f82e725b0af050e6603aece0ac8229f6d73bc471ba97b4ab69dc7eddf419f5f56ae89a5
2023-01-03 18:53:36 -05:00
Sebastian Falbesoner
21ad4e26ec test: add coverage for cross-chain wallet restore 2023-01-04 00:06:05 +01:00
Andrew Chow
80fc1af096
Merge bitcoin/bitcoin#26289: Use util::Result in for calculating mempool ancestors
47c4b1f52a mempool: log/halt when CalculateMemPoolAncestors fails unexpectedly (stickies-v)
5481f65849 mempool: add AssumeCalculateMemPoolAncestors helper function (stickies-v)
f911bdfff9 mempool: use util::Result for CalculateMemPoolAncestors (stickies-v)
66e028f739 mempool: use util::Result for CalculateAncestorsAndCheckLimits (stickies-v)

Pull request description:

  Upon reviewing the documentation for `CTxMemPool::CalculateMemPoolAncestors`, I noticed `setAncestors` was meant to be an `out` parameter but actually is an `in,out` parameter, as can be observed by adding `assert(setAncestors.empty());` as the first line in the function and running `make check`. This PR fixes this unexpected behaviour and introduces refactoring improvements to make intents and effects of the code more clear.

  ## Unexpected behaviour
  This behaviour occurs only in the package acceptance path, currently only triggered by `testmempoolaccept` and `submitpackage` RPCs.

  In `MemPoolAccept::AcceptMultipleTransactions()`, we first call `PreChecks()` and then `SubmitPackage()` with the same `Workspace ws` reference. `PreChecks` leaves `ws.m_ancestors` in a potentially non-empty state, before it is passed on to `MemPoolAccept::SubmitPackage`. `SubmitPackage` is the only place where `setAncestors` isn't guaranteed to be empty before calling `CalculateMemPoolAncestors`. The most straightforward fix is to just forcefully clear `setAncestors` at the beginning of CalculateMemPoolAncestors, which is done in the first bugfix commit.

  ## Improvements
  ### Return value instead of out-parameters
  This PR updates the function signatures for `CTxMemPool::CalculateMemPoolAncestors` and `CTxMemPool::CalculateAncestorsAndCheckLimits` to use a `util::Result` return type and eliminate both the `setAncestors` `in,out`-parameter as well as the error string. It simplifies the code and makes the intent and effects more explicit.

  ### Observability
  There are 7 instances where we currently call `CalculateMemPoolAncestors` without actually checking if the function succeeded because we assume that it can't fail, such as in [miner.cpp](69b10212ea/src/node/miner.cpp (L399)). This PR adds a new wrapper `AssumeCalculateMemPoolAncestors` function that logs such unexpected failures, or in case of debug builds even halts the program. It's not crucial to the objective, more of an observability improvement that seems sensible to add on here.

ACKs for top commit:
  achow101:
    ACK 47c4b1f52a
  w0xlt:
    ACK 47c4b1f52a
  glozow:
    ACK 47c4b1f52a
  furszy:
    light code review ACK 47c4b1f5
  aureleoules:
    ACK 47c4b1f52a

Tree-SHA512: d908dad00d1a5645eb865c4877cc0bae74b9cd3332a3641eb4a285431aef119f9fc78172d38b55c592168a73dae83242e6af3348815f7b37cbe2d448a3a58648
2023-01-03 16:30:55 -05:00
Kristaps Kaupe
f6eadaa413
Use same Python executable for subprocesses as for all-lint.py 2023-01-03 23:23:07 +02:00
MarcoFalke
f301bf52ab
Merge bitcoin/bitcoin#26257: script, test: python linter flake8 E275 fixup, update dependencies
1e5e87cec3 script: update python linter dependencies (Jon Atack)
459cb637ac script, test: fix python linter E275 errors with flake8 5.0.4 (Jon Atack)

Pull request description:

  It is helpful to be able to run the python linter locally to review PRs and check local diffs and work.  Fix the errors raised by `./test/lint/lint-python.py` when run locally with flake8 5.0.4, which enforces rule E275 more strictly than previous versions, and update our python linter CI dependencies.

ACKs for top commit:
  kristapsk:
    ACK 1e5e87cec3

Tree-SHA512: c7da09396144b9fed4ce6405c0763b2e3e5651d49a5220b053da465aceca09f754fb70a8ab9647278ce2028dde803bea461a3cd93fb39868ead39d06187cd8af
2023-01-03 22:08:52 +01:00
Jon Atack
1e5e87cec3 script: update python linter dependencies 2023-01-03 11:05:09 -08:00
Jon Atack
459cb637ac script, test: fix python linter E275 errors with flake8 5.0.4 2023-01-03 10:59:56 -08:00
Andrew Chow
cb552c5f21
Merge bitcoin/bitcoin#26192: rpc: Improve error when wallet is already loaded
04609284ad rpc: Improve error when wallet is already loaded (Aurèle Oulès)

Pull request description:

  Currently, trying to load a descriptor (sqlite) wallet that is already loaded throws the following error:
  > error code: -4
  > error message:
  > Wallet file verification failed. SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another instance of Bitcoin Core?

  I don't think it is very clear what it means for a user.

  While a legacy wallet would throw:
  > error code: -35
  > error message:
  > Wallet file verification failed. Refusing to load database. Data file '/home/user/.bitcoin/signet/wallets/test_wallet/wallet.dat' is already loaded.

  This PR changes the error message for both types of wallet to:
  > error code: -35
  > error message:
  > Wallet file verification failed. Wallet "test_wallet" is already loaded.

ACKs for top commit:
  achow101:
    ACK 04609284ad
  hernanmarino:
    ACK  0460928
  theStack:
    Tested ACK 04609284ad

Tree-SHA512: a8f3d5133bfaef7417a6c05d160910ea08f32ac62bfdf7f5ec305ff5b62e9113b55f385abab4d5a4ad711aabcb1eb7ef746eb41f841b196e8fb5393ab3ccc01e
2023-01-03 13:02:20 -05:00
Andrew Chow
65d7c31b3f
Merge bitcoin/bitcoin#25789: test: clean and extend availablecoins_tests coverage
9622fe64b8 test: move coins result test to wallet_tests.cpp (furszy)
f69347d058 test: extend and simplify availablecoins_tests (furszy)
212ccdf2c2 wallet: AvailableCoins, add arg to include/skip locked coins (furszy)

Pull request description:

  Negative PR with extended test coverage :).

  1) Cleaned duplicated code and added coverage for the 'AvailableCoins' incremental result.

  2) The class `AvailableCoinsTestingSetup` inside `availablecoins_tests.cpp` is a plain copy
  of `ListCoinsTestingSetup` that is inside `wallet_tests.cpp`.

      So, deleted the file and moved the `BasicOutputTypesTest` test case to `wallet_tests.cpp`.

  3) Added arg to include/skip locked coins from the `AvailableCoins` result. This is needed for point (1) as otherwise the wallet will spend the coins that we recently created due its closeness to the recipient amount.
  Note: this last point comes from #25659 where I'm using the same functionality to clean/speedup another flow as well.

ACKs for top commit:
  achow101:
    ACK 9622fe64b8
  theStack:
    ACK 9622fe64b8
  aureleoules:
    reACK 9622fe64b8, nice cleanup!

Tree-SHA512: 1ed9133120bfe8815455d1ad317bb0ff96e11a0cc34ee8098716ab9b001749168fa649212b2fa14b330c1686cb1f29039ff1f88ae306db68881b0428c038f388
2023-01-03 12:52:40 -05:00
Andrew Chow
7bb07bf8bd
Merge bitcoin/bitcoin#25932: refactor: Simplify backtrack logic
81d4a2b14f refactor: Move feerate comparison invariant outside of the loop (yancy)
365aca4045 refactor: Simplify feerate comparison statement (yancy)

Pull request description:

  This is a small nit, however I think it's more understandable to write:

  `utxo_pool.at(0).fee > utxo_pool.at(0).long_term_fee`

  vs

  `(utxo_pool.at(0).fee - utxo_pool.at(0).long_term_fee) > 0`

ACKs for top commit:
  Xekyo:
    ACK 81d4a2b14f
  achow101:
    ACK 81d4a2b14f
  aureleoules:
    ACK 81d4a2b14f

Tree-SHA512: 3e89377989c36716b53114fe40178261671dde5688075fab1c21ec173ac310f8c84ed6af90354d7c329176cb7262dfcaa7191fd19847d3b7147a9a10c3e31176
2023-01-03 12:26:19 -05:00
Andrew Chow
1e6b384d59
Merge bitcoin/bitcoin#26702: refactor: walletdb: drop unused FindWalletTx parameter and rename
f496528556 walletdb: refactor: drop unused `FindWalletTx` parameter and rename (Sebastian Falbesoner)

Pull request description:

  Since commit 3340dbadd3 ("Remove -zapwallettxes"), the `FindWalletTx` helper is only needed to read tx hashes, so drop the other parameter and rename the method accordingly.

ACKs for top commit:
  S3RK:
    code review ACK f496528556
  achow101:
    ACK f496528556
  vincenzopalazzo:
    ACK f496528556

Tree-SHA512: ead85bc724462f9e920f9d7fe89679931361187579ffd6e63427c8bf5305cd5f71da24ed84f3b1bd22a12be46b5abec13f11822e71a3e1a63bf6cf49de950ab5
2023-01-03 11:54:51 -05:00
jdjkelly@gmail.com
927b8d4e0c
rpc: Correct RPCHelpMan for fundrawtransaction's input_weights field
input_weights is incorrectly documented as a fixed length JSON array,
but it is actually a JSON array of JSON objects - this commit changes
input_weights to use RPCArg::Type::OBJ
2023-01-02 14:31:49 -05:00
MarcoFalke
fa5cbf2290
ci: Properly set COMMIT_RANGE in lint task 2023-01-02 14:05:23 +01:00
MarcoFalke
d8bdee0fc8
Merge bitcoin/bitcoin#26775: ci: Revert tsan task changes
fabb6af850 ci: Remove duplicate CC and CXX from tsan task (MarcoFalke)
fa5d9a0e24 Revert "ci: Use clang-15 in tsan task" (MarcoFalke)
faa835e7e5 Revert "test: Drop no longer needed `race:epoll_ctl` TSan suppression" (MarcoFalke)

Pull request description:

  Looks like there are still bugs in clang-15, so we need to roll back all the way to the previously used version (clang-13).

ACKs for top commit:
  hebasto:
    ACK fabb6af850, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: d62203049847ab9095ee3fc89e18bdd721d1d9d5a7ef7a9f524c80e6be58d1d9f6aa2f14533df1ea77eb59597fba6fa9b987b17eb03b2c3f7cb577ab59cd59c0
2023-01-01 10:26:02 +01:00
Suriyaa Sundararuban
f84e445dee
doc: Correct linked Microsoft URLs 2022-12-31 16:54:13 +01:00
MarcoFalke
8575d5d842
Merge bitcoin/bitcoin#26777: rpc: Remove duplicate field in RPCHelpMan for gettransactions
090ad51c80 rpc: Remove duplicate field in RPCHelpMan for gettransactions (Joshua Kelly)

Pull request description:

  The field 'comment' appears twice in `TransactionDescriptionString`, incorrectly - this commit removes the instance of the comment field without a description, preserving the one with a description.

  On master, the duplicate fields can be be viewed here: https://github.com/bitcoin/bitcoin/blob/master/src/wallet/rpc/transactions.cpp#L419-L423

  `TransactionDescriptionString` is included in RPC calls such as `listtransactions` which have functional tests.

ACKs for top commit:
  w0xlt:
    ACK 090ad51c80

Tree-SHA512: 4bacdafdb517dda2af6d1c193f331b634ae74bd62ac6289c0c288957f39f98a73d07aeab72fbe5bf1ece5532406d4a40a5b8a2277be50115f76c92bb938e21fa
2022-12-31 13:40:05 +01:00
Joshua Kelly
090ad51c80
rpc: Remove duplicate field in RPCHelpMan for gettransactions
The field 'comment' appears twice in TransactionDescriptionString,
incorrectly - this commit removes the instance of the comment field
without a description, preserving the one with a description
2022-12-30 15:46:30 -05:00
MarcoFalke
fabb6af850
ci: Remove duplicate CC and CXX from tsan task 2022-12-30 09:50:22 +01:00
MarcoFalke
fa5d9a0e24
Revert "ci: Use clang-15 in tsan task"
This reverts commit faa00ca78e.
2022-12-30 09:49:51 +01:00
MarcoFalke
faa835e7e5
Revert "test: Drop no longer needed race:epoll_ctl TSan suppression"
This reverts commit a3f5e54152.
2022-12-30 09:47:52 +01:00
Murray Nesbitt
22e9afe40d use sha256 command instead of sha256sum on FreeBSD 2022-12-29 22:23:44 -08:00
MarcoFalke
65de8eeeca
Merge bitcoin/bitcoin#26770: ci: Move --enable-c++20 from "tidy" task back to "ASan..." one
afc6052430 ci: Move `--enable-c++20` from "tidy" task back to "ASan..." one (Hennadii Stepanov)

Pull request description:

  This PR reverts cc7335edc8 from https://github.com/bitcoin/bitcoin/pull/25528 partially.

  C++20 has introduced some new headers, and it is premature to consider them when using the IWYU tool.

  Required for https://github.com/bitcoin/bitcoin/pull/26763 and https://github.com/bitcoin/bitcoin/pull/26766.

  Related discussions:
  - https://github.com/bitcoin/bitcoin/pull/25528#discussion_r1058906785
  - https://github.com/bitcoin/bitcoin/pull/26763#discussion_r1058860943

ACKs for top commit:
  MarcoFalke:
    review only ACK afc6052430

Tree-SHA512: 9c1d3317d0f7a94d46d1e442da1a91669cd9ed1e62a41579edc96e1f5447551b536d32eeb222caf277e85228482753be545e0a874208cb24f9a8491fce3b6d9f
2022-12-29 20:49:21 +01:00
MarcoFalke
e9e2e87c85
Merge bitcoin/bitcoin#26768: ci: Use clang-15 in tsan task
faa00ca78e ci: Use clang-15 in tsan task (MarcoFalke)

Pull request description:

  Generally it is best to use the latest clang version for sanitizers, because it comes with the most features and bugfixes.

  So bump to clang-15, the latest release, for the tsan task.

  The task was using clang-13 (instead of 14) due to a bug, see https://github.com/bitcoin/bitcoin/pull/24572#issue-1169970859. Bumping to 15 will hopefully fix this bug, as well as https://github.com/bitcoin/bitcoin/pull/26759#issuecomment-1367360491

ACKs for top commit:
  hebasto:
    ACK faa00ca78e

Tree-SHA512: adb2386bb9615a3e1185e0624b0b68cd2738309530185819714a26e63bdf1c79461c4b4d3aa9cbe2fe08cc412349d7453f192abbbe9fb5adca74cf4b148ae7b7
2022-12-29 20:27:07 +01:00
Hennadii Stepanov
afc6052430
ci: Move --enable-c++20 from "tidy" task back to "ASan..." one
This change reverts cc7335edc8 partially.

C++20 has introduced some new headers, and it is premature to consider
them when using the IWYU tool.
2022-12-29 18:39:00 +00:00
MarcoFalke
faa00ca78e
ci: Use clang-15 in tsan task 2022-12-29 16:30:13 +01:00
MarcoFalke
3b6e0f0345
Merge bitcoin/bitcoin#26738: test: add coverage for unknown wallet flag in setwalletflag
3666a06730 test: add coverage for unknown wallet flag in `setwalletflag` (brunoerg)

Pull request description:

  This PR adds test coverage for the following error:
  6d40a1a7e7/src/wallet/rpc/wallet.cpp (L275-L277)

  https://marcofalke.github.io/btc_cov/total.coverage/src/wallet/rpc/wallet.cpp.gcov.html

ACKs for top commit:
  aureleoules:
    ACK 3666a06730

Tree-SHA512: b6b2415442dfbc2404aed9720cc899995686007d6ba222dae461d064e4454d5af1326d3d527770b51b1005721ac42a49972f1eabf21108f656c30d3584790747
2022-12-29 11:46:56 +01:00
MarcoFalke
b9028b2e26
Merge bitcoin/bitcoin#26481: bench: Suppress output when running with -sanity-check option
f1e89597c8 test: Drop no longer required bench output redirection (Hennadii Stepanov)
4dbcdf26a3 bench: Suppress output when running with `-sanity-check` option (Hennadii Stepanov)

Pull request description:

  This change allows to simplify CI tests, and makes it easier to integrate the `bench_bitcoin` binary into CMake custom [targets](https://cmake.org/cmake/help/latest/command/add_custom_target.html) or [commands](https://cmake.org/cmake/help/latest/command/add_custom_command.html), as `COMMAND` does not support output redirection.

ACKs for top commit:
  aureleoules:
    tACK f1e89597c8. Ran as expected and is more practical than using an output redirection.

Tree-SHA512: 29086d428cccedcfd031c0b4514213cbc1670e35f955e8fd35cee212bc6f9616cf9f20d0cb984495390c4ae2c50788ace616aea907d44e0d6a905b9dda1685d8
2022-12-29 11:42:03 +01:00
MarcoFalke
4654506c30
Merge bitcoin/bitcoin#26759: test: Drop no longer needed race:epoll_ctl TSan suppression
a3f5e54152 test: Drop no longer needed `race:epoll_ctl` TSan suppression (Hennadii Stepanov)

Pull request description:

  The removed suppression seems no needed.

  I cannot point the exact commit/PR which makes this change possible.

Top commit has no ACKs.

Tree-SHA512: 8ee79cbdb2bc62796d72c69be4a818379132eae47be33951e8b9d224b049ff77e867004801c7cb0cc564a5374f318dafd9142b5231e9bd428f80acc75253933e
2022-12-28 18:02:50 +01:00
Sebastian Falbesoner
730e14a317 test: wallet: check that labels are migrated to watchonly wallet 2022-12-28 13:51:08 +01:00
Sebastian Falbesoner
d5f4ae7fac wallet: fully migrate address book entries for watchonly/solvable wallets
Currently `migratewallet` migrates the address book (i.e. labels and
purposes) for watchonly and solvable wallets only in RAM, but doesn't
persist them on disk. Fix this by adding another loop for both of the
special wallet types after which writes the corresponding NAME and
PURPOSE entries to the database in a single batch.
2022-12-28 13:44:22 +01:00