Commit Graph

4697 Commits

Author SHA1 Message Date
laanwj
e282764e04
Merge bitcoin/bitcoin#25228: test: add BIP-125 rule 5 testcase with default mempool
687addaf13 test: add BIP-125 rule 5 testcase with default mempool (James O'Beirne)
6120e8e287 test: allow passing sequence through create_self_transfer_multi (James O'Beirne)

Pull request description:

  Currently, we only test rule 5 of BIP-125 (replacement transactions cannot evict more than 100 transactions) by changing default mempool parameters to allow for more descendants. The current test works on a single transaction graph that has over 100 descendants.

  This patch adds a test to exercise rule 5 using the default mempool parameters. The case is a little more sophisticated: instead of working on a single transaction graph, it uses a replacement transaction to "unite" several UTXOs which join independent transaction graphs. The total number of transactions in these graphs sum to more than the max allowable replacement.

  I think the difference in transaction topology makes this a worthwhile testcase to have, setting aside the fact that this testcase works without having to use atypical mempool params.

  See also: [relevant discussion from IRC](https://www.erisian.com.au/bitcoin-core-dev/log-2022-05-27.html#l-126)

ACKs for top commit:
  laanwj:
    Code review ACK 687addaf13
  LarryRuane:
    ACK 687addaf13

Tree-SHA512: e589aeaf9d6f137d546b7809f8795d6f6043d87b15e97c2efe85b42ce8b49d977ee7d79440c542ca4b0b5ca2de527488029841a1ffc0d96c5771897df4b3f324
2022-06-07 20:49:33 +02:00
MacroFake
f66633d9cb
Merge bitcoin/bitcoin#25288: test: Reliably don't start itself (lint-all.py runs all tests twice)
f26a496dfd test: clean up all-lint.py (Martin Leitner-Ankerl)
64d72c4c87 test: rename lint-all.py to all-lint.py (Martin Leitner-Ankerl)

Pull request description:

  When running `./test/lint/lint-all.py`, the script runs all tests but
  also calls itself because the comparison with `__file__` doesn't work.

  Comparing resolved paths gives reliable comparison, and lint-all.py doesn't call itself any more

ACKs for top commit:
  laanwj:
    Code review ACK f26a496dfd

Tree-SHA512: b44abdd685f7b48a6a9f48e96d97138b635c31c1c7ab543cb5636b5f49690ccd56fa6fec01ae7fcc16af01a613372ee77632f70c32059919b373aa8051953791
2022-06-07 10:37:34 +02:00
Martin Leitner-Ankerl
f26a496dfd test: clean up all-lint.py
Removed th check against __file__ which is not necessary any more after the rename to all-lint.py.

Changed glob to find only `lint-*.py` scripts.
2022-06-07 10:24:55 +02:00
Martin Leitner-Ankerl
64d72c4c87 test: rename lint-all.py to all-lint.py
That way it is impossible for the script to call itself.
2022-06-07 10:22:45 +02:00
MacroFake
581e2bdbac
Merge bitcoin/bitcoin#24629: Bugfix: RPC/blockchain: pruneblockchain: Return the height of the actual last pruned block
e593ae07c4 Bugfix: RPC/blockchain: pruneblockchain: Return the height of the actual last pruned block (Luke Dashjr)

Pull request description:

  From 0.14 (2017 Mar) until before 0.19 (2019 Nov), the height of the last block pruned was returned, subject to a bug if there were blocks left unpruned due to sharing files with later blocks.

  In #15991, this was "fixed" to the current implementation, introducing a new bug: now, it returns the first *unpruned* block.

  Since the user provides the parameter as a block to include in pruning, it makes more sense to fix the behaviour to match the documentation.

  ~~(Additionally, the description of "pruneheight" in getblockchaininfo is fixed to be technically correct)~~

ACKs for top commit:
  fjahr:
    utACK e593ae07c4
  ryanofsky:
    Code review ACK e593ae07c4. Just rebased since last review. Maybe some of the original reviewers of #15991 will want to take a look at this to correct the mistake that was introduced there!

Tree-SHA512: c2d511df80682d57260aae8af1665f9d7eaed16448f185f4c9f23c78fa9b8289a02053da7a0b83643fef57610d601ea63b59ff39661a51f4827f1eb27cc30594
2022-06-07 08:04:51 +02:00
laanwj
06ea2783a2
Merge bitcoin/bitcoin#25220: rpc: fix incorrect warning for address type p2sh-segwit in createmultisig
3a9b9bb38e test: ensure createmultisig and addmultisigaddress are not returning any warning for expected cases (brunoerg)
eaf6f630c0 rpc: fix inappropriate warning for address type p2sh-segwit in createmultisig and addmultisigaddress (brunoerg)

Pull request description:

  Fixes #25127

  If there are any uncompressed keys when calling `AddAndGetMultisigDestination`, it will just default to a legacy address regardless of the chosen `address_type`. So, #23113 added a warnings field which will warn the user why their address format is different.

  However, when creating a multisig (p2sh-segwit), it is returning an inappropriate warning, because when getting the output type from destination (`OutputTypeFromDestination`), it returns `ScriptHash` for both legacy and `P2SH_SEGWIT`. So, since `P2SH_SEGWIT` is different from `ScriptHash`, it returns the warning:
  192d639a6b/src/rpc/output_script.cpp (L166-L169)

  So, to avoid this mistake I changed `OutputTypeFromDestination` to `descriptor->GetOutputType()` to get the appropriate output type.

ACKs for top commit:
  jonatack:
    ACK 3a9b9bb38e
  laanwj:
    Code review ACK 3a9b9bb38e

Tree-SHA512: 49f717479c2b8906277e7591ddd4747f7961c2d5c77494b5124045de9036a4277d46b9ad99279d51f0c4484284c445f1e1d3c55c49bbf0716741bad426a89369
2022-06-06 17:13:22 +02:00
brunoerg
3a9b9bb38e test: ensure createmultisig and addmultisigaddress are not returning any warning for expected cases 2022-06-06 09:46:42 -03:00
Luke Dashjr
e593ae07c4 Bugfix: RPC/blockchain: pruneblockchain: Return the height of the actual last pruned block
From 0.14 (2017 Mar) until before 0.19 (2019 Nov), the height of the last
block pruned was returned, subject to a bug if there were blocks left unpruned
due to sharing files with later blocks.

In #15991, this was "fixed" to the current implementation, introducing a new
bug: now, it returns the first *unpruned* block.

Since the user provides the parameter as a block to include in pruning, it
makes more sense to fix the behaviour to match the documentation.
2022-06-03 07:20:07 +00:00
laanwj
00ce8543f1
Merge bitcoin/bitcoin#24171: p2p: Sync chain more readily from inbound peers during IBD
48262a00f5 Add functional test for block sync from inbound peers (Suhas Daftuar)
0569b5c4bb Sync chain more readily from inbound peers during IBD (Suhas Daftuar)

Pull request description:

  When in IBD, if the honest chain is only known by inbound peers, then we must
  eventually sync from them in order to learn it. This change allows us to
  perform initial headers sync and fetch blocks from inbound peers, if we have no
  blocks in flight.

  The restriction on having no blocks in flight means that we will naturally
  throttle our block downloads to any such inbound peers that we may be
  downloading from, until we leave IBD. This is a tradeoff between preferring
  outbound peers for most of our block download, versus making sure we always
  eventually will get blocks we need that are only known by inbound peers even
  during IBD, as otherwise we may be stuck in IBD indefinitely (which could have
  cascading failure on the network, if a large fraction of the network managed to
  get stuck in IBD).

  Note that the test in the second commit fails on master, without the first commit.

ACKs for top commit:
  ajtowns:
    ACK 48262a00f5
  sipa:
    ACK 48262a00f5

Tree-SHA512: ffad3a05fa9a32a92226843c9128f52c275e8d51930fde7368badc340227f2ed680561c4c9f2937b4e3bd722474464849ec9b624f912f5e380ce98d71b55764d
2022-06-02 22:35:05 +02:00
James O'Beirne
687addaf13 test: add BIP-125 rule 5 testcase with default mempool
This testcase exercises rule 5 of BIP-125 (no more than 100 evictions
due to replacement) without having to test under non-default mempool
parametmers.
2022-06-02 10:19:24 -04:00
Sebastian Falbesoner
1bace0cfee test: check replaceable mismatch error in createrawtransaction RPC 2022-06-02 12:59:13 +02:00
MacroFake
fafaad98f7
test: Set maxfeerate=0 in MiniWallet sendrawtransaction() 2022-06-01 17:07:05 +02:00
MacroFake
9cc010f5a9
Merge bitcoin/bitcoin#25087: test: use MiniWallet for feature_dbcrash.py
1da5e45725 test: use MiniWallet for feature_dbcrash.py (Sebastian Falbesoner)

Pull request description:

  This PR enables one more of the non-wallet functional tests (feature_dbcrash.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.

ACKs for top commit:
  laanwj:
    Code review ACK 1da5e45725
  brunoerg:
    crACK 1da5e45725

Tree-SHA512: 75ee9a32fd1451254004797d695d18032bd0fcb66ebd88cf737e147e43812525f6e884ec05fcc4f76f566dc71174c8ed7347bcdce16567db6511746ae64cead0
2022-06-01 16:43:49 +02:00
Sebastian Falbesoner
7d0f67a0d5 test: check pre-segwit peer error in getblockfrompeer RPC 2022-05-31 23:04:13 +02:00
MacroFake
d4d9daff7a
Merge bitcoin/bitcoin#25200: doc: Fix spelling errors identified by codespell in comments
f565b2836d Fixup option name in bench message (Ben Woosley)
bf209ac7a7 doc: Fix spelling errors identified by codespell in coments (Ben Woosley)

Pull request description:

  From the output [here](https://cirrus-ci.com/task/5275612980969472?logs=lint#L849):
  ```
  src/qt/test/addressbooktests.cpp:185: wilcard ==> wildcard
  src/qt/test/addressbooktests.cpp:191: wilcard ==> wildcard
  src/test/miniscript_tests.cpp:227: nd ==> and, 2nd
  src/test/versionbits_tests.cpp:260: everytime ==> every time
  src/util/time.h:89: precicion ==> precision
  src/util/time.h:90: precicion ==> precision
  ^ Warning: codespell identified likely spelling errors. Any false positives? Add them to the list of ignored words in test/lint/spelling.ignore-words.txt
  ```

  ~~I left the 'nd' in miniscript_tests as-is, as it's valid miniscript,
  and I'm wary of whitelisting it.~~

ACKs for top commit:
  dunxen:
    ACK f565b28

Tree-SHA512: 501a426c5f6f9761e2c8f980d5d955611428a827321888f53e0ae9526b0fecd43f9d1fa845fc70ae2489d77be6dc0b5b371dff55c5146f4b39ed874f4a1ea917
2022-05-31 15:19:59 +02:00
brunoerg
ebfc308ea4 test: add coverage for non-hex value to -minimumchainwork 2022-05-31 08:23:38 -03:00
MacroFake
5f65afff9c
Merge bitcoin/bitcoin#24178: p2p: Respond to getheaders if we have sufficient chainwork
a35f963edf Add test for getheaders behavior (Suhas Daftuar)
ef6dbe6863 Respond to getheaders if we have sufficient chainwork (Suhas Daftuar)

Pull request description:

  Previously, we would check to see if we were in IBD and ignore getheaders requests accordingly. However, the IBD criteria -- an optimization mostly targeted at behavior when we have peers serving us many blocks we need to download -- is difficult to reason about in edge-case scenarios, such as if the network were to go a long time without any blocks found and nodes are getting restarted during that time.

  To make things simpler to reason about, just use `nMinimumChainWork` as our anti-DoS threshold for responding to a getheaders request; as long as our chain has that much work, it should be fine to respond to a peer asking for our headers (and this should allow such a peer to request blocks from us if needed).

ACKs for top commit:
  klementtan:
    crACK a35f963edf
  naumenkogs:
    ACK a35f963edf
  MarcoFalke:
    review ACK a35f963edf 🗯

Tree-SHA512: 131e3872e7fe80382ea9c1ec202d6c2dc59c006355c69000aa3f4ce6bccd02a6c689c8cb8f3542b5d9bc48bfa61edcbd1a78535c0b79018971d02bed2655d284
2022-05-31 12:05:46 +02:00
MacroFake
269fa667f2
Merge bitcoin/bitcoin#25044: test: Use MiniWallet in rpc_rawtransaction.py
e8959000b6 test: Use MiniWallet in rpc_rawtransaction.py (Daniela Brozzoni)
e93046c10b MOVEONLY: Move signrawtransactionwithwallet test (Daniela Brozzoni)

Pull request description:

  This PR allows `rpc_rawtransaction.py` to be run even without the Core wallet by using the MiniWallet instead, as proposed in https://github.com/bitcoin/bitcoin/issues/20078.
  This test was previously run twice, once with `--legacy-wallet` and once with
  `--descriptors`. Since this would have meant running the same test twice
  if the wallet wasn't compiled, now we run it just once with the legacy
  wallet.

ACKs for top commit:
  jonatack:
    ACK e8959000b6

Tree-SHA512: d1580570a54dad8e30a5df1ab7d03ecb3f824efe6843323e1f3aef63592045d823c7d54fc86321dc7c1d414854a253431a01a7baa9f30426ea9a09ef11ae3a04
2022-05-30 16:57:47 +02:00
Daniela Brozzoni
e8959000b6
test: Use MiniWallet in rpc_rawtransaction.py
This test was previously run twice, once with `--legacy-wallet` and once with
`--descriptors`.
Now we run it only with `--legacy-wallet`, as all the tests has been
ported to the MiniWallet but `raw_multisig_transaction_legacy_tests`,
which can be run only with the legacy wallet.
We also decrease the number of nodes used from 4 to 3, making the test
run slightly faster.
2022-05-30 16:25:18 +02:00
Daniela Brozzoni
e93046c10b
MOVEONLY: Move signrawtransactionwithwallet test
Put signrawtransactionwithwallet_tests in rpc_signrawtransaction.py,
as the test is mainly testing the signrawtransaction RPC.
Review with `git show --color-moved=dimmed-zebra`
2022-05-30 16:25:17 +02:00
James O'Beirne
6120e8e287 test: allow passing sequence through create_self_transfer_multi
And some little type annotation additions.
2022-05-27 13:40:06 -04:00
Sebastian Falbesoner
387ae8bc09 rpc: remove deprecated fee fields from mempool entries 2022-05-27 17:29:04 +02:00
MacroFake
3ba6dd6f4b
Merge bitcoin/bitcoin#24408: rpc: add rpc to get mempool txs spending specific prevouts
4185570340 Add RPC to get mempool txs spending outputs (t-bast)

Pull request description:

  We add an RPC to fetch mempool transactions spending any of the given outpoints.

  Without this RPC, application developers need to first call `getrawmempool` which returns a long list of `txid`, then fetch each of these transactions individually (`getrawtransaction`) to check whether they spend the given outpoints, which wastes a lot of bandwidth (in the worst case we need to transfer the whole mempool).

  For example in lightning, when we discover that one of our channel funding transactions has been spent, we need to find the spending transaction to claim our outputs from it. We are currently forced to fetch the whole mempool to do the analysis ourselves, which is quite costly.

  I believe that this RPC is also generally useful when doing some introspection on your mempool after one of your transactions failed to broadcast, for example when you implement RBF at the application level. Fetching and analyzing the conflicting transaction gives you more information to successfully replace it.

ACKs for top commit:
  darosior:
    re-utACK 4185570340
  vincenzopalazzo:
    re-ACK 4185570340
  danielabrozzoni:
    re-tACK 4185570340
  w0xlt:
    reACK 4185570340

Tree-SHA512: 206687efb720308b7e0b6cf16dd0a994006c0b5a290c8eb386917a80130973a6356d0d5cae1c63a01bb29e066dd721594969db106cba7249214fcac90d2c3dbc
2022-05-27 15:16:00 +02:00
Jon Atack
75848ec2da scripts and tools: update lint-logs.py to detect LogPrintLevel()
and add WalletLogPrintf() (already detected) to the lint-logs.py suggestion

Co-authored-by: laanwj <126646+laanwj@users.noreply.github.com>
2022-05-26 14:59:29 +02:00
MacroFake
8c721fff3a
Merge bitcoin/bitcoin#25192: test: add coverage for unknown value to -blockfilterindex
295ff61934 test: add coverage for unknown -blockfilterindex (brunoerg)

Pull request description:

  This PR adds test coverage for the following init error:
  44037a2912/src/init.cpp (L844)

  Passing an unknown value to -blockfilterindex should throw an error.

ACKs for top commit:
  dunxen:
    cr-ACK 295ff61

Tree-SHA512: 1444903cf0696406c485ce0575f951d527fe7d699094d5845622c0b57c954d6d7dcf1e78ef0c4e8b9b26f53b79583f07fec0e8d8e7f04aa744d2a8cd98329db9
2022-05-25 10:02:24 +02:00
Ben Woosley
bf209ac7a7
doc: Fix spelling errors identified by codespell in coments
From the output here:
src/qt/test/addressbooktests.cpp:185: wilcard ==> wildcard
src/qt/test/addressbooktests.cpp:191: wilcard ==> wildcard
src/test/miniscript_tests.cpp:227: nd ==> and, 2nd
src/test/versionbits_tests.cpp:260: everytime ==> every time
src/util/time.h:89: precicion ==> precision
src/util/time.h:90: precicion ==> precision
^ Warning: codespell identified likely spelling errors. Any false positives? Add them to the list of ignored words in test/lint/spelling.ignore-words.txt
https://cirrus-ci.com/task/5275612980969472?logs=lint#L849

I added 'nd' to the spelling.ignored-words.txt, as it's valid miniscript.
2022-05-25 00:26:21 -05:00
laanwj
7008087548
Merge bitcoin/bitcoin#24410: [kernel 2a/n] Split hashing/index GetUTXOStats codepaths, decouple from coinstatsindex
664a14ba7c coinstats: Move GetUTXOStats to rpc/blockchain (Carl Dong)
f100687566 kernel: Use ComputeUTXOStats in validation (Carl Dong)
faa52387e8 style-only: Rearrange using decls after scripted-diff (Carl Dong)
f329a9298c scripted-diff: Move src/kernel/coinstats to kernel:: (Carl Dong)
0e54456f04 Use only kernel/coinstats.h in index/coinstatsindex.h (Carl Dong)
80970985c9 coinstats: Split node/coinstats.h to kernel/coinstats.h (Carl Dong)
35f73ce4b2 coinstats: Move hasher codepath to kernel/coinstats (Carl Dong)
b7634fe02b Move logic from LookupUTXOStatsWithIndex to CoinStatsIndex::LookUpStats (Carl Dong)
1352e410a5 coinstats: Separate hasher/index lookup codepaths (Carl Dong)
524463daf6 coinstats: Return purely out-param CCoinsStats (Carl Dong)
46eb9fc56a coinstats: Extract index_requested in-member to in-param (Carl Dong)
a789f3f2b8 coinstats: Extract hash_type in-member to in-param (Carl Dong)
102294898d includes: Remove rpc/util.h -> node/coinstats.h (Carl Dong)
0848db9c35 fuzz: Remove useless GetUTXOStats fuzz case (Carl Dong)
52b1939993 kernel: Remove unnecessary blockfilter{index,}.cpp (Carl Dong)

Pull request description:

  Part of: #24303
  Depends on: #24322

  The `GetUTXOStats` function has 2 codepaths:
    - One which queries the `CoinStatsIndex` for the UTXO hash
    - One which actually performs the hashing

  For `libbitcoinkernel`, the only place where we call `GetUTXOStats` is in `PopulateAndValidateSnapshots`, which uses the `SHA256D` hash, and is therefore unable to use the `CoinStatsIndex` since that only provides `MuHash` hashes. Not that I think indices necessarily belong in `libbitcoinkernel` anyway.

  This PR separates these 2 aforementioned codepaths of `GetUTXOStats`, uses the hashing codepath in `PopulateAndValidateSnapshots`, and removes the need to link in `index/coinstatsindex.cpp` and `node/coinstats.cpp`.

  -----

  Logistically, this PR:
  - Extracts out the `index_requested` and `hash_type` members of `CoinStats`, which served as "in-params" to `GetUTXOStats` embedded within the `CoinStats` struct. This allows `CoinStats` to only consist of "out-param" members, and be returned by `GetUTXOStats` without needing to be an "in-out" param
  - Introduce the purely virtual `UTXOHashers` class, with 3 implementations: `SHA256DHasher`, `MuHashHasher`, and `NullHasher`. These replace the existing template-based polymorphism.
  - Split `GetUTXOStats` into:
      - `CalculateUTXOStatsWithHasher(UTXOHasher&, ...)`, and
      - `LookupUTXOStatsWithIndex(CoinStatsIndex&, ...)`
  - Use `CalculateUTXOStatsWithHasher` directly where appropriate (`src/validation.cpp` and `src/fuzz`)
  - Move `GetUTXOStats` to `rpc/blockchain`, which is the only place that depends on `GetUTXOStats`'s weird fallback behaviour
  - Move `LookupUTXOStatsWithIndex` to `index/coinstatsindex`

  Code organization:
  - `src/`
    - `kernel/` → only contains the hashing codepath
      - `coinstats.cpp` → hashing codepath implementations
      - `coinstats.h` → header for `kernel/coinstats.cpp`
    - `index/` → only contains the index codepath
      - `coinstatsindex.cpp` → index codepath implementations
      - `coinstatsindex.h`
    - `validation.cpp` → only uses the hashing codepath
    - `rpc/blockchain.cpp` → uses both the hashing and index codepath, old `GetUTXOStats` fallback logic moved here as static
    - `test/fuzz/coins_view.cpp` → only uses the hashing codepath

  TODOs:
  - [x] Commit messages could be fleshed out more

  Would love any feedback!

ACKs for top commit:
  laanwj:
    Code review ACK 664a14ba7c

Tree-SHA512: 18722c7bd279174d2d1881fec33ea04a9b261aae1c12e998cf434ef297d8ded47de69c526c8033a2ba7abc93ba3d2ff5faf4ce05e8888c725c31cf885ce3ef73
2022-05-24 14:43:00 +02:00
brunoerg
295ff61934 test: add coverage for unknown -blockfilterindex 2022-05-23 18:06:13 -03:00
Carl Dong
f100687566 kernel: Use ComputeUTXOStats in validation
This is the "fruit of our labor" for this patchset.
ChainstateManager::PopulateAndValidateSnapshot can now directly call
ComputeUTXOStats(...).

Our consensus engine is now fully decoupled from all indices.

See the src/Makefile.am for some satisfying removals.
2022-05-23 14:53:35 -04:00
Carl Dong
0e54456f04 Use only kernel/coinstats.h in index/coinstatsindex.h
Removes a circular dependency, horray!
2022-05-23 14:53:35 -04:00
MacroFake
fbb90c44ac
Merge bitcoin/bitcoin#25015: test: Use permissions from git in lint-files.py
908fb7e2ec test: Use permissions from git in `lint-files.py` (laanwj)
48d2e80a74 test: Don't use shell=True in `lint-files.py` (laanwj)

Pull request description:

  Improvements to the `lint-files.py` script:

  - Avoid use of `shell=True`.
  - Check the permissions in git's metadata instead of in the filesystem. This stops the umask or filesystem from interfering. It's also more efficient as it only needs a single call to `git ls-files`.

  (what triggered this change was `File "..." contains a shebang line, but has the file permission 775 instead of the expected executable permission 755.` errors running the script locally).

ACKs for top commit:
  vincenzopalazzo:
    re-tACK 908fb7e2ec

Tree-SHA512: 2eaf868c55a9c3508b12658a5b3ac429963fd0551e645332d0ac54be56fefccee95115e4667386df24b46b545593cb0d0bf8c6cecab73f9cb19d37ddf704c614
2022-05-23 18:59:26 +02:00
Andrew Chow
5ebff43025
Merge bitcoin/bitcoin#25122: rpc: getreceivedbylabel, return early if no addresses were found in the address book
baa3ddc49c doc: add release notes about `getreceivedbylabel` returning an error if the label is not in the address book. (furszy)
8897a21658 rpc: getreceivedbylabel, don't loop over the entire wallet txs map if no destinations were found for the input label. (furszy)

Pull request description:

  Built on top of #23662, coming from comment https://github.com/bitcoin/bitcoin/pull/23662#pullrequestreview-971407999.

  If `wallet.GetLabelAddresses()` returns an empty vector (the wallet does not have stored destinations with that label in the addressbook) or if none of the returned destinations are from the wallet, we can return the function right away.
  Otherwise, we are walking through all the wallet txs + outputs for no reason (`output_scripts` is empty).

ACKs for top commit:
  achow101:
    ACK baa3ddc49c
  theStack:
    re-ACK baa3ddc49c
  w0xlt:
    ACK baa3ddc49c

Tree-SHA512: 00e10365b179bf008da2f3ef8fbb3ee04a330426374020e3f2d0151b16991baba4ef2b944e4659452f3e4d6cb20f128d0918ddf0453933a25a4d9fd8414a1911
2022-05-23 12:15:14 -04:00
laanwj
908fb7e2ec test: Use permissions from git in lint-files.py
Instead of using permissions from the local file system, which might
depend on the umask, directly check the permissions from git's metadata.
2022-05-23 11:09:07 +02:00
furszy
8897a21658
rpc: getreceivedbylabel, don't loop over the entire wallet txs map if no destinations were found for the input label.
If wallet.GetLabelAddresses() returns an empty vector (the wallet does not have addresses with that label in the addressbook) or if none of the returned destinations are from the wallet, we can return the function right away.
2022-05-20 16:32:09 -03:00
MacroFake
a7e3afb221
Merge bitcoin/bitcoin#25171: rpc: wallet: remove -deprecatedrpc=exclude_coinbase logic
a4703ce9d7 doc: add release notes about removal of the `deprecatedrpc=exclude_coinbase` (Sebastian Falbesoner)
ef0aa74836 rpc: wallet: remove `-deprecatedrpc=exclude_coinbase` logic (Sebastian Falbesoner)

Pull request description:

  Including coinbase transactions in `receivedby` RPCs and adding the `-deprecatedrpc=exclude_coinbase` was done in PR #14707 (released in v23.0). For the next release v24.0, this configuration option can be removed.

ACKs for top commit:
  fanquake:
    ACK a4703ce9d7

Tree-SHA512: 97cd4e78501e64f678c78d2ebb5be5376688c023e34fced71dd24e432d27aa31a74b5483545f49ba0bdf48656d8b8b7bee74e3db26cf6daf112613f1caa4dfa4
2022-05-20 08:48:09 +01:00
MacroFake
4a8709821e
Merge bitcoin/bitcoin#24830: init: Allow -proxy="" setting values
1d4122dfef init: Allow -proxy="" setting values (Ryan Ofsky)

Pull request description:

  This drops the `No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>` error when a empty `-proxy=` command line argument, `bitcoin.conf` value, or `settings.json` value is specified, and just makes bitcoin connect and listen normally in these cases.

  The error was originally added in https://github.com/bitcoin/bitcoin/pull/20003 to prevent a bare `-proxy` command line argument with no assignment from clearing proxy settings. But it was implemented in an overbroad way breaking empty `-proxy=` assignments as well.

  The motivation for this change is to prevent a GUI bug that happens with https://github.com/bitcoin/bitcoin/pull/15936, reported in https://github.com/bitcoin/bitcoin/pull/15936#pullrequestreview-937685759 by vasild, that happens after a proxy setting is enabled and disabled in the GUI. But this change also makes sense on its own to remove a potentially confusing error message.

ACKs for top commit:
  hebasto:
    re-ACK 1d4122dfef, only rebased since my recent [review](https://github.com/bitcoin/bitcoin/pull/24830#pullrequestreview-941255672).

Tree-SHA512: 753adfce199ed078a6cd9e0ea78e76c0b14070f8fcfe2a4632cd0c6dfe6b4e135ddffbe11a97e5e30520ea9e5bda00bad1493cbaef74cf425aa8613249167f53
2022-05-20 08:28:08 +01:00
MacroFake
d433f59f1e
Merge bitcoin/bitcoin#25173: test: add coverage for unknown network in -onlynet
055d94d1ab test: add coverage for unknown network in -onlynet (brunoerg)

Pull request description:

  This PR adds test coverage for the following init error by passing an unknown network in -onlynet
  0de36941ec/src/init.cpp (L1311)

ACKs for top commit:
  MarcoFalke:
    rACK 055d94d1ab

Tree-SHA512: 01bbb297afff371f6345889fa04117ff195b68f0bbf934878ba446049791fdbd7d2ce119ee4f9b3616cc0a81330d7055507dc81151acf68532c077f3575258e9
2022-05-20 08:18:02 +01:00
brunoerg
055d94d1ab test: add coverage for unknown network in -onlynet 2022-05-19 18:39:23 -03:00
Sebastian Falbesoner
1da5e45725 test: use MiniWallet for feature_dbcrash.py
This test can now be run even with the Bitcoin Core wallet disabled.
2022-05-19 17:53:30 +02:00
Sebastian Falbesoner
ef0aa74836 rpc: wallet: remove -deprecatedrpc=exclude_coinbase logic 2022-05-19 16:10:59 +02:00
fanquake
fdb82a30be
Merge bitcoin/bitcoin#25147: Net processing: follow ups to #20799 (removing support for v1 compact blocks)
bf6526f4a0 [test] Remove segwit argument from build_block_on_tip() (John Newbery)
c65bf50b44 Remove fUseWTXID parameter from CBlockHeaderAndShortTxIDs constructor (John Newbery)

Pull request description:

  This implements two of the suggestions from code reviews of PR 20799:

  - Remove fUseWTXID parameter from CBlockHeaderAndShortTxIDs constructor
  - Remove segwit argument from build_block_on_tip()

ACKs for top commit:
  dergoegge:
    Code review ACK bf6526f4a0
  naumenkogs:
    ACK bf6526f4a0

Tree-SHA512: d553791d1364b9e655183755e829b195c9b47f59c62371dbae49d9c0f8d84fec58cf18f4dde89591672ef5658e18c9cf0206c2efd70606980f87e506bc3bd4e5
2022-05-19 09:37:32 +01:00
MacroFake
bb83aba6c9
Merge bitcoin/bitcoin#25161: rpc: Put undocumented JSON failure mode behind a runtime flag
b953ea6cc6 rpc: Put undocumented JSON failure mode behind a runtime flag (Suhail Saqan)

Pull request description:

  Fixes #24695 (Put undocumented JSON failure mode behind a runtime flag)

ACKs for top commit:
  luke-jr:
    utACK b953ea6cc6
  vincenzopalazzo:
    ACK b953ea6cc6

Tree-SHA512: 2005ee1b1f3b637918390b2ecd4166f2fd8c86e3c59fba3da8a0cbd5b1dffd03190c92f6dca3c489ecce4276eaf3108b2edcf9cd6224b713adb52f5bb848163b
2022-05-19 06:44:55 +02:00
Suhail Saqan
b953ea6cc6 rpc: Put undocumented JSON failure mode behind a runtime flag
rpc: Put undocumented JSON failure mode behind a runtime flag
2022-05-18 10:50:59 -07:00
MacroFake
e016c00e98
Merge bitcoin/bitcoin#25126: test: add BIP157 message parsing support (via MESSAGEMAP)
5dc6d92077 test: make BIP157 messages default-constructible (MESSAGEMAP compatibility) (Sebastian Falbesoner)
71e4cfefe7 test: p2p: add missing BIP157 message types to MESSAGEMAP (Sebastian Falbesoner)

Pull request description:

  The script [message-capture-parser.py](https://github.com/bitcoin/bitcoin/blob/master/contrib/message-capture/message-capture-parser.py) currently doesn't support parsing the BIP157 messages `getcfilters`, `getcfheaders` and `getcfcheckpt`, e.g.
  ```
  $ ./contrib/message-capture/message-capture-parser.py msgs_recv.dat
  ...
      WARNING - Unrecognized message type b'getcfcheckpt' in /home/thestack/bitcoin/msgs_recv.dat
  ...
  ```

  This PR fixes this by adding the missing message type mappings to the [`MESSAGEMAP`](225e5b57b2/test/functional/test_framework/p2p.py (L95-L127)) in the test framework and add default-constructors for the corresponding `msg_`... classes.

  Without the second commit, the following error message would occur:
  ```
    File "/home/thestack/bitcoin/./contrib/message-capture/message-capture-parser.py", line 141, in process_file
      msg = MESSAGEMAP[msgtype]()
  TypeError: __init__() missing 2 required positional arguments: 'filter_type' and 'stop_hash'
  ```

ACKs for top commit:
  dunxen:
    tACK [5dc6d92](5dc6d92077)

Tree-SHA512: d656c4d38a856373f01d7c293ae7d2b27378a9fc248048ebf2a64725ef8b498b3ddf4f420704abdb20d0c68ca548f1777602c5e73b66821a20c97ae618f1d63f
2022-05-18 19:08:48 +02:00
MacroFake
139f789d7a
Merge bitcoin/bitcoin#25124: test: Fix intermittent race in p2p_unrequested_blocks.py
faac67cab0 test: Fix intermittent race in p2p_unrequested_blocks.py (MacroFake)

Pull request description:

  Disconnect may also result in an `OSError`, not only an `AssertionError`. Instead of maintaining a dead code path and enumerating disconnect reasons, just assume disconnection happens every time.

ACKs for top commit:
  jamesob:
    Code review ACK faac67cab0

Tree-SHA512: d2cec003168e421a5faed275cb2e1ef9fc63f9e8514f41d21da17e8964c79e5b453ccd72cd7ec62805f45293cf877be5bc8124ae98a515c0aa42d6e053409653
2022-05-18 15:39:20 +02:00
John Newbery
bf6526f4a0 [test] Remove segwit argument from build_block_on_tip()
The only place that segwit=True is for a block that contains only the
coinbase transaction. Since the witness commitment is optional if none
of the transactions have a witness, we can leave it out. This doesn't
change the test coverage, which is testing p2p compact block logic.

Suggested in https://github.com/bitcoin/bitcoin/pull/20799#discussion_r867782119
2022-05-18 13:47:54 +01:00
ishaanam
c6122f560b test: use sendall in wallet_taproot.py tests
Fixes #25129 (subtractfeefromamount=true fails with insufficient
funds)
2022-05-17 13:40:15 -04:00
fanquake
d5d40d59f8
Merge bitcoin/bitcoin#23679: Sanitize port in addpeeraddress()
ada8358ef5 Sanitize port in `addpeeraddress()` (amadeuszpawlik)

Pull request description:

  In connection to #22087, it has been [pointed out](https://github.com/bitcoin/bitcoin/pull/22087#pullrequestreview-674786285) that `addpeeraddress` needs to get its port-value sanitized.

ACKs for top commit:
  fanquake:
    ACK ada8358ef5

Tree-SHA512: 48771cd4f6940aa7840fa23488565c09dea86bd5ec5a5a1fc0374afb4857aebcd2a1f51e2d4cb7348460e0ad9793dc5d2962df457084ed2b8d8142cae650003f
2022-05-17 16:39:10 +01:00
Suhas Daftuar
48262a00f5 Add functional test for block sync from inbound peers 2022-05-17 09:36:49 -04:00
John Newbery
42882fc8fc [net processing] Only accept sendcmpct with version=2
Subsequent commits will remove support for other versions of compact blocks.

Add a test that a received `sendcmpct` message with version = 1 is
ignored.
2022-05-15 15:37:56 -04:00