Commit graph

4600 commits

Author SHA1 Message Date
MacroFake
4381681e55
Merge bitcoin/bitcoin#25011: tests: Do not always create a descriptor wallet in wallet_createwallet
786b3a7c44 tests: Do not always create a descriptor wallet in wallet_createwallet (Andrew Chow)

Pull request description:

  The createwallet test for some invalid parameters incorrectly always creates a descriptor wallet. This is unnecessary and also breaks the test when bdb is not compiled in.

  Fixes #25007

ACKs for top commit:
  jacobpfickes:
    ACK 786b3a7c44

Tree-SHA512: 97b0953a08adf83d5ea84cac2651253d790b43d606a2f746dd45d3ccd1fb576bab63e3835e3de592715ef8a5cb133e6f19a3ab810fedf4684072143c3cb578d4
2022-04-28 07:41:22 +02:00
Andrew Chow
786b3a7c44 tests: Do not always create a descriptor wallet in wallet_createwallet
The createwallet teswt for some invalid parameters incorrectly always
creates a descriptor wallet. This is unnecessary and also breaks the
test when bdb is not compiled in.
2022-04-27 14:50:04 -04:00
MacroFake
f0a834e2f1
Merge bitcoin/bitcoin#18642: Use std::chrono for the time to rotate destination of addr messages + tests
2ff8f4dd81 Add tests for addr destination rotation (Gleb Naumenko)
77ccb7fce1 Use std::chrono for salting when randomizing ADDR destination (Gleb Naumenko)

Pull request description:

  We currently assign a destination peer for relaying particular addresses of nodes every 24 hours, and then rotate. This is done for rate-limiting (ultimately for privacy leak reduction I think?).

  Before this change, 24 hours was defined as uint. I replaced it with std::chrono, which is mockable and type-safe.

  Also added couple tests for this behavior.

ACKs for top commit:
  jonatack:
    ACK 2ff8f4dd81

Tree-SHA512: 16f703ef3ffee13ce3afa82ca7b4baa27308af18cd2eececdce5565badfb68656a2ad9c4594b73772e4bfa99b3fb15f8e4089c1cb4be98c0bae6730a9d2f8a25
2022-04-27 18:59:46 +02:00
MacroFake
f58c1f1a44
Merge bitcoin/bitcoin#24739: test: Fix intermittent test failure in wallet_listreceivedby.py
fa1f6df21e test: Fix intermittent test failure in wallet_listreceivedby.py (MarcoFalke)

Pull request description:

  * Remove not needed "Generate block to get out of IBD"
  * Sync blocks where possible to avoid incoming blocks on the p2p `msghand` thread while blocks are mined in the RPC thread. See https://github.com/bitcoin/bitcoin/issues/24730 for discussion.

Top commit has no ACKs.

Tree-SHA512: eca0242e7793886535555fec62f7acd4c0955bf26fab78725b4fe53f84f0b118cb12c9ee35627503fc68b83c3a228842e861fab89aab1226e08e18596357aaae
2022-04-27 08:44:21 +02:00
fanquake
34ae04d775
Merge bitcoin/bitcoin#21726: Improve Indices on pruned nodes via prune blockers
71c3f0356c move-only: Rename index + pruning functional test (Fabian Jahr)
de08932efa test: Update test for indices on pruned nodes (Fabian Jahr)
825d19839b Index: Allow coinstatsindex with pruning enabled (Fabian Jahr)
f08c9fb0c6 Index: Use prune locks for blockfilterindex (Fabian Jahr)
2561823531 blockstorage: Add prune locks to BlockManager (Fabian Jahr)
231fc7b035 refactor: Introduce GetFirstStoredBlock helper function (Fabian Jahr)

