Commit Graph

27470 Commits

Author SHA1 Message Date
Carl Dong
1fca9811e1 lint: Skip whitespace lint for guix patches 2021-01-17 18:43:58 -05:00
Carl Dong
a91c46c57d guix: Make nsis reproducible by respecting SOURCE-DATE-EPOCH
When building nsis, if VERSION is not specified, it defaults to
cvs_version which is non-deterministic as it includes the current date.

This patches nsis to default to SOURCE_DATE_EPOCH if it exists so that
nsis is reproducible.

Upstream change: https://github.com/kichik/nsis/pull/13
2021-01-17 18:43:58 -05:00
Wladimir J. van der Laan
7acda55c4f
Merge #20939: build: fix RELOC_SECTION security check for bitcoin-util
c061800bb1 build: fix RELOC_SECTION security check for bitcoin-util (fanquake)

Pull request description:

  The binutils we use for gitian builds strips the reloc section from
  Windows binaries, which breaks ASLR. As a temporary workaround, export
  main(). This is the same workaround as #18702 (bitcoin-cli), and will
  fix the currently failing security check:
  ```bash
  + make -j1 -C src check-security
  make: Entering directory '/home/ubuntu/build/bitcoin/distsrc-x86_64-w64-mingw32/src'
  Checking binary security...
  bitcoin-util.exe: failed RELOC_SECTION
  make: *** [check-security] Error 1
  ```

  Relevant upstream issue:
  https://sourceware.org/bugzilla/show_bug.cgi?id=19011

ACKs for top commit:
  dongcarl:
    ACK c061800bb1
  laanwj:
    ACK c061800bb1

Tree-SHA512: a1a4da0b2cddfc377190b9044a04f42a859ca79f11ce2c2ab4c3d066a2786c34d5446d75f8eec634f308d2d3349ebbd7c9f76dcaebeeb28e471c829851592367
2021-01-17 18:12:08 +01:00
Wladimir J. van der Laan
ad57fb756b wallet: Add BerkeleyDB version sanity check at init time
Detect version conflicts between the run-time BerkeleyDB library and the one used during compilation.

This is very unsafe (can result in anything from crashes to corruption) so shut down when one is detected.
2021-01-17 18:10:20 +01:00
Sebastian Falbesoner
4efb6c2d3b zmq test: deduplicate test setup code (node restart, topics subscription) 2021-01-17 12:58:46 +01:00
Wladimir J. van der Laan
30e664dcce
Merge #20945: Fix 0.21.0 release note to specify correct option BIP 157 support
9a42b5e655 Fix 0.21.0 release note to specify correct option BIP 157 support (benthecarman)

Pull request description:

  https://github.com/bitcoin/bitcoin/blob/master/src/init.cpp#L452

ACKs for top commit:
  mjdietzx:
    ACK 9a42b5e655
  laanwj:
    ACK 9a42b5e655

Tree-SHA512: 901195434046fd8a18a2329104b69e0ecc1bdb2bba1fe0688fb4a7c5992e9bdd66b8e50f46873f4ddf5ffe3c9aed860ccb01584812b06d865bd06fcd2b14c42b
2021-01-16 11:17:23 +01:00
Jarol Rodriguez
74d23bf7fb rpc: document RPC_TRANSACTION_ALREADY_IN_CHAIN exception
It is not documented that if you attempt to send a transaction
which already exists in a block, an RPC_TRANSACTION_ALREADY_IN_CHAIN
exception will be raised. This should be documented so that developers
are aware that this exception is raised.
2021-01-15 16:49:42 -05:00
Kiminuo
da9caa1ced Replace fs::absolute calls with AbsPathJoin calls
This adds better test coverage and will make it easier in #20744 to remove our dependency on the two-argument boost::filesystem::absolute() function which does not have a direct equivalent in C++17.
2021-01-15 22:48:15 +01:00
benthecarman
9a42b5e655
Fix 0.21.0 release note to specify correct option BIP 157 support 2021-01-15 14:05:59 -06:00
Kiminuo
66576c4fd5 test: Clear forced -walletdir setting after wallet init_tests
Leaving this value set interfered with the CreateWallet test if it happened to execute later in the test ordering. Specifically it would cause CreateWallet test to write data to the current directory instead of temporary test directory.
2021-01-15 20:19:31 +01:00
MarcoFalke
32e59fc371
Merge #20916: rpc: Return wtxid from testmempoolaccept
fa0aa87071 rpc: Return wtxid from testmempoolaccept (MarcoFalke)

