Commit Graph

36192 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Hennadii Stepanov
a3f5e54152
test: Drop no longer needed race:epoll_ctl TSan suppression 2022-12-27 18:33:34 +00:00
MarcoFalke
e9262ea32a
Merge bitcoin/bitcoin#26750: Insert and bump copyright headers
3ae76ea6dd scripted-diff: Insert missed copyright header (Hennadii Stepanov)
306ccd4927 scripted-diff: Bump copyright headers (Hennadii Stepanov)

Pull request description:

  This PR bumps the existing copyright headers, as we did every year, and adds a missed one.

Top commit has no ACKs.

Tree-SHA512: 5f6b02e2baad21750e3dd8f0612bb6e7e2cfa6a743c669f26baf5a39c168b2d3a92afae1ce2dad59b70492175186c38f172c4ee68fc7ac87a4d85330429ca054
2022-12-25 10:50:16 +01:00
MarcoFalke
06dd571534
Merge bitcoin/bitcoin#26748: doc: Update license year range to 2023
e9abb13ecb doc: Update license year range to 2023 (Suriyaa Sundararuban)

Pull request description:

  See https://github.com/bitcoin/bitcoin/pull/23945, https://github.com/bitcoin/bitcoin/pull/20805, https://github.com/bitcoin/bitcoin/pull/17801, https://github.com/bitcoin/bitcoin/pull/15061
  The same procedure as every year. Happy new year to all of you! 😄

Top commit has no ACKs.

Tree-SHA512: 2c80ae41a827e3fa6980a4406ed3518238f953465d7672b730a77c121cee6758c7cc1aa615ce9b988019aacb253c681dcc3c312bd982366de7038a0200d27bc4
2022-12-25 10:45:54 +01:00
Hennadii Stepanov
3ae76ea6dd
scripted-diff: Insert missed copyright header
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py insert src/policy/fees_args.cpp
-END VERIFY SCRIPT-
2022-12-24 23:59:12 +00:00
Hennadii Stepanov
306ccd4927
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-

Commits of previous years:
- 2021: f47dda2c58
- 2020: fa0074e2d8
- 2019: aaaaad6ac9
2022-12-24 23:49:50 +00:00
Suriyaa Sundararuban
e9abb13ecb
doc: Update license year range to 2023 2022-12-24 11:40:16 +01:00
furszy
76dc547ee7
gui: create tx, launch error dialog if backend throws runtime_error
only will ever happen if something unexpected happened.
2022-12-21 23:20:17 -03:00
furszy
f4d79477ff
wallet: coin selection, add duplicated inputs checks
As no process should be able to trigger this error
using the regular transaction creation process, throw
a runtime_error if happens to tell users/devs to
report the bug if happens.
2022-12-21 23:20:16 -03:00
furszy
0aa065b14e
wallet: return accurate error messages from Coin Selection
and not the general "Insufficient funds" when the wallet
actually have funds.

Two new error messages:

1) If the selection result exceeds the maximum transaction weight,
   we now will return: "The inputs size exceeds the maximum weight".

2) If the user preselected 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".
2022-12-21 23:14:50 -03:00
furszy
7e8340ab1a
wallet: make SelectCoins flow return util::Result 2022-12-21 23:14:50 -03:00
furszy
e5e147fe97
wallet: refactor eight consecutive 'AttemptSelection' calls into a loop
and remove 'CoinEligibilityFilter' default constructor to prevent
mistakes.
2022-12-21 23:14:50 -03:00
Andrew Chow
f3bc1a7282
Merge bitcoin/bitcoin#26265: POLICY: Relax MIN_STANDARD_TX_NONWITNESS_SIZE to 65 non-witness bytes
b2aa9e8528 Add release note for MIN_STANDARD_TX_NONWITNESS_SIZE relaxation (Greg Sanders)
8c5b3646b5 Relax MIN_STANDARD_TX_NONWITNESS_SIZE to 65 non-witness bytes (Greg Sanders)

