Commit graph

34223 commits

Author SHA1 Message Date
dergoegge
292828cd77 [test] Test addr cache for multiple onion binds 2022-06-02 19:14:17 +02:00
laanwj
a100c42a13
Merge bitcoin/bitcoin#24927: Add test util to populate mempool with random transactions, fix #24634 bug
d2f8f1b307 use testing setup mempool in ComplexMemPool bench (glozow)
aecc332a71 create and use mempool transactions using real coins in MempoolCheck (glozow)
2118750631 [test util] to populate mempool with random transactions/packages (glozow)
5374dfc4e3 [test util] use -checkmempool for TestingSetup mempool check ratio (glozow)
d7d9c7b266 [test util] add chain name to TestChain100Setup ctor (glozow)

Pull request description:

  Fixes #24634 by using the `testing_setup`'s actual mempool rather than a locally-declared mempool for running `check()`.

  Also creates a test utility for populating the mempool with a bunch of random transactions. I imagine this could be useful in other places as well; it was necessary here because we needed the mempool to contain transactions *spending coins available in the current chainstate*. The existing `CreateOrderedCoins()` is insufficient because it creates coins out of thin air.

  Also implements the separate suggestion to use the `TestingSetup` mempool in `ComplexMemPool` bench.

ACKs for top commit:
  laanwj:
    Code review ACK d2f8f1b307

Tree-SHA512: 44ab5a9e55b126b5a5bc33f05fbad1380b9c43c84736c7cf487be025e0e3f5d75216ccf5a3088b0935da817e3dacfba99d2885f75bcb6e7eaa24cd20a82c24c8
2022-06-02 19:08:43 +02:00
laanwj
636991d0c0
Merge bitcoin/bitcoin#25264: kernel: pass params to BlockManager rather than using a global
a4741bd8d4 kernel: pass params to BlockManager rather than using a global (Cory Fields)

Pull request description:

  In a discussion today, dongcarl and I realized that is the only usage of the global `Params()` left in the kernel code.

  We can use the readily available reference in `ChainstateManager` instead.

  Note: There are still some uses of `BaseParams` in the kernel, so it doesn't make sense to rearrange the definitions quite yet. Once those are gone we can split the globals into new files.

ACKs for top commit:
  MarcoFalke:
    cr ACK a4741bd8d4
  laanwj:
    Code review ACK a4741bd8d4

Tree-SHA512: bfcc0c35e6c23689e968ccc96ceda39dd5a47fe94fbe617902110fe5865c30a40ea614bcfd4b4a2c846d2e84340aa8973e70b0938786af0fecfa3e6016d7fcad
2022-06-02 19:04:53 +02:00
dergoegge
3382905bef [net] Seed addr cache randomizer with port from binding address 2022-06-02 19:03:54 +02:00
w0xlt
8cfb5627d5 qt, refactor: add translator comments in TransactionDesc::FormatTxStatus() 2022-06-02 13:56:36 -03:00
Carl Dong
d87784ac87 kernel: SanityChecks: Return an error struct
This reduces libbitcoinkernel's coupling with ui_interface and
translation.
2022-06-02 12:22:46 -04:00
laanwj
0994273649 qt: Remove unnecessary wallet includes from rpcconsole.cpp 2022-06-02 18:17:33 +02:00
Carl Dong
265d6393bf Move init::SanityCheck to kernel::SanityCheck 2022-06-02 11:42:12 -04:00
Carl Dong
fed085a1a4 init: Initialize globals with kernel::Context's life
...instead of explicitly calling init::{Set,Unset}Globals.

Cool thing about this is that in both the testing and bitcoin-chainstate
codepaths, we no longer need to explicitly unset globals. The
kernel::Context goes out of scope and the globals are unset
"automatically".

Also construct kernel::Context outside of AppInitSanityChecks()
2022-06-02 11:40:03 -04:00
Cory Fields
a4741bd8d4 kernel: pass params to BlockManager rather than using a global 2022-06-02 15:18:09 +00:00
klementtan
3a171f742c
logging: fix logging empty threadname 2022-06-02 22:30:30 +08: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
MacroFake
39ddd522c3
Merge bitcoin/bitcoin#24531: Use designated initializers
fa72e0ba15 Use designated initializers (MarcoFalke)

Pull request description:

  Designated initializers are supported since gcc 4.7 (Our minimum required is 8) and clang 3 (Our minimum required is 7). They work out of the box with C++17, and only msvc requires the C++20 flag to be set. I don't expect any of our msvc users will run into issues due to this. See also https://bitcoin.jonasschnelli.ch/ircmeetings/logs/bitcoin-core-dev/2022/bitcoin-core-dev.2022-03-10-19.00.log.html#l-114