Pull request description:

  It would be nice if `testmempoolaccept` returned the unique wtxid directly to avoid a costly `decoderawtransaction` roundtrip

ACKs for top commit:
  mjdietzx:
    utACK fa0aa87071
  stackman27:
    utACK [`fa0aa87`](fa0aa87071)
  glozow:
    cr ACK fa0aa87071

Tree-SHA512: 05dbaf46d93e47e9eedb725c2f57175e6d4e1722da0531fe4f80e74fc2518911da87634f25f61fa2bc8d87a3017e82fd0684b09a0a9706d71deed970035c2e7a
2021-01-15 20:13:34 +01:00
MarcoFalke
0a1cf6c347
Merge #20908: fuzz: Use mocktime in process_message* fuzz targets
fa0a864b38 fuzz: Use mocktime in process_message* fuzz targets (MarcoFalke)

Pull request description:

  Use mocktime to allow time to advance deterministically during execution of a fuzz input. This also allows to drop the call to `JumpOutOfIbd`.

ACKs for top commit:
  practicalswift:
    cr ACK fa0a864b38

Tree-SHA512: e92fc70ec6bd49760173cb202549f364304e22b3f7127b9a4da8447cf9341008e477ad42c2599c2fde167bbcbc0e2d139709b4ef6371788bc2c1c3b7f589e11d
2021-01-15 19:56:18 +01:00
fanquake
c061800bb1
build: fix RELOC_SECTION security check for bitcoin-util
The binutils we use for gitian builds strips the reloc section from
Windows binaries, which breaks ASLR. As a temporary workaround, export
main(). This is the same workaround as #18702 (bitcoin-cli), and will
fix the currently failing security check:
```bash
+ make -j1 -C src check-security
make: Entering directory '/home/ubuntu/build/bitcoin/distsrc-x86_64-w64-mingw32/src'
Checking binary security...
bitcoin-util.exe: failed RELOC_SECTION
make: *** [check-security] Error 1
```