Pull request description:

  # Motivation
  The main motivation of this change and only behavior change noticeable by user is to allow running `coinstatsindex` on pruned nodes as has been requested [here for example](https://twitter.com/benthecarman/status/1388170854140452870?s=20).

  # Background
  `coinstatsindex` on pruned nodes can be enabled in a much simpler than it is done here but it comes with downside. The ability to run `blockfilterindex`on pruned nodes was added in #15946 but it also added the `blockfilterindex` as a dependency to `validation` and it introduced two new circular dependencies. Enabling `coinstatsindex` on pruned nodes in a similar way would add it as a dependency as well and introduce another circular dependency.

  Instead, this PR introduces a `m_prune_blockers` map to `BlockManager` as a flexible approach to block pruning. Entities like `blockfilterindex`, for example, can add a key and a height to block pruning over that height. These entities need to update that value to allow more pruning when they are ready.

  # Alternative approach
  Upon completing the first draft of this PR I found #19463 as an alternative that follows the same but follows a very different approach. I am listing the main differences here as I see them:
  - Usage of globals
  - Blocks pruning with a start and a stop height
  - Can persist blockers across restarts
  - Blockers can be set/unset via RPCs

  Personally, I don't think any of these are necessary to be added here but if the general approach or specific features are more appealing to reviewers I am happy to change to a solution based on that PR or port over specific parts of it here.

ACKs for top commit:
  mzumsande:
    Code review ACK 71c3f0356c
  ryanofsky:
    Code review ACK 71c3f0356c. Changes since last review: just tweaking comments and asserts, and rebasing
  w0xlt:
    tACK 71c3f0356c on signet.

Tree-SHA512: de7efda08b44aa31013fbebc47a02cd2de32db170b570f9643e1f013fee0e8e7ca3068952d1acc6e5e74a70910735c5f263437981ad73df841ad945b52d36b71
2022-04-26 19:42:45 +01:00
fanquake
260ede1d99
Merge bitcoin/bitcoin#24644: wallet: add tracepoints and algorithm information to coin selection
ab5af9ca72 test: Add test for coinselection tracepoints (Andrew Chow)
ca02b68e8a doc: document coin selection tracepoints (Andrew Chow)
8e3f39e4fa wallet: Add some tracepoints for coin selection (Andrew Chow)
15b58383d0 wallet: compute waste for SelectionResults of preset inputs (Andrew Chow)
912f1ed181 wallet: track which coin selection algorithm produced a SelectionResult (Andrew Chow)

Pull request description:

  Tracepoints can be useful for coin selection as they would allow us to observe what is being selected, selection parameters, and calculation results. So this PR adds 4 new tracepoints:

  1. After `SelectCoins` returns in order to observe the `SelectionResult`
  2. After the first `CreateTransactionInternal` to observe the created transaction
  3. Prior to the second `CreateTransactionInternal` to notify that the optimistic avoid partial spends selection is occurring
  4. After the second `CreateTransactionInternal` to observe the created transaction and inform which solution is being used.

  This PR also adds an algorithm enum to `SelectionResult` so that the first tracepoint will be able to report which algorithm was used to produce that result.

  The primary use case for these tracepoints is in running coin selection simulations. The script I use to run these simulations use these tracepoints in order to gather data on the algorithm used and the calculated waste.

ACKs for top commit:
  jb55:
    crACK ab5af9ca72
  josibake:
    crACK ab5af9ca72
  0xB10C:
    ACK ab5af9ca72. Code reviewed, ran the `interface_usdt_coinselection.py` test, and tested with the above bpftrace script (updated `%d` -> `%ld` where necessary, ty achow101).

Tree-SHA512: a4bf7a910cdf464622f2f3b5d44c15b891f24852df6e7f8c5b177fe3d8aaa4a1164593a24c3960eb22b16544fa7140e5c745345367b9e291b78395084c0ac8ff
2022-04-26 19:16:27 +01:00
fanquake
269dcad16e
Merge bitcoin/bitcoin#24789: init, index: disallow indexes when running reindex-chainstate
dac44fc06f init: disallow reindex-chainstate with optional indexes (Martin Zumsande)
62e14285f9 doc: Add note that -reindex will rebuild optional indexes (Martin Zumsande)

Pull request description:

  When started together with `-reindex-chainstate`, currently coinstatsindex gets corrupted and the blockfilterindex flatfiles duplicated. See the OP of #24630 for more a more detailed explanation on why this happens.

  This is an alternative to #24630 which does not wipe and rebuild the indexes but returns an `InitError` when they are activated, thus requiring the user to deactivate them temporarily until the `-reindex-chainstate` run is finished.

  This also disallows `-reindex-chainstate` in combination with `-txindex`, which is not leading to corruption, but currently still rebuilds the index unnecessarily and unexpectedly.

  As a long-term goal, it would be desirable to have the indexes tolerate `reindex-chainstate` by ignoring their `BlockConnected` notifications (there is discussion in #24630 about this) or possibly move `reindex-chainstate` option  into a `bitcoin-chainstate` executable, which could also solve the problem. But these would be larger projects - until then, it might be better to disallow the interaction than having corrupted indexes.

  The first commit adjusts the `-reindex` doc to mention that this option does rebuild all active indexes.

ACKs for top commit:
  ryanofsky:
    Code review ACK dac44fc06f. Just fixed IsArgSet call and edited error messages since last review

Tree-SHA512: c1abf7d350648ae227c3fd6c95d9a54c3bac9de70915275dea1c87cca6d9a76a056c0e306d95ef8cfe4df1f8525b418e0e7a4f52ded3be464041c0dc297f8930
2022-04-26 12:11:39 +01:00
Fabian Jahr
71c3f0356c
move-only: Rename index + pruning functional test 2022-04-25 23:22:00 +02:00
Fabian Jahr
de08932efa
test: Update test for indices on pruned nodes 2022-04-25 23:22:00 +02:00
Fabian Jahr
825d19839b
Index: Allow coinstatsindex with pruning enabled 2022-04-25 23:22:00 +02:00
Fabian Jahr
f08c9fb0c6
Index: Use prune locks for blockfilterindex
Prior to this change blocks could be pruned up to the last block before the blockfilterindex current best block.
2022-04-25 23:22:00 +02:00
laanwj
1e7db37e76
Merge bitcoin/bitcoin#24856: lint: Converting lint-assertions.sh to lint-assertions.py
172c2333f0 Porting lint-assertions.sh to lint-assertions.py (hiago)

Pull request description:

  This PR is converting `test/lint/lint-assertions.sh` to `test/lint/lint-assertions.py`. It's an item of #24783.

ACKs for top commit:
  laanwj:
    Tested ACK 172c2333f0

Tree-SHA512: 94d5b03acfeaf2303fad95d489d6c3aa7bd655889ddaa807cc97e0613b8eb8f5ef094feee2a98d974606890deb554e76490a5c523d64eb5bc55afa6a43221aae
2022-04-25 19:47:17 +02:00
laanwj
16fa967d3c
Merge bitcoin/bitcoin#24915: lint: Convert lint-circular-dependencies.sh to Python
79635c79e0 lint: Convert lint-circular-dependencies.sh to Python (Smlep)

Pull request description:

  Here is a port of `/test/lint/lint-circular-dependencies.sh` to a Python-script as part of the request of https://github.com/bitcoin/bitcoin/issues/24783.

  It aims to provide the same output as the bash version.

ACKs for top commit:
  laanwj:
    Tested ACK 79635c79e0

Tree-SHA512: f18077018f1229dd933cfe2bf0cfe7dc7d6538961c96a83c7a1f05e0cec4b068ca05502d68410d2aa4b6864523424db386e38233735190525904c2a8e9d2ba13
2022-04-25 19:37:19 +02:00
laanwj
9eedbe98c8
Merge bitcoin/bitcoin#24815: lint: convert lint-tests.sh to python
ae0e06a439 Converted lint-tests.sh to python (TakeshiMusgrave)

Pull request description:

  Reference issue: https://github.com/bitcoin/bitcoin/issues/24783

ACKs for top commit:
  laanwj:
    Tested ACK ae0e06a439

Tree-SHA512: a118295b5b6b5199b52d46b54de871d88dd544112e7dd5001a9575d65b093af0aea390f9ad223462a4fc6a201bd8c4debe5e26bfa4860a90c97cfe300477c04a
2022-04-25 19:27:37 +02:00
laanwj
0342ae1d39
Merge bitcoin/bitcoin#24802: lint: convert format strings linter test to python
267684ee34 lint: convert format strings linter test to python (Eunoia)

Pull request description:

  Refs #24783

  Attempted to keep the style and flow of implementation as it is.

  ### Additional Notes(Optional):
  1. There is scope of improvement on how the related files are fetched. In this `git grep` with `subprocess` is still used as I found it to be the simplest. Any pointers on this are appreciated.
  2. Removed sort operation on the matching files as I couldn't think of any strong arguments to have it. Any pointers on this are appreciated.
  3. Not important, but one small detail is that the previous implementation was storing matched files for all the `function_names` iterated so far. Fixed that in this PR.

ACKs for top commit:
  laanwj:
    Code review ACK 267684ee34

Tree-SHA512: 54ceae0c3501e561fdd9c5167b2dd8dd06da1b3697a077a042210970ce7004bda8c4e19abb1905ee64cbdce635f0a078508da645846ae7e81c016091f3f02458
2022-04-25 18:32:40 +02:00
laanwj
777b89b300
Merge bitcoin/bitcoin#24929: lint: convert shell locale linter test to Python
2c838cc309 lint: convert shell locale linter test to Python (Eunoia)

Pull request description:

  Refs #24783

ACKs for top commit:
  laanwj:
    Code review ACK 2c838cc309

Tree-SHA512: 3cb5e7c7cd2acbdf0dc45096055b33cbfa0ec9e47ea567452d23a49a7441b3b62a8416879f234459c86fa892c42205c91d8a575115346c023ab0152cf713e20c
2022-04-25 18:23:02 +02:00
laanwj
8b686776ef
Merge bitcoin/bitcoin#24902: lint: Convert lint-include-guards.sh to Python
d5fdec5cf8 Convert lint-include-guards.sh to python (brydinh)

Pull request description:

  This PR addresses [issue 24783](https://github.com/bitcoin/bitcoin/issues/24783).  Converted lint-include-guards.sh to python.

ACKs for top commit:
  KevinMusgrave:
    Tested ACK d5fdec5cf8
  laanwj:
    Code review ACK d5fdec5cf8

Tree-SHA512: cae566fc1b222b447c0d60ea20fd012f1cfde4dd07c1762ede2b2c9f84ed59ee8e629db1264dab8ac20bcac410e4c389827addf0a59757f94b40a65ea9bab466
2022-04-25 18:14:54 +02:00
laanwj
c90b42bcdb
Merge bitcoin/bitcoin#24916: lint: Convert lint-python-utf8-encoding.sh to Python
035eef4be6 lint: Convert lint-python-utf8-encoding.sh to Python (Dimitri)

Pull request description:

  A port of `test/lint/lint-python-utf8-encoding.sh` to a Python-script as part of the request of #24783. Checked for output-consistency.

ACKs for top commit:
  laanwj:
    Code review ACK 035eef4be6

Tree-SHA512: a8a2f505bf7953d318837182101346c44e73cfd1bf3b5342ff1400fb1c67c5292519fa99db1035da87cf27fb5f5ac5d28871bf55a1c085b5f8a3bb33ff0fa3fb
2022-04-25 17:58:25 +02:00
laanwj
7134327be5
Merge bitcoin/bitcoin#24932: lint: Convert lint-locale-dependence.sh to Python
3043a1bc9d lint: Make known violations more specific in lint-locale-dependence (Dimitri)
229917d3d4 lint: Convert lint-locale-dependence.sh to Python (Dimitri)

Pull request description:

  A port of `test/lint/lint-locale-dependence.sh` to a Python-script as part of the request of #24783. Checked for output-consistency.

ACKs for top commit:
  laanwj:
    Tested and code review ACK 3043a1bc9d

Tree-SHA512: 80555cf7aac156bab5488f85098731d1c12a42667fe7d0df0c35487ab8fc951654a70a15351a759282eabab8319f5aabd8bdb153412b9edc3a9033bef64fd609
2022-04-25 17:53:53 +02:00
fanquake
aa54132bac
Merge bitcoin/bitcoin#24454: tests: Fix calculation of external input weights
9f5ab670e7 tests: Use descriptor that requires both legacy and segwit (Andrew Chow)
8a04a386f7 tests: Calculate input weight more accurately (Andrew Chow)

Pull request description:

  The external input tests with specifying input weight would sometimes result in a test failure because it would add 2 to the calculated byte size in order to account for some of the variation in signature and script sizes. However 1 in 128 signatures are actually 1 byte smaller than we expect, so the difference between the actual signature size and our calculated size becomes 3 bytes which is outside of the tolerance of `assert_fee_amount` and would thus cause the test failure.

  To resolve this, the 2 byte buffer is reduced to 1 byte, so in the above scenario, the difference is 2 bytes which is within the tolerance of `assert_fee_amount`. Additionally, instead of putting a fixed size that we assume is the correct size for the length of the compact size length prefix of data, we actually get the length of the compact size uint.

  Lastly, the size calculation for a scriptWitness was simply incorrect and used fields that did not exist. This is fixed, and the test slightly modified so that it also produces a scriptWitness.

  Fixes #24151

ACKs for top commit:
  jonatack:
    re-ACK 9f5ab670e7
  glozow:
    code review ACK 9f5ab670e7

Tree-SHA512: b7c7ffe8fb0c07bc9e72fbff1f9ef57ee01a57c56bf54b8873345c8b9572c3ce9402b24dc211910b478114a9e6420faef5a4bf8866f38c299971354e54ec4745
2022-04-25 09:54:40 +01:00
Martin Zumsande
dac44fc06f init: disallow reindex-chainstate with optional indexes
It currently leads to corruption (coinstatsindex) or
data duplication (blockfilterindex), so disable it.
2022-04-24 22:28:25 +02:00
MarcoFalke
b1c5991eeb
Merge bitcoin/bitcoin#24812: util/check: Add CHECK_NONFATAL identity function and NONFATAL_UNREACHABLE macro
ee02c8bd9a util/check: Add CHECK_NONFATAL identity function, NONFATAL_UNREACHABLE AND UNREACHABLE macros (Aurèle Oulès)

Pull request description:

  This PR replaces the macro `CHECK_NONFATAL` with an identity function.
  I simplified the usage of `CHECK_NONFATAL` where applicable in `src/rpc`.
  This function is useful in sanity checks for RPC and command-line interfaces.

  Context: https://github.com/bitcoin/bitcoin/pull/24804#discussion_r846182474.

  Also adds `UNREACHABLE_NONFATAL` macro.

ACKs for top commit:
  jonatack:
    ACK ee02c8bd9a
  MarcoFalke:
    ACK ee02c8bd9a 🍨

Tree-SHA512: 3cba09223cd7b22e62fe5d0b46c4a024c1d9957d4268ba6d3fb07fcc0a5854fc0886bb3266184e6a7df5df91373b3e84edd6adf6999c4e934aeef8c043b01aa2
2022-04-24 12:00:05 +02:00
hiago
172c2333f0 Porting lint-assertions.sh to lint-assertions.py 2022-04-22 09:45:12 -03:00
Andrew Chow
9f5ab670e7 tests: Use descriptor that requires both legacy and segwit 2022-04-21 21:00:36 -04:00
Dimitri
035eef4be6 lint: Convert lint-python-utf8-encoding.sh to Python 2022-04-21 23:26:45 +02:00
Dimitri
3043a1bc9d lint: Make known violations more specific in lint-locale-dependence 2022-04-21 20:03:32 +02:00
Dimitri
229917d3d4 lint: Convert lint-locale-dependence.sh to Python 2022-04-21 19:31:41 +02:00
MarcoFalke
7a4ac713aa
Merge bitcoin/bitcoin#24936: test: compare /mempool/contents response with getrawmempool RPC
bef61496ab test: compare `/mempool/contents` response with `getrawmempool` RPC (brunoerg)
5bc5cbaf31 doc: add reference to `getrawmempool` RPC in `/mempool/contents` REST doc (brunoerg)

Pull request description:

  This PR is similar to #24797, it compares `/mempool/contents` REST response with `getrawmempool` RPC (verbose=True) since they use the same `MempoolToJSON` function.

  Also, adds a reference to `getrawmempool` RPC help to get details about the fields from `/mempool/contents`.

ACKs for top commit:
  0xB10C:
    ACK bef6149

Tree-SHA512: b7e9e9c765ee837986ba167b9234a9b95c9ef0a9ebcc2a03d50f6be6d3aba1480bd77c78111d95df1e4023cde6dfc64bf1e7908d9e5b6f96ca46b76611a4a9b4
2022-04-21 19:01:00 +02:00
Andrew Chow
ab5af9ca72 test: Add test for coinselection tracepoints 2022-04-21 11:17:00 -04:00
laanwj
2513499348
Merge bitcoin/bitcoin#24803: lint: convert submodule linter test to Python
4a9e36dbaf lint: convert submodule linter test to Python (Eunoia)

Pull request description:

  Refs #24783

ACKs for top commit:
  laanwj:
    Tested ACK 4a9e36dbaf

Tree-SHA512: ca25b59acf75cebc79588a6c51dc5c313c8d0bd1d492127815d7b81b36aaffd02815a515d97b355582002f71efc33d46435d0b28fce24497bb99799d9ba57228
2022-04-21 17:10:43 +02:00
MarcoFalke
346e780442
Merge bitcoin/bitcoin#24918: test: Remove unused taproot node from wallet_taproot.py
fa2153b05b test: Remove unused taproot node from wallet_taproot.py (MarcoFalke)

Pull request description:

  Now that the wallet considers taproot always active after commit 064c729a96, there is no need to test for it.

ACKs for top commit:
  dunxen:
    Code review ACK fa2153b
  brunoerg:
    crACK fa2153b05b

Tree-SHA512: 24e4a66e43d1391acb63fd0c0c52677b0eef7f618b87a5b1a75224a9be58c9c3f8bba2de3b7510f25a686865b027f7f535e653d40d519d0e00ace38f0c7aba0c
2022-04-21 14:45:22 +02:00
brunoerg
bef61496ab test: compare /mempool/contents response with getrawmempool RPC 2022-04-21 08:31:01 -03:00
Smlep
79635c79e0 lint: Convert lint-circular-dependencies.sh to Python 2022-04-20 22:40:50 +02:00
Eunoia
2c838cc309 lint: convert shell locale linter test to Python 2022-04-20 14:37:52 +00:00
brydinh
d5fdec5cf8 Convert lint-include-guards.sh to python
Specify encoding when reading header files, add docstring

Update test/lint/lint-include-guards.py  include guard count logic

Co-authored-by: Kevin Musgrave <tkm45@cornell.edu>

Update test/lint/lint-include-guards.py by removing whitespace
2022-04-20 09:52:58 -04:00
MarcoFalke
fc99f8c09e
Merge bitcoin/bitcoin#24895: lint: Convert lint-includes.sh to Python
67b41678c8 lint: Convert lint-includes.sh to Python (Dimitri)

Pull request description:

  A port of `test/lint/lint-includes.sh` to a Python-script as part of the request of #24783. Checked for output-consistency.

ACKs for top commit:
  KevinMusgrave:
    Tested ACK 67b41678c8

Tree-SHA512: 05b4b114dc101e571004aee8aea1480e4dda1dc645426100649e9cb81e56e8667f88d6d5646a9860ea1c7abc36754eda2a77ec10156c54b62db00e2c00b8ceae
2022-04-20 09:55:33 +02:00
Eunoia
4a9e36dbaf lint: convert submodule linter test to Python 2022-04-20 05:21:13 +00:00
MarcoFalke
8d3743a365
Merge bitcoin/bitcoin#24896: test: use MiniWallet for p2p_segwit.py
917a89a814 test: use MiniWallet for p2p_segwit.py (Sebastian Falbesoner)

Pull request description:

  This PR enables one more of the non-wallet functional tests (p2p_segwit.py) to be run even with the Bitcoin Code wallet by using the MiniWallet instead, as proposed in https://github.com/bitcoin/bitcoin/issues/20078.

  This change only affects the subtest `test_superfluous_witness`. Note that instead of creating a raw transaction first and then signing it, we go the other direction here: MiniWallet creates a transaction spending a segwit v1 output (i.e. including a witness), then we turn it into a raw transaction by dropping the witness. Therefore, the debug log asserts are swapped.

Top commit has no ACKs.

Tree-SHA512: 163a93a527f60100487f0aff49a9d7baf392ceb4417c54521157b2678685f5728dd751a9747c6cf51666aae78252dd3bc44130e659f7a1262ec1c86e30225622
2022-04-19 14:17:31 +02:00
Hennadii Stepanov
e245c5ccd5
doc: Fix a link to test/lint/lint-python.py 2022-04-19 12:19:32 +02:00
MarcoFalke
fa2153b05b
test: Remove unused taproot node from wallet_taproot.py 2022-04-19 11:57:54 +02:00
Dimitri
67b41678c8 lint: Convert lint-includes.sh to Python 2022-04-19 02:23:56 +02:00
laanwj
57a73d71a3
Merge bitcoin/bitcoin#24794: lint: Convert Python linter to Python
47b66ac4ac lint: Convert Python linter to Python (Fabian Jahr)

Pull request description:

  The outputs provided by the Python version should be exactly the same as the ones from the shell version.

  There is small improvement here: Previously only the dependency of `flake9` was checked, now all dependencies are checked before running.

  I also tried to mostly follow the [recommendations here](https://github.com/bitcoin/bitcoin/pull/24766#pullrequestreview-932953476) but happy to make more changes if there is still room for improvement.

ACKs for top commit:
  laanwj:
    Tested ACK 47b66ac4ac

Tree-SHA512: 1630188e176c1063b8905669b76682b361a858cde6990ab17e51ad4333bf376eab796050cdb9f2967b84f1f74379d9e860c4258561b1964e1a47183c593e5bb4
2022-04-18 18:51:15 +02:00
laanwj
5fdf37e14b
Merge bitcoin/bitcoin#24853: lint: Convert lint-git-commit-check.sh to Python
f27fcd9bf4 lint: Convert lint-git-commit-check.sh to Python (Dimitri)

Pull request description:

  A port of `/test/lint/lint-git-commit-check.sh` to a Python-script as part of the request of #24783 . Checked for output-consistency.

ACKs for top commit:
  laanwj:
    re-ACK f27fcd9bf4

Tree-SHA512: afc4a662f4aec1796c023b98a875c1591940ecdfc709eefe2df29d33e51e807c3c2e2b5c410aa3ad1cd3f6f8207f5c15b638637ff9f5659cafa7543bbe8a0bae
2022-04-18 18:04:34 +02:00
laanwj
3059d4dd72
Merge bitcoin/bitcoin#24844: lint: Convert lint-whitespace.sh to Python
a75f6d86d1 lint: Convert lint-whitespace.sh to Python (Dimitri)

Pull request description:

  A port of `/test/lint/lint-whitespace.sh` to a Python-script as part of the request of #24783 . Checked for output-consistency.

ACKs for top commit:
  laanwj:
    Code review and tested ACK a75f6d86d1

Tree-SHA512: 982041b0beb1b3866493ad523950c9a536a8b1ec79b773fe86dbc1166844c13a30b384e92025f845d45d25334f90f3abda5fa23f0f28e7c2cddc5e496f84c445
2022-04-18 17:50:07 +02:00
Andrew Chow
2095f19db9
Merge bitcoin/bitcoin#24859: wallet: Change wallet validation order
6f29409ad1 test: Add a test that creates a wallet with invalid parameters (w0xlt)
0359d9b6a3 Change wallet validation order (w0xlt)

Pull request description:

  In the current code, the database is created before the last validation, which checks that passphrase is set and private keys are disabled.

  Therefore, if this validation fails, it will result in an empty database and the user will not be able to recreate a wallet with the same name and with the correct parameters.

  Behavior on the master branch:
  ```
  $ ./src/bitcoin-cli -regtest -named createwallet wallet_name="invalid_wallet_01" disable_private_keys=true passphrase="passphrase"
  error code: -4
  error message:
  Passphrase provided but private keys are disabled. A passphrase is only used to encrypt private keys, so cannot be used for wallets with private keys disabled.

  $ ./src/bitcoin-cli -regtest -named createwallet wallet_name="invalid_wallet_01"
  error code: -4
  error message:
  Wallet file verification failed. Failed to create database path '/home/w/.bitcoin/regtest/wallets/invalid_wallet'. Database already exists.
  ```

  Behavior on the PR branch:
  ```
  $ ./src/bitcoin-cli -regtest -named createwallet wallet_name="invalid_wallet_02" disable_private_keys=true passphrase="passphrase"
  error code: -4
  error message:
  Passphrase provided but private keys are disabled. A passphrase is only used to encrypt private keys, so cannot be used for wallets with private keys disabled.

  $ ./src/bitcoin-cli -regtest -named createwallet wallet_name="invalid_wallet_02"
  {
    "name": "invalid_wallet_01",
    "warning": ""
  }
  ```

ACKs for top commit:
  achow101:
    ACK 6f29409ad1

Tree-SHA512: d192955fc2285bf27ae5dd4c1b7cfd3d85441a7f3554b189b974aefb319c6b997543991dbb0ca2c8cb980f7058913a77cf0164c02e9b51ceb9c2cb601317c428
2022-04-18 11:29:29 -04:00
Fabian Jahr
47b66ac4ac
lint: Convert Python linter to Python 2022-04-18 00:55:06 +02:00
Sebastian Falbesoner
917a89a814 test: use MiniWallet for p2p_segwit.py
This change only affects the subtest `test_superfluous_witness`.

Note that instead of creating a raw transaction first and then
signing it, we go the other direction here: MiniWallet creates a
transaction spending a segwit v1 output (i.e. including a witness),
then we turn it into a raw transaction by dropping the witness.
Therefore, the debug log asserts are swapped.
2022-04-17 18:39:41 +02:00
Dimitri
a75f6d86d1 lint: Convert lint-whitespace.sh to Python 2022-04-16 15:53:15 +02:00
Dimitri
f27fcd9bf4 lint: Convert lint-git-commit-check.sh to Python 2022-04-16 15:43:19 +02:00
Aurèle Oulès
ee02c8bd9a util/check: Add CHECK_NONFATAL identity function, NONFATAL_UNREACHABLE AND UNREACHABLE macros 2022-04-16 15:07:41 +02:00