ACKs for top commit:
  kristapsk:
    ACK fa72e0ba15
  hebasto:
    ACK fa72e0ba15

Tree-SHA512: a198e9addd9af69262a7e79ae4377b55697c8dfe768b8b3d444526544b1d1f85df46f0ae81b7541bf2f73e5868fb944b159e5bf234303c7b8b9d778afb0b2840
2022-06-02 13:05:29 +02:00
Sebastian Falbesoner
1bace0cfee test: check replaceable mismatch error in createrawtransaction RPC 2022-06-02 12:59:13 +02:00
MacroFake
1c7ef0abd1
Merge bitcoin/bitcoin#25262: test: Set maxfeerate=0 in MiniWallet sendrawtransaction()
fafaad98f7 test: Set maxfeerate=0 in MiniWallet sendrawtransaction() (MacroFake)

Pull request description:

  It should be safe to set, because MiniWallet will only ever deal with test transactions, so loss-of-funds is not a reason to keep the feerate check.

  It is beneficial to set, as it makes tests less verbose to write. Also, it may speed up tests, as the fee-check can be skipped: https://github.com/bitcoin/bitcoin/pull/25087#discussion_r877246529

ACKs for top commit:
  michaelfolkson:
    ACK fafaad98f7
  theStack:
    Code-review ACK fafaad98f7

Tree-SHA512: 94c5c163595207a295c7b21f0127d669a9307f6f8b1de5e043d43c52a6714076e2fdce65f2644308a2b90c679642c94f771dab1ff8bc5c0c8b1f5013324b3902
2022-06-01 20:16:04 +02:00
fanquake
86cc31dab6
Merge bitcoin/bitcoin#25249: Bump univalue subtree
025c6ca509 Squashed 'src/univalue/' changes from 6c19d050a9..de4f73ddca (MacroFake)
9b50a309ff refactor: Replace get_int by getInt<int> alias (MacroFake)
e4e8186ab4 refactor: Explicitly convert atomic<int> to int (João Barbosa)

Pull request description:

  This bumps the univalue subtree and changes two lines of our code. Apart from the get_int -> getInt change, this is mostly a rebase of https://github.com/bitcoin/bitcoin/pull/15975, which was closed back then.

  However, given the numerous UniValue copy bugs and performance regressions in the past years, I think it makes sense to finally go through with the changes and disable potentially expensive implicit UniValue copies, which may cause OOM.

  The changes here are not strictly required for that, but make future changes less verbose and easier to review.

ACKs for top commit:
  laanwj:
    Code review ACK fa0cc61b7f
  fanquake:
    ACK fa0cc61b7f

Tree-SHA512: 9ab9e371e6a745a80c441e99fb9cd407602a8066df883135e0ea7eced7b0c6ef0e9bc88f1d99a2b4804128d636727229f44d72b5615dbf2d70da4af63fa6adec
2022-06-01 19:13:43 +01:00
MarcoFalke
fa72e0ba15
Use designated initializers 2022-06-01 20:06:01 +02:00
MacroFake
fafaad98f7
test: Set maxfeerate=0 in MiniWallet sendrawtransaction() 2022-06-01 17:07:05 +02:00
fanquake
b752dade04
Merge bitcoin/bitcoin#25244: build: pass bdb cppflags only where needed
46a890960e build: pass bdb cppflags only where needed (fanquake)

Pull request description:

  Move bdb cppflags out of the catch-all `BITCOIN_INCLUDES`, and pass them
  only where they are needed, which is in libbitcoin_node/wallet and the tests.

ACKs for top commit:
  hebasto:
    ACK 46a890960e

Tree-SHA512: ac639bf88be1c21c5205bb14c983330c72c37f17ec4c15a746a86c54dd83853e3d75802eff48c4647484b07c1bae943ca2c3d61d2a8b0bed07d9c5b4a71dcec4
2022-06-01 15:57:52 +01: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
laanwj
dd52f79a73
Merge bitcoin/bitcoin#24416: doc: Avoid ADL for function calls
52a797bfe5 doc: Avoid ADL for function calls (Hennadii Stepanov)