Relevant upstream issue:
https://sourceware.org/bugzilla/show_bug.cgi?id=19011
2021-01-15 11:53:14 +08:00
fanquake
54ce4fac80
build: improve macro for testing -latomic requirement
riscv builds are currently failing because -latomic isn't being linked
against, when it is needed:
```bash
/home/ubuntu/build/bitcoin/distsrc-riscv64-linux-gnu/src/bitcoin-util.cpp:98: undefined reference to `__atomic_exchange_1'
```

This exteneds our macro to ensure that -latomic is linked against when
required.
2021-01-15 10:54:07 +08:00
fanquake
2c010b9c56
add std::atomic include to bitcoin-util.cpp 2021-01-15 10:40:29 +08:00
fanquake
f91587f050
Merge #20834: locks and docs in ATMP and CheckInputsFromMempoolAndCache
2f463f57e3 [doc] for CheckInputsFromMempoolAndCache (gzhao408)
85cc6bed64 lock annotations for MemPoolAccept functions (gzhao408)

Pull request description:

  This is a very small PR that adds some lock annotations to clarify that, now, the `pool.cs` lock is held throughout tx validation for mempool.  The comments in `CheckInputsFromMempoolAndCache` were unclear/outdated so I updated those as well.

  ~This PR is a cleanup. It removes unnecessary code that doesn't do much.~

ACKs for top commit:
  sdaftuar:
    utACK 2f463f57e3
  jnewbery:
    utACK 2f463f57e3
  MarcoFalke:
    cr ACK 2f463f57e3
  fanquake:
    ACK 2f463f57e3

Tree-SHA512: 5863a546b00ef02eba8f208c2c04c32f64671f17c967a5e3c51332fc0f472e5e9addddae075d0b91c77caebe1be9331317646b0bec802e86d9550773fd9621a9
2021-01-14 23:35:41 +08:00
MarcoFalke
29d2aeb4a2
Merge #20828: fuzz: Introduce CallOneOf helper to replace switch-case
fa75d40ef8 fuzz: Introduce CallOneOf helper to replace switch-case (MarcoFalke)

Pull request description:

  The current `switch (fuzzed_data_provider.ConsumeIntegralInRange<int>(0, nn)) { case 0: ... case 1: ... case nn: ...` has several problems:

  * It makes it hard to review newly added targets, because it requires manual counting of cases
  * It makes it hard to update a target, because updating all case labels is trivial, but tedious to review and causes merge conflicts
  * ~~Updating the target raises the question whether the case labels should be preserved to not invalidate the existing fuzz inputs format. Fuzz input format might already change implicitly on every commit, so this isn't something worthwhile to pursue.~~ Edit: This pull doesn't fix this problem.

  Fix all issues by adding a new `CallOneOf` helper

ACKs for top commit:
  ajtowns:
    ACK fa75d40ef8 - code review only
  jnewbery:
    utACK fa75d40ef8

Tree-SHA512: 2daa602b240b86c8e85a024e008f03a57ba60349377eed771f4d21a97a9dba9b66e93fff16ff1992018d4330be7a1a276944c3dfdf698748ce135626c380e563
2021-01-14 11:07:22 +01:00
Wladimir J. van der Laan
ad571bd354
Merge #20931: doc: Add historic 0.21.0 release notes
faea902721 doc: Add historic 0.21.0 release notes (MarcoFalke)

Pull request description:

  Archive the notes

ACKs for top commit:
  laanwj:
    ACK faea902721

Tree-SHA512: a9b5f4ff9c8273b54c81cc9ece0e90dcb2383ee9971a552b9d5ae5ce77ae29b970a4a4240d22e8e07811cc7e64e78adab841592ab3cd5d729c80233e033baf51
2021-01-14 10:47:10 +01:00
MarcoFalke
faea902721
doc: Add historic 0.21.0 release notes 2021-01-14 10:40:43 +01:00
MarcoFalke
cb2c578451
Merge bitcoin-core/gui#148: Bugfix: GUI: Restore SendConfirmationDialog button default to "Yes"
8775691383 Bugfix: GUI: Restore SendConfirmationDialog button default to "Yes" (Luke Dashjr)

Pull request description:

  The SendConfirmationDialog is used for bumping the fee, where "Send" doesn't really make sense

  Originally https://github.com/bitcoin/bitcoin/pull/17463, but rewritten here much simpler based on other merged changes.

ACKs for top commit:
  hebasto:
    ACK 8775691383, tested on Linux Mint 20.1 (x86_64, Qt 5.12.8):

Tree-SHA512: 3953cc9c09613c9a629def8b4dc061b537f148ddcb378430645602e0be0f3a9f1cff083aa685b94b2e9372300d02ec97e0d9ea89db6e3c6feec86795090f0f77
2021-01-13 17:47:46 +01:00
MarcoFalke
22fa9673b0
Merge #20917: doc, rpc: add missing signet mentions in network name lists
fc726e0138 doc, rpc: add missing signet mentions in network name lists (Sebastian Falbesoner)

Pull request description:

  This small PR adds a few missing mentions of signet w.r.t. chain enumerations:

  - RPC `getblockchaininfo`: result description for `"chain"`
  - RPC `getmininginfo`: result description for `"chain"`
  - REST interface documentation:
      - default ports listing for each chain
      - `"chain"` description for `chaininfo` endpoint result

  The instances were identified via `git grep -i "main.*test.*reg"`.

ACKs for top commit:
  ajtowns:
    ACK fc726e0138 -- quick code review only
  benthecarman:
    ACK fc726e0138

Tree-SHA512: 62cdc6ef74fa10db75cc04b9eaf7367183f726b3fee3d21fdf741b3816669dd21508735e89da389ddac980f49773ab229263748d1399553375fefe4526361846
2021-01-13 17:31:47 +01:00
jarolrod
c943282b5e validation: remove redundant check on pindex
This removes a conditional that checks if pindex is equal to nullptr.
This check is redundant because the branch where pindex is set returns at an earlier time. Additionaly, The independence of the earlier and later pindex is made clearer.
2021-01-13 11:22:06 -05:00
John Newbery
06fa85cd50 [net] InactivityCheck() takes a CNode reference 2021-01-13 16:18:12 +00:00
Wladimir J. van der Laan
e7eb37128c
Merge #20913: doc: Add manual page generation for bitcoin-util
bc99ae77e4 scripted-diff: Fix typo in stub manual pages (Wladimir J. van der Laan)
b5e93f873a doc: Add manual page generation for bitcoin-util (Wladimir J. van der Laan)

Pull request description:

  - Add `-version` option to `bitcoin-util`
  - Add `bitcoin-util` call to `gen-manpages.sh`
  - Add stub manual page `bitcoin-util.1`
  - Add install of `bitcoin-util.1` to build system

ACKs for top commit:
  fanquake:
    ACK bc99ae77e4

Tree-SHA512: 948df66c62bbca1cf6da26845dfa63f8f5d036a3d5744add468dd1ce7f442c123d7b0db7011c2e8e3ee6539fd391c7ee2c21b706ec81b21b02821c9501cd077d
2021-01-13 10:16:09 +01:00
Wladimir J. van der Laan
60427ee35f
Merge #20811: refactor: move net_processing implementation details out of header
c97f70c861 net_processing: move Peer definition to .cpp (Anthony Towns)
e0f2e6d2df net_processing: move PeerManagerImpl into cpp file (Anthony Towns)
a568b82feb net_processing: split PeerManager into interface and implementation classes (Anthony Towns)
0df3d3fd6b net_processing: make more of PeerManager private (Anthony Towns)
0d246a59b6 net, net_processing: move NetEventsInterface method docs to net.h (Anthony Towns)

Pull request description:

  Moves the implementation details of `PeerManager` and all of `struct Peer` into net_processing.cpp.

ACKs for top commit:
  jnewbery:
    ACK c97f70c861
  Sjors:
    ACK c97f70c861
  laanwj:
    Code review ACK c97f70c861
  vasild:
    ACK c97f70c861

Tree-SHA512: 2e081e491d981c61bd78436a6a6c2eb41d3c2d86a1a8ef9d4d6f801b82cb64a8bf707a96db3429418d1704cffb60a657d1037a0336cbc8173fb79aef9eb72001
2021-01-13 09:48:06 +01:00
Wladimir J. van der Laan
8ffaf5c2f5
Merge #19935: Move SaltedHashers to separate file and add some new ones
281fd1a4a0 Replace KeyIDHasher with SaltedSipHasher (Andrew Chow)
210b693db6 Add generic SaltedSipHasher (Andrew Chow)
95e61c1cf2 Move Hashers to util/hasher.{cpp/h} (Andrew Chow)

Pull request description:

  There are existing `SaltedOutPointHasher` and `SaltedTxidHasher` classes used for `std::unordered_map` and `std::unordered_set` that could be useful in other places in the codebase. So we these to their own `saltedhash.{cpp/h}` file. An existing `KeyIDHasher` is moved there too. Additionally, `ScriptIDHasher`, `SaltedPubkeyHasher`, and `SaltedScriptHasher` are added so that they can be used in future work.

  `KeyIDHasher` and `ScriptIDHasher` are not salted so that equality comparisons of maps and sets keyed by `CKeyID` and `CScriptID` will actually work.

  Split from #19602 (and a few other PRs/branches I have).

ACKs for top commit:
  laanwj:
    Code review ACK 281fd1a4a0
  jonatack:
    ACK 281fd1a4a0, code review, debug build and ran bitcoind after rebasing to master @ dff0f6f753
  fjahr:
    utACK 281fd1a4a0

Tree-SHA512: bb03b231ccf3c9ecefc997b8da9c3770af4819f9be5b0a72997a103864e84046a2ac39b8eadf0dc9247bdccd53f86f433642e3a098882e6748341a9e7736271b
2021-01-13 08:49:17 +01:00
MarcoFalke
fa0a864b38
fuzz: Use mocktime in process_message* fuzz targets 2021-01-13 07:48:41 +01:00
sinetek
2a39ccf133 Add include for std::bind. 2021-01-13 02:05:00 +01:00
MarcoFalke
fa0aa87071
rpc: Return wtxid from testmempoolaccept 2021-01-12 18:43:43 +01:00
Sebastian Falbesoner
fc726e0138 doc, rpc: add missing signet mentions in network name lists 2021-01-12 18:43:31 +01:00
Wladimir J. van der Laan
bc99ae77e4 scripted-diff: Fix typo in stub manual pages
-BEGIN VERIFY SCRIPT-
sed -i 's/placefolder/placeholder/' $(git ls-files doc/man/\*.1)
-END VERIFY SCRIPT-
2021-01-12 16:46:55 +01:00
Wladimir J. van der Laan
b5e93f873a doc: Add manual page generation for bitcoin-util
- Add `-version` option to `bitcoin-util`
- Add `bitcoin-util` call to `gen-manpages.sh`
- Add stub manual page `bitcoin-util.1`
- Add install of `bitcoin-util.1` to build system
2021-01-12 14:09:21 +01:00
Wladimir J. van der Laan
7b975639ef
Merge #19937: signet mining utility
595a34dbea contrib/signet: Document miner script in README.md (Anthony Towns)
ff7dbdc08a contrib/signet: Add script for generating a signet chain (Anthony Towns)
13762bcc96 Add bitcoin-util command line utility (Anthony Towns)
95d5d5e625 rpc: allow getblocktemplate for test chains when unconnected or in IBD (Anthony Towns)
81c54dec20 rpc: update getblocktemplate with signet rule, include signet_challenge (Anthony Towns)

Pull request description:

  Adds `contrib/signet/miner` for mining signet blocks.

  Adds `bitcoin-util` cli utility, with the idea being it can provide bitcoin related functionality that does not rely on the ability to access a running node. Only subcommand currently is "grind" which takes a hex-encoded header and grinds its nonce until its nBits is satisfied.

  Updates `getblocktemplate` to include `signet_challenge` field, and makes `getblocktemplate` require the signet rule when invoked on the signet change. Removes connectivity and IBD checks from `getblocktemplate` when applied to a test chain (regtest, testnet, signet).

ACKs for top commit:
  laanwj:
    code review ACK 595a34dbea

Tree-SHA512: 8d43297710fdc1edc58acd9b53e1bd1671e5724f7097b40ab73653715dc8becc70534c4496cbba9290f4dd6538a7a3d5830eb85f83391ea31a3bb5b9d3378cc3
2021-01-12 12:53:45 +01:00
fanquake
18017152c2
Merge #20619: guix: Quality of life improvements
570e43fe72 guix: Print build params inside/outside of container (Carl Dong)
2f9d1fdde6 guix: Move DISTSRC determination to guix-build.sh (Carl Dong)
0b7cd07bb5 guix: Move OUTDIR determination+creation to guix-build.sh (Carl Dong)
d27ff8b86a guix: Add more sanity checks to guix-build.sh (Carl Dong)
57f9533146 guix: Add section headings to guix-build.sh (Carl Dong)
38b7b2ed72 genbuild: Specify rev-parse length (Carl Dong)
036dc740da docs: Point to contrib/guix/README.md in doc/guix.md (Carl Dong)
34f0fda2d3 guix: Small updates to README wording (Carl Dong)
402e3a5b1e guix: Update HOSTS README entry for new architectures (Carl Dong)
cfa7ceb21b guix: Remove README development environment section (Carl Dong)
93b6a8544a guix: Add ADDITIONAL_GUIX_{COMMON,TIMEMACHINE}_FLAGS options (Carl Dong)
0f31e24703 guix: Add SUBSTITUTE_URLS option (Carl Dong)
444fcfca90 guix: Make guix honor MAX_JOBS setting (Carl Dong)

Pull request description:

  After live-demo-ing a Guix build (which completed successfully!) on achow101's stream, I realized there were a few quality of life improvements which can be made to improve the user experience of our Guix build process. Here are a few of them.

  Notable changes:
  1. When `MAX_JOBS` is specified, both `guix time-machine` and `guix environment` will now build up to `MAX_JOBS` packages at a time when creating the build environment
  2. The instructions for using substitutes were incorrect, and has now been replaced with a `SUBSTITUTE_URLS` environment variable, which works well with shell's IFS splitting rules
  3. New `ADDITIONAL_GUIX_{COMMON,TIMEMACHINE}_FLAGS` options, for more granular customization of the build process.
  4. README cleanup

ACKs for top commit:
  fanquake:
    ACK 570e43fe72 - lets move this forward.

Tree-SHA512: 4e8ab560522ade5efb5e8736aec0fb1a3f19ae9deb586c1ab87020816876f3f466a950b3f8c04d9fa1d072ae5ee780038c5c9063577049bdd9db17978e11c328
2021-01-12 18:53:35 +08:00
gzhao408
2f463f57e3 [doc] for CheckInputsFromMempoolAndCache 2021-01-12 02:27:09 -08:00
gzhao408
85cc6bed64 lock annotations for MemPoolAccept functions
We should already have the mempool lock when entering
CheckInputsFromMempoolAndCache
2021-01-12 02:27:09 -08:00
Anthony Towns
595a34dbea contrib/signet: Document miner script in README.md 2021-01-12 18:34:29 +10:00
Anthony Towns
ff7dbdc08a contrib/signet: Add script for generating a signet chain 2021-01-12 18:34:29 +10:00
Anthony Towns
13762bcc96 Add bitcoin-util command line utility 2021-01-12 18:34:25 +10:00
fanquake
7838db141b
Merge #20495: sync: Use decltype(auto) return type for WITH_LOCK
3eb94ec81b sync: Use decltype(auto) return type for WITH_LOCK (Carl Dong)

Pull request description:

  > Now that we're using C++17, we can use the decltype(auto) return type
  > for functions and lambda expressions.
  >
  > As demonstrated in this commit, this can simplify cases where previously
  > the compiler failed to deduce the correct return type.
  >
  > Just for reference, for the "assign to ref" cases fixed here, there are
  > 3 possible solutions:
  >
  > - Return a pointer and immediately deref as used before this commit
  > - Make sure the function/lambda returns declspec(auto) as used after
  >   this commit
  > - Class& i = WITH_LOCK(..., return std::ref(...));
  >
  > -----
  >
  > References:
  > 1. https://en.cppreference.com/w/cpp/language/function#Return_type_deduction
  > 2. https://en.cppreference.com/w/cpp/language/template_argument_deduction#Other_contexts
  > 3. https://en.cppreference.com/w/cpp/language/auto
  > 4. https://en.cppreference.com/w/cpp/language/decltype
  >
  > Explanations:
  > 1. https://stackoverflow.com/a/21369192
  > 2. https://stackoverflow.com/a/21369170

  Thanks to sipa and ryanofsky for helping me understand this

ACKs for top commit:
  jnewbery:
    utACK 3eb94ec81b
  hebasto:
    ACK 3eb94ec81b, I have reviewed the code and it looks OK, I agree it can be merged. I have verified possible warnings:
  ryanofsky:
    Code review ACK 3eb94ec81b

Tree-SHA512: 5f55c7722aeca8ea70e5c1a8db93e93ba0e356e8967e7f607ada38003df4b153d73c29bd2cea8d7ec1344720d37d857ea7dbfd2a88da1d92e0e9cbb9abd287df
2021-01-12 15:56:19 +08:00
MarcoFalke
6af013792f
Merge #19315: [tests] Allow outbound & block-relay-only connections in functional tests.
b4dd2ef800 [test] Test the add_outbound_p2p_connection functionality (Amiti Uttarwar)
602e69e427 [test] P2PBlocksOnly - Test block-relay-only connections. (Amiti Uttarwar)
8bb6beacb1 [test/refactor] P2PBlocksOnly - Extract transaction violation test into helper. (Amiti Uttarwar)
99791e7560 [test/refactor] P2PBlocksOnly - simplify transaction creation using blocktool helper. (Amiti Uttarwar)
3997ab9154 [test] Add test framework support to create outbound connections. (Amiti Uttarwar)
5bc04e8837 [rpc/net] Introduce addconnection to test outbounds & blockrelay (Amiti Uttarwar)

Pull request description:

  The existing functional test framework uses the `addnode` RPC to spin up manual connections between bitcoind nodes. This limits our ability to add integration tests for our networking code, which often executes different code paths for different connection types.

  **This PR enables creating `outbound` & `block-relay-only` P2P connections in the functional tests.** This allows us to increase our p2p test coverage, since we can now verify expectations around these connection types.

  This builds out the [prototype](https://github.com/bitcoin/bitcoin/issues/14210#issuecomment-527421978) proposed by ajtowns in #14210. 🙌🏽

  An overview of this branch:
  - introduces a new test-only RPC function `addconnection` which initiates opening an `outbound` or `block-relay-only` connection. (conceptually similar to `addnode` but for different connection types & restricted to regtest)
  - adds `test_framework` support so a mininode can open an `outbound`/`block-relay-only` connection to a `P2PInterface`/`P2PConnection`.
  - updates `p2p_blocksonly` tests to create a `block-relay-only` connection & verify expectations around transaction relay.
  - introduces `p2p_add_connections` test that checks the behaviors of the newly introduced `add_outbound_p2p_connection` test framework function.

  With these changes, there are many more behaviors that we can add integration tests for. The blocksonly updates is just one example.

  Huge props to ajtowns for conceiving the approach & providing me feedback as I've built out this branch. Also thank you to jnewbery for lots of thoughtful input along the way.

ACKs for top commit:
  troygiorshev:
    reACK b4dd2ef800
  jnewbery:
    utACK b4dd2ef800
  MarcoFalke:
    Approach ACK b4dd2ef800 🍢

Tree-SHA512: d1cba768c19c9c80e6a38b1c340cc86a90701b14772c4a0791c458f9097f6a4574b4a4acc7d13d6790c7b1f1f197e2c3d87996270f177402145f084ef8519a6b
2021-01-11 21:06:57 +01:00
fanquake
6d81d7aa87
Merge #20787: Use C++17 std::array deduction for OUTPUT_TYPES, ALL_FEE_ESTIMATE_HORIZONS
aaaa987840 refactor: Use C++17 std::array deduction for ALL_FEE_ESTIMATE_HORIZONS (MarcoFalke)
fa39cdd072 refactor: Use C++17 std::array deduction for OUTPUT_TYPES (MarcoFalke)

Pull request description:

  With the new C++17 array deduction rules, an array encompassing all values in an enum can be specified in the same header file that specifies the enum. This is useful to avoid having to repeatedly enumerate all enum values in the code. E.g. the RPC code, but also the fuzz code.

ACKs for top commit:
  theStack:
    cr ACK aaaa987840 ⚙️
  fanquake:
    ACK aaaa987840

Tree-SHA512: b71bd98f3ca07ddfec385735538ce89a4952e418b52dc990fb160187ccef1fc7ebc139d42988b6f7b48df24823af61f803b83d47fb7a3b82475f0c0b109bffb7
2021-01-11 21:46:09 +08:00
MarcoFalke
5cce607105
Merge #20373: refactor, net: Increase CNode data member encapsulation
3642b2ed34 refactor, net: Increase CNode data member encapsulation (Hennadii Stepanov)
acebb79d3f refactor, move-only: Relocate CNode private members (Hennadii Stepanov)

Pull request description:

  All protected `CNode` data members could be private.

ACKs for top commit:
  jnewbery:
    utACK 3642b2ed34
  MarcoFalke:
    review ACK 3642b2ed34 🏛

Tree-SHA512: 8435e3c43c3b7a3107d58cb809b8b5e1a1c0068677e249bdf0fc6ed24140ac4fc4efe2a280a1ee86df180d738c0c9e10772308690607954db6713000cf6e728d
2021-01-11 13:19:43 +01:00
Wladimir J. van der Laan
675af2a515
Merge #20852: net: allow CSubNet of non-IP networks
39b43298d9 test: add test for banning of non-IP addresses (Vasil Dimov)
94d335da7f net: allow CSubNet of non-IP networks (Vasil Dimov)

Pull request description:

  Allow creation of valid `CSubNet` objects of non-IP networks and only
  match the single address they were created from (like /32 for IPv4 or
  /128 for IPv6).

  This fixes a deficiency in `CConnman::DisconnectNode(const CNetAddr& addr)`
  and in `BanMan` which assume that creating a subnet from any address
  using the `CSubNet(CNetAddr)` constructor would later match that address
  only. Before this change a non-IP subnet would be invalid and would not
  match any address.

ACKs for top commit:
  jonatack:
    Code review re-ACK 39b43298d9 per `git diff 5e95ce6 39b4329`; only change since last review is improvements to the functional test; verified the test fails on master @ 616eace0 where expected (`assert(self.is_banned(node, tor_addr))` fails and unban unfails)
  laanwj:
    code review ACK 39b43298d9

Tree-SHA512: 3239b26d0f2fa2d1388b4fdbc1d05ce4ac1980be699c6ec46049409baefcb2006b1e72b889871e2210e897f6725c48e873f68457eea7e6e4958ab4f959d20297
2021-01-11 11:27:47 +01:00
MarcoFalke
fa75d40ef8
fuzz: Introduce CallOneOf helper to replace switch-case
Can be reviewed with --ignore-all-space
2021-01-11 10:37:16 +01:00
jackielove4u
92370033a2
contrib: embed C++11 patch in install_db4.sh 2021-01-11 10:34:27 +01:00
Jonas Schnelli
616eace02a
Merge bitcoin-core/gui#161: Add PeerTableModel::StatsRole to prevent data layer violation
b3e9bcaac8 qt, refactor: Drop no longer used PeerTableModel::getNodeStats function (Hennadii Stepanov)
49c604077c qt: Use PeerTableModel::StatsRole (Hennadii Stepanov)
35007edf9c qt: Add PeerTableModel::StatsRole (Hennadii Stepanov)

Pull request description:

  This PR allows to access to the `CNodeCombinedStats` instance directly from any view object.

  The `PeerTableModel::getNodeStats` member function removed as a kind of layer violation.

  No behavior changes.

  Also other pulls (bugfixes) are based on this one: #18 and #164.

ACKs for top commit:
  jonatack:
    Tested re-ACK b3e9bcaac8 per `git range-diff ae8f797 4c05fe0 b3e9bca`
  promag:
    Code review ACK b3e9bcaac8.
  jonasschnelli:
    utACK b3e9bcaac8

Tree-SHA512: 6ba50d5dd2c0373655d491ce8b130c47d598da2db5ff4b00633f447404c7e70f8562ead53ddf166e851384d9632ff9146a770c99845c2cdd3ff7250677e4c130
2021-01-11 09:06:21 +01:00
MarcoFalke
9c0b76c709
Merge #20876: test: Replace getmempoolentry with testmempoolaccept in MiniWallet
faabc26a61 test: Replace getmempoolentry with testmempoolaccept in MiniWallet (MarcoFalke)

Pull request description:

  This is a refactor to not use the return value of `sendrawtransaction` and `getmempoolentry` with the goal that submitting the tx to the mempool will become optional.

ACKs for top commit:
  mjdietzx:
    ACK faabc26a61

Tree-SHA512: 4260a59e65fed1c807530dad23f1996ba6e881bcce91995f5b498a0be6001f67b3e0251507c8801750fe105410147c68bb2f393ebe678c6a3a4d045e5d72fc19
2021-01-11 08:57:28 +01:00
fanquake
bd6af53e1f
Merge #20480: Replace boost::variant with std::variant
faa8f68943 Replace boost::variant with std::variant (MarcoFalke)

Pull request description:

  Now that we can use std::variant from the vanilla standard library, drop the third-party boost variant dependency

ACKs for top commit:
  fjahr:
    Code review ACK faa8f68943
  fanquake:
    ACK faa8f68943

Tree-SHA512: 6e3aecd33b00c2e31a763f999247944d5b2ce5e3018f1965c516c1000cd08ff6703a8d50fb0be64883153da2925ae72986b8a6b96586db74057bd05d6f4986e6
2021-01-11 12:05:46 +08:00
fanquake
c4458cc3a1
Merge #18819: net: Replace cs_feeFilter with simple std::atomic
fad1f0fd33 net: Remove unused cs_feeFilter (MarcoFalke)

Pull request description:

  A `RecursiveMutex` is overkill for setting or reading a plain integer. Even a `Mutex` is overkill, when a plain `std::atomic` can be used.

  This removes 11 lines of code. Also, it is cutting down on the number of locks put on the stack at the same time, which complicates review looking out for potential lock contention.

ACKs for top commit:
  jnewbery:
    utACK fad1f0fd33
  practicalswift:
    cr ACK fad1f0fd33: patch looks correct

Tree-SHA512: 647f9b954fbf52e138d3e710937eb9131b390fef0deae03fd6a162d5a18b9f194010800bbddc8f89208d91be2802dff11c3884d04b3dd233865abd12aa3cde06
2021-01-11 10:14:11 +08:00