Pull request description:

  Since the original fix was set to be a "reasonable" transaction to reduce allocations and the true motivation later revealed, it makes sense to relax this check to something more principled.

  There are more exotic transaction patterns that could take advantage of a relaxed requirement, such as 1 input, 1 output OP_RETURN to burn a utxo to fees for CPFP purposes when change isn't practical.

  Two changes could be accomplished:

  1) Anything not 64 bytes could be allowed

  2) Anything above 64 bytes could be allowed

  In the Great Consensus Cleanup, suggestion (2)
  was proposed as a consensus change, and is the simpler of the two suggestions. It would not allow an "empty" OP_RETURN but would reduce the required padding from 22 bytes to 5.

  The functional test is also modified to test the actual case
  we care about: 64 bytes

  Related mailing list discussions here:
  https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-October/020995.html
  And a couple years earlier:
  https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-May/017883.html

ACKs for top commit:
  achow101:
    reACK b2aa9e8528
  glozow:
    reACK b2aa9e8528
  pablomartin4btc:
    re-ACK b2aa9e8528
  jonatack:
    ACK b2aa9e8528 with some suggestions

Tree-SHA512: c1ec1af9ddcf31b2272209a4f1ee0c5607399f8172e5a1dfd4604cf98bfb933810dd9369a5917ad122add003327c9fcf6ee26995de3aca41d5c42dba527991ad
2022-12-21 12:58:46 -05:00
brunoerg
3666a06730 test: add coverage for unknown wallet flag in setwalletflag 2022-12-21 11:03:24 -03:00
MarcoFalke
6d40a1a7e7
Merge bitcoin/bitcoin#26694: test: get_previous_releases.py: M1/M2 macs can't run unsigned arm64 binaries; self-sign when needed
dc12f2e212 test: improve error msg on previous release tarball extraction failure (kdmukai)
7121fd8fa7 test: self-sign previous release binaries for arm64 macOS (kdmukai)