Pull request description:

  It happened two times recently, when [ADL](https://en.cppreference.com/w/cpp/language/adl) popped up unexpectedly and brought some confusion:
  - https://github.com/bitcoin/bitcoin/pull/24338/files#r805989994
  > Any idea why this even compiles?
  - https://www.erisian.com.au/bitcoin-core-dev/log-2022-02-18.html#l-51:
  > 2022-02-18T03:24:14  \<dongcarl\> Does anyone know why this compiles? 6d3d2caa37
  > 2022-02-18T03:24:14  \<dongcarl\> GetUTXOStatsWithHasher and MakeUTXOHasher are both in the `kernel::` namespace and I never added a `using` declaration on top...
  > 2022-02-18T03:25:53  \<sipa\> https://en.cppreference.com/w/cpp/language/adl ?

  Let's document our intention to avoid similar cases in the future.

ACKs for top commit:
  laanwj:
    Anyhow, ACK 52a797bfe5, there is no need to hold merge up on this, documenting it is a step forward.

Tree-SHA512: f52688b5d8f6130302185206ec6ea4731b099a75294ea2d477901a52d6d58473e3427e658aea408c140c2824c37a0399ec7376aded2a91197895ea52d51f0018
2022-06-01 13:32:48 +02:00
laanwj
e157b98640
Merge bitcoin/bitcoin#25165: doc: Explain squashing with merge commits
fa2d226ac9 doc: Explain squashing with merge commits (MacroFake)

Pull request description:

  This avoids having to explain it in each thread

ACKs for top commit:
  laanwj:
    ACK fa2d226ac9

Tree-SHA512: e1533ee7c0ab0101c78aaebed97dc889b5eb941cf4c2dfbabbb5f0ec1bb7b1313a1a2e2405235d68c761f039373cebac67ce691a72c820a9252429d50c1ac7d5
2022-06-01 08:39:08 +02:00
MacroFake
beb18d3fbc
Merge bitcoin/bitcoin#25259: test: check pre-segwit peer error in getblockfrompeer RPC
7d0f67a0d5 test: check pre-segwit peer error in `getblockfrompeer` RPC (Sebastian Falbesoner)

Pull request description:

  This PR adds missing test coverage for the `getblockfrompeer` RPC, in the case that a block is tried to be fetched from a pre-segwit peer (i.e. a peer that doesn't signal the service bit `NODE_WITNESS`):

  d4d9daff7a/src/net_processing.cpp (L1564-L1565)

ACKs for top commit:
  MarcoFalke:
    cr ACK 7d0f67a0d5

Tree-SHA512: bc330820686fe45577e7a53d66e2a0b339ee3ca4ef348ba3cab0a78ed891e47b3651cadf3c6c3c35d1e9a95779df010322c12d37b36700e828f6064ae35842fd
2022-06-01 08:12:16 +02:00
Sebastian Falbesoner
7d0f67a0d5 test: check pre-segwit peer error in getblockfrompeer RPC 2022-05-31 23:04:13 +02:00
Carl Dong
7d03feef81 kernel: Introduce empty and unused kernel::Context
[META] In the next commit, we will move the init::{Set,Unset}Globals
       logic into this struct.

Co-Authored-By: Ryan Ofsky <ryan@ofsky.org>
2022-05-31 14:18:31 -04:00
Carl Dong
eeb4fc20c5 test: Use Set/UnsetGlobals in BasicTestingSetup
...instead of calling initialization functions directly and having to
keep around a ECCVerifyHandle member variable.

This makes the initialization codepath of our tests more closely
resemble those of AppInitMain and potentially eases the review of
subsequent commit removing init::{Set,Unset}Globals.

[META] In a future commit, we will introduce a kernel::Context which
       calls init::{Set,Unset}Globals in its ctor and dtor. It will be
       owned by node::NodeContext, so in the end, this patchset won't
       have made the previously local ECCVerifyHandle global.
2022-05-31 14:18:31 -04:00
Hennadii Stepanov
c47944f4e9
ci: Reuse some configure options in "ARM64 Android APK" task 2022-05-31 18:49:53 +02:00
Hennadii Stepanov
7739438811
ci, android: Update NDK up to r23c 2022-05-31 18:45:13 +02:00
Hennadii Stepanov
ca0c3e5077
ci, android: Update Command-line Tools from 2.1 up to 7.0 2022-05-31 18:43:11 +02:00
Hennadii Stepanov
8790da3c1e
ci: Drop unneeded packages in "ARM64 Android APK" task 2022-05-31 15:48:25 +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
MacroFake
1f932de673
Merge bitcoin/bitcoin#25253: test: add coverage for non-hex value to -minimumchainwork
ebfc308ea4 test: add coverage for non-hex value to -minimumchainwork (brunoerg)

Pull request description:

  This PR adds test coverage for the following init error:
  b9ef5a10e2/src/init.cpp (L917-L919)

  Passing a non-hex value to -minimumchainwork should throw an initial error.

ACKs for top commit:
  laanwj:
    Code review ACK ebfc308ea4
  kristapsk:
    re-ACK ebfc308ea4

Tree-SHA512: c665903757ae3b8b2480df97bb888e60ba4387b009fcb8031041822e87a155a0e4950ebe79873c1034f0826504521d82b1fdfdb5e8378b227d14ca545b8d4e11
2022-05-31 15:10:00 +02:00
MacroFake
fa4068b4e2
Move minRelayTxFee to policy/settings
Also fix includes using iwyu
2022-05-31 15:05:57 +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
bd6c5e4108
Merge bitcoin/bitcoin#25246: Revert "build: more robustly check for fcf-protection support"
a7973bf8f4 Revert "build: more robustly check for fcf-protection support" (fanquake)

Pull request description:

  We no-longer support Clang 7 (#24164). Introduced in #20720.

  This reverts commit e9189a750b.

ACKs for top commit:
  hebasto:
    re-ACK a7973bf8f4

Tree-SHA512: 82559637f21a97434ab29f908ebda1aada08b0786cbbf0b4d11085241942314c3f04261a624c5cd2cb3c94c99046b56626830da6b9775981ab4ba10d5979f998
2022-05-31 09:36:56 +02:00
fanquake
a7973bf8f4
Revert "build: more robustly check for fcf-protection support"
We no-longer support Clang 7 (#24164).

This reverts commit e9189a750b.
2022-05-31 06:41:16 +01:00
fanquake
46a890960e
build: pass bdb cppflags only where needed
Move bdb cppflags out of the catch-all BITCOIN_INCLUDES, and pass them
only where they are needed, which is in libbitcoin_node/wallet and the
tests.
2022-05-31 06:37:43 +01:00
glozow
d2f8f1b307 use testing setup mempool in ComplexMemPool bench 2022-05-30 16:00:41 -07:00
glozow
aecc332a71 create and use mempool transactions using real coins in MempoolCheck 2022-05-30 16:00:41 -07:00
glozow
2118750631 [test util] to populate mempool with random transactions/packages 2022-05-30 16:00:41 -07:00
glozow
5374dfc4e3 [test util] use -checkmempool for TestingSetup mempool check ratio 2022-05-30 16:00:41 -07:00
glozow
d7d9c7b266 [test util] add chain name to TestChain100Setup ctor
This allows calling MakeNoLogFileContext<TestChain100Setup>
2022-05-30 16:00:41 -07:00
Hennadii Stepanov
b9ef5a10e2
Merge bitcoin-core/gui#609: wallet, refactor: Drop unused WalletModel::PaymentRequestExpired
151009cf76 qt, wallet, refactor: Drop unused `WalletModel::PaymentRequestExpired` (Hennadii Stepanov)

Pull request description:

  The `PaymentRequestExpired` value in the `WalletModel::StatusCode` enumeration has been unused since bitcoin/bitcoin#17165.

ACKs for top commit:
  furszy:
    ACK 151009cf, no usage for it.
  kristapsk:
    cr ACK 151009cf76, checked that `PaymentRequestExpired` is not referenced anywhere else.

Tree-SHA512: c2ea3443af5d369ca294d79559869f688aaa806b91ffe0090f3b34638a8377ec2f11d6f5c09cc2d11ab55035850237e60e992acba671097a6642c6bb9e709273
2022-05-30 21:33:56 +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
MacroFake
fa0cc61b7f
Bump univalue subtree 2022-05-30 16:42:13 +02:00
MacroFake
025c6ca509 Squashed 'src/univalue/' changes from 6c19d050a9..de4f73ddca
de4f73ddca Merge bitcoin-core/univalue-subtree#36: Drop overloaded members
076c051488 Drop overloaded members
06265321de Merge bitcoin-core/univalue-subtree#35: Remove get_int/get_int64 in favor of getInt<>
462c503aa4 Remove get_int/get_int64 in favor of getInt<>
68c8f5532d Merge bitcoin-core/univalue#34: doc: remove TODO
297c53a5ee doc: remove TODO

git-subtree-dir: src/univalue
git-subtree-split: de4f73ddca40487179e9ed08c6f6aa745d6cbba3
2022-05-30 16:39:58 +02:00
MacroFake
9b50a309ff refactor: Replace get_int by getInt<int> alias 2022-05-30 16:39:46 +02:00
João Barbosa
e4e8186ab4 refactor: Explicitly convert atomic<int> to int 2022-05-30 16:38:29 +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