Pull request description:

  ## The Problem
  If you run `test/get_previous_releases.py -b` on an M1 or M2 mac, you'll get an unsigned v23.0 binary in the arm64 tarball. macOS [sets stricter requirements on ARM binaries](https://news.ycombinator.com/item?id=26996578) so the unsigned arm64 binary is apparently completely unusable without being signed/notarized(?).

  This means that any test that depends on a previous release (e.g. `wallet_backwards_compatibility.py`) will fail because the v23.0 node cannot launch:

  ```
  TestFramework (ERROR): Assertion failed
  Traceback (most recent call last):
    File "/Users/kdmukai/dev/bitcoin-core/test/functional/test_framework/test_framework.py", line 563, in start_nodes
      node.wait_for_rpc_connection()
    File "/Users/kdmukai/dev/bitcoin-core/test/functional/test_framework/test_node.py", line 231, in wait_for_rpc_connection
      raise FailedToStartError(self._node_msg(
  test_framework.test_node.FailedToStartError: [node 2] bitcoind exited with status -9 during initialization
  ```

  This can also be confirmed by downloading bitcoin-23.0-arm64-apple-darwin.tar.gz (https://bitcoincore.org/bin/bitcoin-core-23.0/) and trying to run any of the binaries manually on an M1 or M2 mac.

  ## Solution in this PR
  (UPDATED) Per @ hebasto, we can self-sign the arm64 binaries. This PR checks each binary in the previous release's "bin/" and verifies if the arm64 binary is signed. If not, attempt to self-sign and confirm success.

  (note: an earlier version of this PR downloaded the x86_64 binary as a workaround but this approach has been discarded)

  ## Longer term solution
  If possible, produce signed arm64 binaries in a future v23.x tarball?

  Note that this same problem affects the new v24.0.1 arm64 tarball so perhaps a signed v24.x.x tarball would also be ideal?

  That being said, this PR will check all current and future arm64 binaries and self-sign as needed, so perhaps we need not worry about pre-signing the tarball binaries. And I did test a version of `get_previous_releases.py` that includes the new v24.0.1 binaries and it successfully self-signed both v23.0 and v24.0.1, as expected.

  ## Further info:
  Somewhat related to: https://github.com/bitcoin/bitcoin/issues/15774#issuecomment-1265164753

  And @ fanquake noted on IRC that you can confirm which binaries are or are not signed via:
  ```
  $ codesign -v -d bitcoin-qt
  bitcoin-qt: code object is not signed at all
  ```

ACKs for top commit:
  hebasto:
    ACK dc12f2e212

Tree-SHA512: 644895f8e97f5ffb3c4754c1db2c48abd77fa100c2058e3c896af04806596fc2b9c807a3f3a2add5be53301ad40ca2b8171585bd254e691f6eb38714d938396b
2022-12-21 11:02:20 +01:00
fanquake
3e536ea9ac
Merge bitcoin/bitcoin#26683: ci: Use CONFIG_SITE variable and --prefix option properly
d3a84347e8 ci: remove --prefix from msan job (fanquake)
574e50addf ci: Use `CONFIG_SITE` variable and `--prefix` option properly (Hennadii Stepanov)

Pull request description:

  When running CI scripts locally, they attempt to use a `$DEPENDS_DIR/$HOST` directory even `NO_DEPENDS=1` is provided.

  This PR fixes this broken behavior.

Top commit has no ACKs.

Tree-SHA512: 5e83b921763e6d463e520bbee2ed1599e9f4de36668d19b23dd9d2d7e4441c415e275f588c585b72cadda8bfab5a938979acc1ee4963230aa47081785c741e98
2022-12-21 09:22:57 +00:00
fanquake
dd7d82bec0
Merge bitcoin/bitcoin#26734: doc: Fixup getrawtransaction RPC docs
97115de183 doc: Refactor/Format getrawtransaction RPC docs and add ScriptPubKeyDoc function (Douglas Chimento)

Pull request description:

  Added  `ScriptPubKeyDoc` function

ACKs for top commit:
  MarcoFalke:
    ACK 97115de183
  kristapsk:
    cr utACK 97115de183

Tree-SHA512: 1371375986177862e8c99923eb7f1800fef8da7a7ac9f0ec9037bf5b23681c3348d5afe913aab7457f029ee1774d160ac10d7f57238500a03c6385cc0c7013fc
2022-12-21 08:57:14 +00:00
MarcoFalke
4cd6b3b557
Merge bitcoin-core/gui#687: Load PSBTs using istreambuf_iterator rather than istream_iterator
bb5ea1d9a9 qt: Load PSBTs using istreambuf_iterator rather than istream_iterator (Andrew Chow)

Pull request description:

  `istream_iterator` eats whitespace charactesr which causes parsing failures for PSBTs that contain the bytes corresponding to those characters. `istreambuf_iterator` is the correct thing to use here.

  This is a regression in 24.0. https://github.com/bitcoin/bitcoin/pull/25001 accidentally changed the original `istreambuf_iterator` to `istream_iterator`.

ACKs for top commit:
  furszy:
    Tested ACK bb5ea1d9
  MarcoFalke:
    review ACK bb5ea1d9a9   🍇

Tree-SHA512: 35d90eee3efdcb6a360af69ac1727f9f2837ea621297196de3136299f5de6d9975df4e425e1fc5b8813c1ddb2a4d60c3969e1d5d968953a4628ca45e37d3bf05
2022-12-21 09:47:56 +01:00
MarcoFalke
0139a0d5c0
Merge bitcoin/bitcoin#26722: test: speed up the two slowest functional tests by 18-35% via keypoolrefill()
31fdc54dba test: speed up wallet_fundrawtransaction.py and wallet_sendall.py (kdmukai)

Pull request description:

  ## Problem
  `wallet_fundrawtransaction.py` and `wallet_sendall.py` are the two slowest functional tests *when running without a RAM disk*.
  ```
  # M1 MacBook Pro timings
  wallet_fundrawtransaction.py --descriptors   | ✓ Passed  | 55 s
  wallet_fundrawtransaction.py --legacy-wallet | ✓ Passed  | 381 s

  wallet_sendall.py --descriptors   | ✓ Passed  | 43 s
  wallet_sendall.py --legacy-wallet | ✓ Passed  | 327 s
  ```

  In each case, the majority of the time is spent iterating through 1500 to 1600 `getnewaddress()` calls. This is particularly slow in the `--legacy-wallet` runs.

  see:  https://github.com/bitcoin/bitcoin/blob/master/test/functional/wallet_fundrawtransaction.py#L986-L987
  see:  https://github.com/bitcoin/bitcoin/blob/master/test/functional/wallet_sendall.py#L324

  ## Solution
  Pre-fill the keypool before iterating through those `getnewaddress()` calls.

  With this change, the execution time drops to:
  ```
  wallet_fundrawtransaction.py --descriptors   | ✓ Passed  | 52 s     # -3s diff
  wallet_fundrawtransaction.py --legacy-wallet | ✓ Passed  | 291 s    # -90s diff

  wallet_sendall.py --descriptors   | ✓ Passed  | 27 s     # -16s diff
  wallet_sendall.py --legacy-wallet | ✓ Passed  | 228 s    # -99s diff
  ```

  ---

  Tagging @ Sjors as he had encouraged me to take a look at speeding up the tests.

ACKs for top commit:
  achow101:
    ACK 31fdc54dba

Tree-SHA512: e8dd89323551779832a407d068977c827c09dff55c1079d3c19aab39fcce6957df22b1da797ed7aa3bc2f6dd22fdf9e6f5e1a9a0200fdb16ed6042fc5f6dd992
2022-12-21 09:06:24 +01:00
Andrew Chow
8456bfac6b
Merge bitcoin/bitcoin#26638: test: prefer sqlite for wallet tests
17554efb60 test: prefer sqlite for wallet tests (S3RK)
8e0fabaabf test: make wallet_migration.py pass with both wallet flags (S3RK)

Pull request description:

  Fixes #26511

ACKs for top commit:
  MarcoFalke:
    review ACK 17554efb60
  achow101:
    ACK 17554efb60

Tree-SHA512: 97cae275998f07032feffe1b533d4747b8ff03c3c1fb830af69ee38cadb75fd58532956f66f79c0d275b00620ce53b0b5240f885e4f29b8bd4d0b6e6cbc683fa
2022-12-20 18:12:08 -05:00
Douglas Chimento
97115de183
doc: Refactor/Format getrawtransaction RPC docs and add ScriptPubKeyDoc function 2022-12-21 00:46:16 +02:00
Andrew Chow
cbcad79eef
Merge bitcoin/bitcoin#21576: rpc, gui: bumpfee signer support
2c07cfacd1 gui: bumpfee signer support (Sjors Provoost)
7e02a33297 rpc: bumpfee signer support (Sjors Provoost)
304ece9945 rpc: document bools in FillPSBT() calls (Sjors Provoost)

Pull request description:

  The `bumpfee` RPC call and GUI fee bump interface now work with an external signer.

ACKs for top commit:
  achow101:
    ACK 2c07cfacd1
  furszy:
    code review ACK 2c07cfac
  jarolrod:
    tACK 2c07cfa

Tree-SHA512: 0c7b931f76fac67c9e33b9b935f29af6f69ac67a5ffcc586ed2f1676feac427735b1d971723b29ef332bb6fb5762949598ebbf728587e8f0ded95a9bfbb3e7a4
2022-12-20 15:30:17 -05:00
Hennadii Stepanov
497f26552b
Merge bitcoin-core/gui#605: Delete splash screen widget early
1b228497fa qt: Drop no longer used `SplashScreen::finish()` slot (Hennadii Stepanov)
10811afff4 qt: Drop no longer used `BitcoinApplication::splashFinished()` signal (Hennadii Stepanov)
5299cfe371 qt: Delete splash screen widget explicitly (Hennadii Stepanov)

Pull request description:

  Fixes bitcoin-core/gui#604.
  Fixes bitcoin/bitcoin#25146.
  Fixes bitcoin/bitcoin#26340.

  `SplashScreen::deleteLater()` [does not guarantee](https://doc.qt.io/qt-5/qobject.html#deleteLater) deletion of the `m_splash` object prior to the wallet context deletion. If the latter happens first, the [segfault](https://github.com/bitcoin-core/gui/issues/604#issuecomment-1133907013) follows.

ACKs for top commit:
  dooglus:
    ACK 1b228497fa
  furszy:
    ACK 1b228497
  john-moffett:
    ACK 1b228497fa

Tree-SHA512: bb01d0bf2051f5b184dc415c4f5d32dfb7b8bd772feff7ec7754ded4c6482de27f004b9712df7d53c5ee82e153f48aef4372e4a49d7bcbbb137f73e9b4947962
2022-12-20 20:13:12 +00:00
fanquake
d3a84347e8
ci: remove --prefix from msan job 2022-12-20 17:17:35 +00:00