Commit graph

29109 commits

Author SHA1 Message Date
Fabian Jahr
a8a46c4b3c
refactor: Simplify ApplyStats and ApplyHash 2021-04-19 20:28:48 +02:00
Fabian Jahr
9c8a265fd2
refactor: Pass hash_type to CoinsStats in stats object 2021-04-19 20:28:48 +02:00
Fabian Jahr
2e2648a902
crypto: Make MuHash Remove method efficient
Division of MuHash objects are very expensive and multiplication relatively cheap. The whole idea of introducing and tracking numerator and denominators seperately as a representation of the internal state was so that divisions would be rare. So using divison in the Remove method did not make any sense and was just a silly mistake which is corrected here.
2021-04-19 20:28:46 +02:00
Aaron Clauson
f02ca7a354
Update msvc build to use Qt5.12.10 binaries. 2021-04-19 16:41:50 +01:00
MarcoFalke
fafb68add5
refactor: Add and use EnsureConnman in rpc code 2021-04-19 13:04:23 +02:00
Russell Yanofsky
615965cfd1 Move common package version code to init/common 2021-04-19 06:11:38 -04:00
Hennadii Stepanov
13d27b452d
Merge bitcoin-core/gui#276: Elide long strings in their middle in the Peers tab
4e0613369f qt: Elide long strings in their middle in the Peers tab (Hennadii Stepanov)

Pull request description:

  The eliding of long addresses (Onion v3 etc) in the Peers tab in their middle was [discussed](https://github.com/bitcoin-core/gui/issues/262#issuecomment-810490396) in #262.

  On master (f0fa32450e):
  ![DeepinScreenshot_select-area_20210410141435](https://user-images.githubusercontent.com/32963518/114267903-24eea400-9a07-11eb-8c80-99f68d5cc522.png)

  With this PR:
  ![DeepinScreenshot_select-area_20210410140430](https://user-images.githubusercontent.com/32963518/114267796-83675280-9a06-11eb-921f-ca47c2075496.png)

  This PR suggests the minimal diff to achieve the goal. OTOH, this change in behavior is common for all columns in the Peers table, but it seems harmless.

ACKs for top commit:
  jarolrod:
    tACK 4e0613369f
  promag:
    Code review ACK 4e0613369f.

Tree-SHA512: 1d5a62afb1152029e69fccea2ae53dcb262a91724a5c03dfc4de8c409b280814d0c211c2f9a71f1a6e927f4ed571ba4ac311de9de8ebb797eaf1051674241bdb
2021-04-19 13:11:38 +03:00
Russell Yanofsky
5bed2ab42c Move common logging start code to init/common 2021-04-19 06:11:38 -04:00
Russell Yanofsky
1fb7fcfa52 Move common logging GetArgs code to init/common 2021-04-19 06:11:38 -04:00
Russell Yanofsky
90469c1690 Move common logging AddArg code to init/common 2021-04-19 06:11:38 -04:00
Russell Yanofsky
387c4cf588 Move common sanity check code to init/common 2021-04-19 06:11:38 -04:00
Russell Yanofsky
a67b54855b Move common global init code to init/common 2021-04-19 06:11:38 -04:00
MarcoFalke
cfec4a1dad
Merge bitcoin/bitcoin#21280: test: bug fix in transaction_tests
b109bde46a [test] check that mapFlagNames is up to date (glozow)
5d3ced72f9 [test] remove unnecessary OP_1s from invalid tests (glozow)
5aee73d175 [test] minor improvements / followups (glozow)
8a365df558 [test] fix bug in ExcludeIndividualFlags (glozow)
8cac2923f5 [test] remove invalid test from tx_valid.json (glozow)

Pull request description:

  This is a followup to #19698.

  - There was a bug in the `ExcludeIndividualFlags` function which is fixed here.
  - Fixing this bug also showed that there is a test that's supposed to fail (already existing in tx_invalid.json) in tx_valid.json, so I removed it. Other than that, the tests should all pass.
  - Also implements a few suggestions I received offline: removing the `OP_1`s from the invalid tests (similar to 19db590d04), comments, and style.
  - A few other small fixes, like adding asserts, putting all the flags in `mapFlagNames`, better error messages

ACKs for top commit:
  jnewbery:
    utACK b109bde46a

Tree-SHA512: 7233a8c0f1ae1172fac8000ea6e05384ecf79074c39948d118464868505c7f02f17e96503c81bd05c07adb2087648a5d93d9899e16fdefa6b7efcb51319444a9
2021-04-19 11:26:42 +02:00
MarcoFalke
83c715415a
Merge #20857: test: update documentation in feature_csv_activation.py
9053b88b1c update docstring in feature_csv_activation.py (Pierre K)

Pull request description:

  These changes in the test documentation reflect the changes introduced in #17921.

ACKs for top commit:
  MarcoFalke:
    review ACK  9053b88

Tree-SHA512: 17fb954baded8dab1c869dd48b76b516150bae616c792c573e4114d4adfdd40195745c56570aa3050cc0015ee496acd7ec178df8ba14831dd22f9722fda84da2
2021-04-19 09:47:57 +02:00
Sebastian Falbesoner
f2f2541ee7 remove executable flag for src/net_processing.cpp 2021-04-19 09:47:34 +02:00
MarcoFalke
d4300a10dd
Merge #21679: rpc: Keep default argument value in correct type
bee56c78e9 rpc: Check default value type againts argument type (João Barbosa)
f81ef4303e rpc: Keep default argument value in correct type (João Barbosa)

Pull request description:

  Store default values of RPC arguments in the corresponding type instead of a string. The value is then serialized when the help output is needed. This change simplifies #20017.

  The following examples illustrates how to use the new `RPCArg::Default` and `RPCArg::DefaultHint`:

  ```diff
  - {"verbose", RPCArg::Type::BOOL, /* default */ "false", "True for a json object, false for array of transaction ids"}
  + {"verbose", RPCArg::Type::BOOL, RPCArg::Default(false), "True for a json object, false for array of transaction ids"}
  ```

  ```diff
  - {"nblocks", RPCArg::Type::NUM, /* default */ "one month", "Size of the window in number of blocks"}
  + {"nblocks", RPCArg::Type::NUM, RPCArg::DefaultHint("one month"), "Size of the window in number of blocks"}
  ```

  No behavior change is expected.

ACKs for top commit:
  LarryRuane:
    ACK bee56c78e9
  MarcoFalke:
    ACK bee56c78e9 🦅

Tree-SHA512: c47d78c918e996d36631d4ad3c933b270a34c5b446b8d736be94cf4a0a7b8c0e33d954149ec786cf9550639865b79deb6a130ad044de6030f95aac33f524293a
2021-04-19 09:04:31 +02:00
MarcoFalke
17b51cd5cb
Merge #21713: Refactor ProcessNewBlock to reduce code duplication
9a0653553a Refactor ProcessNewBlock to reduce code duplication (R E Broadley)

Pull request description:

  There are probably a few issues with this code (maybe there's even a reason this code is duplicated as it currently is), so apologies in advance that I'm still a little (maybe very) bad with C++

ACKs for top commit:
  MarcoFalke:
    ACK 9a0653553a 💻
  promag:
    Code review ACK 9a0653553a.
  theStack:
    Code-review ACK 9a0653553a 🌴

Tree-SHA512: f8634ffad4b2370204d1a0945db4e27248b9e579d9912784da432b8ee3303cae424fa9f7500000dcfb31e6d29d04a8f7d322d17a6fe3d4adaddd10c539458a8c
2021-04-19 09:01:49 +02:00
W. J. van der Laan
ed133fe005
Merge #21615: script: Add trusted key for hebasto
55d85834cc script: Add trusted key for hebasto (Hennadii Stepanov)

Pull request description:

  It is assumed that my responsibility will be limited to the [GUI repo](https://github.com/bitcoin-core/gui).

ACKs for top commit:
  laanwj:
    ACK 55d85834cc
  MarcoFalke:
    matches the key I have locally ACK 55d85834cc 🍪
  jarolrod:
    ACK 55d85834cc 🥃

Tree-SHA512: 256d03e108c9a14e251340ac6e91234d076778cb6bd551439182176207051f4efc55d396754867e5a7191c8c698610f92016668e163037c67dde56f4136026b8
2021-04-19 08:53:51 +02:00
fanquake
a47ae618a0
Merge #21718: rpc: Improve error message for getblock invalid datatype.
a411494261 rpc: Improve getblock error message for invalid data type. (klementtan)

Pull request description:

  Improve error messages for getblock invalid datatype.

  fixes: #21717

ACKs for top commit:
  instagibbs:
    utACK a411494261
  theStack:
    ACK a411494261
  promag:
    Code review ACK a411494261.

Tree-SHA512: 6e7d8290681e8ab375629f81669d0f8e0c21f9eb7ed9e2455cd19ea013e69b2d95fa7a9ee795315b2d5c60c96035c6cefc3d6e1039a06fd88c1dc7fe275ee6a1
2021-04-19 14:16:19 +08:00
João Barbosa
5f438d66c1 refactor, qt: Simplify SendCoinsDialog::updateCoinControlState 2021-04-18 21:12:57 +01:00
João Barbosa
c5a470eee1 refactor: Drop CCoinControl::SetNull 2021-04-18 21:10:47 +01:00
Pierre K
9053b88b1c update docstring in feature_csv_activation.py
These changes in the test documentation reflect the changes introduced in #17921
2021-04-18 22:05:14 +02:00
Jon Atack
36fb036d25
p2p: allow NetPermissions::ClearFlag() only with PF_ISIMPLICIT
NetPermissions::ClearFlag() is currently only called in the codebase with
an `f` value of NetPermissionFlags::PF_ISIMPLICIT.

If that should change in the future, ClearFlag() should not be called
with `f` being a subflag of a multiflag, e.g. NetPermissionFlags::PF_RELAY
or NetPermissionFlags::PF_DOWNLOAD, as that would leave `flags` in an
invalid state corresponding to none of the existing NetPermissionFlags.

Therefore, allow only calling ClearFlag with the implicit flag for now.

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2021-04-18 16:32:28 +02:00
Jon Atack
4e0d5788ba
test: add net permissions noban/download unit test coverage
to clarify/test the relationship and NetPermissions operations
involving the NetPermissionFlags PF_NOBAN and PF_DOWNLOAD.

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2021-04-18 16:32:16 +02:00
Kiminuo
bb8d1c6e02 Change ClearDataDirPathCache() to ArgsManager.ClearPathCache(). 2021-04-18 12:07:00 +02:00
Kiminuo
b4190eff72 Change GetBlocksDir() to ArgsManager.GetBlocksDirPath(). 2021-04-18 11:59:28 +02:00
Kiminuo
83292e2a70 scripted-diff: Modify unit tests to use the ArgsManager in the BasicTestingSetup class instead of implicitly relying on gArgs.
-BEGIN VERIFY SCRIPT-
git ls-files src/test/dbwrapper_tests.cpp src/test/denialofservice_tests.cpp src/test/flatfile_tests.cpp src/test/fs_tests.cpp src/test/settings_tests.cpp src/test/util_tests.cpp | xargs sed -i 's/GetDataDir()/m_args.GetDataDirPath()/g';
-END VERIFY SCRIPT-
2021-04-18 11:59:28 +02:00
Kiminuo
55c68e6f01 scripted-diff: Replace m_args with m_local_args in getarg_tests.cpp
-BEGIN VERIFY SCRIPT-
git ls-files src/test/getarg_tests.cpp | xargs sed -i "s/m_args/m_local_args/g";
-END VERIFY SCRIPT-
2021-04-18 11:59:28 +02:00
Kiminuo
511ce3a26b BasicTestingSetup: Add ArgsManager. 2021-04-18 11:59:28 +02:00
Kiminuo
1cb52ba065 Modify "util_datadir" unit test to not use gArgs. 2021-04-18 11:59:25 +02:00
klementtan
a411494261 rpc: Improve getblock error message for invalid data type. 2021-04-18 12:30:58 +08:00
Jon Atack
300234ab66
doc: update bitcoin.conf maxconnections info 2021-04-17 20:22:43 +02:00
Jon Atack
926827065f
doc: update reduce-memory.md peer connections info 2021-04-17 20:17:59 +02:00
MarcoFalke
faabeb854a
refactor: Mark member functions const 2021-04-17 20:13:34 +02:00
Kiminuo
1add318704 Move GetDataDir(fNetSpecific) implementation to ArgsManager. 2021-04-17 20:09:01 +02:00
Kiminuo
70cdf679f8 Move StripRedundantLastElementsOfPath before ArgsManager class. 2021-04-17 19:18:10 +02:00
MarcoFalke
0dd7b23489
Merge #21391: [Bundle 5/n] Prune g_chainman usage in RPC modules
586190f0b4 rpc/rest: Take and reuse local Chain/ChainState obj (Carl Dong)
bc3bd36902 rpc: style: Improve BuriedForkDescPushBack signature (Carl Dong)
f99913969f rpc: Remove unnecessary casting of block height (Carl Dong)
6a3d192020 rpc: Tidy up local references (see commit message) (Carl Dong)
038854f31e rest/rpc: Remove now-unused old Ensure functions (Carl Dong)
6fb65b49f4 scripted-diff: rest/rpc: Use renamed EnsureAny*() (Carl Dong)
1570c7ee98 rpc: Add renamed EnsureAny*() functions (Carl Dong)
306b1cd3ee rpc: Add alt Ensure* functions acepting NodeContext (Carl Dong)
d7824acdb9 rest: Use existing NodeContext (Carl Dong)
3f08934799 rest: Pass in NodeContext to rest_block (Carl Dong)
7be0671b95 rpc/rawtx: Use existing NodeContext (Carl Dong)
60dc05afc6 rpc/mining: Use existing NodeContext (Carl Dong)
d485e815e2 rpc/blockchain: Use existing NodeContext (Carl Dong)
d0abf0bf42 rpc/*,rest: Add review-only assertion to EnsureChainman (Carl Dong)
cced0f46c9 miner: Pass in previous CBlockIndex to RegenerateCommitments (Carl Dong)

Pull request description:

  Overall PR: #20158 (tree-wide: De-globalize ChainstateManager)

  Based on:
  - [x] #21270 | [Bundle 4/n] Prune g_chainman usage in validation-adjacent modules
  - [x] #21525 | [Bundle 4.5/n] Followup fixups to bundle 4

  Note to reviewers:
  1. This bundle may _apparently_ introduce usage of `g_chainman` or `::Chain(state|)Active()` globals, but these are resolved later on in the overall PR. [Commits of overall PR](https://github.com/bitcoin/bitcoin/pull/20158/commits)
  2. There may be seemingly obvious local references to `ChainstateManager` or other validation objects which are not being used in callers of the current function in question, this is done intentionally to **_keep each commit centered around one function/method_** to ease review and to make the overall change systematic. We don't assume anything about our callers. Rest assured that once we are considering that particular caller in later commits, we will use the obvious local references. [Commits of overall PR](https://github.com/bitcoin/bitcoin/pull/20158/commits)
  3. When changing a function/method that has many callers (e.g. `LookupBlockIndex` with 55 callers), it is sometimes easier (and less error-prone) to use a scripted-diff. When doing so, there will be 3 commits in sequence so that every commit compiles like so:
  	1. Add `new_function`, make `old_function` a wrapper of `new_function`, divert all calls to `old_function` to `new_function` **in the local module only**
  	2. Scripted-diff to divert all calls to `old_function` to `new_function` **in the rest of the codebase**
  	3. Remove `old_function`

ACKs for top commit:
  ryanofsky:
    Code review ACK 586190f0b4. Since last review, no changes to existing commits, just some simple new commits added: three new commits renaming std::any Ensure functions (scripted diff commit and manual pre/post commits), and one new commit factoring out a repeated `ActiveChain()` call made in a loop. Thanks for the updates!
  jnewbery:
    utACK 586190f0b4
  MarcoFalke:
    review ACK 586190f0b4 🍯

Tree-SHA512: 64b677fb50141805b55c3f1afe68fcd298f9a071a359bdcd63256d52e334f83e462f31fb3ebee9b630da8f1d912a03a128cfc38179e7aaec29a055744a98478c
2021-04-17 17:37:37 +02:00
MarcoFalke
4a1751a929
Merge bitcoin-core/gui#277: Do not use QClipboard::Selection on Windows and macOS.
7f3a5980c1 qt: Do not use QClipboard::Selection on Windows and macOS. (Hennadii Stepanov)

Pull request description:

  Windows and macOS do [not support](https://doc.qt.io/qt-5/qclipboard.html#notes-for-windows-and-macos-users) the global mouse selection.

  Fixes #258.

ACKs for top commit:
  promag:
    Code review ACK 7f3a5980c1.
  jarolrod:
    ACK 7f3a5980c1

Tree-SHA512: be2beeef7d25af6f4d4a4548325d8d29f08e4342f499666bc4a670ed468a63195d514077c2cd0dba197e12bd43316fd3e2813cdc0954364b6aa4ae6b90c118bf
2021-04-17 13:28:25 +02:00
Jon Atack
b4fcbcfb49
doc: update -maxconnections config option help 2021-04-17 12:33:06 +02:00
MarcoFalke
fa8eaee6a8
test: Run versionbits_sanity for all chains 2021-04-17 11:29:50 +02:00
MarcoFalke
f5e8bcf985
Merge #21689: test: Remove intermittently failing and not very meaningful BOOST_CHECK in cnetaddr_basic
63631beef6 test: Remove intermittently failing and not very meaningful `BOOST_CHECK` in `cnetaddr_basic` (practicalswift)

Pull request description:

  Remove intermittently failing and not very meaningful `BOOST_CHECK` in `cnetaddr_basic`.

  Fixes #21682.

  Rationale from https://github.com/bitcoin/bitcoin/issues/21682#issuecomment-819897122:

  > I've looked at that test before and I don't think that specific `BOOST_CHECK` makes much sense TBH :)
  >
  > 1.) I don't understand why we test if `ToString()` output includes `%zone_index`: it clearly doesn't on some platforms, so we cannot rely on it anyways. Then why test it?
  >
  > 2.) And perhaps more fundamentally: why would we even _want_ to have `%zone_index` in our textual `ToString()` output? I think the expectation is to get say `fe80::1ff:fe23:4567:890a` (without zone index) and not say `fe80::1ff:fe23:4567:890a%eth2 ` or `fe80::1ff:fe23:4567:890a%3 `when doing `ipv6_addr.ToString()` :)

ACKs for top commit:
  MarcoFalke:
    review ACK 63631beef6

Tree-SHA512: 06863d1edfb9ad1ca9bcae09cf3f0f47b58bb29d222b70799c3dc059b96452889026e4b99b132782846d9896e3e798d17c7f9406e0e6a0bec1bffc6edb54e9df
2021-04-17 11:18:51 +02:00
R E Broadley
9a0653553a Refactor ProcessNewBlock to reduce code duplication 2021-04-17 09:55:19 +01:00
MarcoFalke
faec1e9ee1
test: Address outstanding versionbits_test feedback
* https://github.com/bitcoin/bitcoin/pull/21377#discussion_r609585080
* https://github.com/bitcoin/bitcoin/pull/21377#discussion_r613702341
2021-04-17 10:40:47 +02:00
MarcoFalke
fad4167871
test: Check that no versionbits are re-used
This allows to remove check that windows for the same bit are disjoint

This addresses https://github.com/bitcoin/bitcoin/pull/21377#discussion_r611492633
2021-04-17 10:40:43 +02:00
MarcoFalke
8e69370b15
Merge #21712: qa: Test default include_mempool value of gettxout
44dab423eb qa: Test default include_mempool value of gettxout (João Barbosa)

Pull request description:

  With the following diff the functional test would pass. Fix by testing the default value.

  ```diff
  --- a/src/rpc/blockchain.cpp
  +++ b/src/rpc/blockchain.cpp
  @@ -1142,7 +1142,7 @@ static RPCHelpMan gettxout()
       uint256 hash(ParseHashV(request.params[0], "txid"));
       int n = request.params[1].get_int();
       COutPoint out(hash, n);
  -    bool fMempool = true;
  +    bool fMempool = false;
       if (!request.params[2].isNull())
           fMempool = request.params[2].get_bool();
  ```

ACKs for top commit:
  MarcoFalke:
    cr ACK 44dab423eb

Tree-SHA512: 14db21b29d6b2c01d1d1278e18a0cf35d6ae566e33e45515d1fe2983dda94ad1ff6065c217601d283f9515cae39b57e981b62ac71ec2002de5359bd8a9e3efa9
2021-04-17 07:50:51 +02:00
João Barbosa
bee56c78e9 rpc: Check default value type againts argument type 2021-04-17 00:22:53 +01:00
João Barbosa
f81ef4303e rpc: Keep default argument value in correct type 2021-04-17 00:22:53 +01:00
João Barbosa
44dab423eb qa: Test default include_mempool value of gettxout 2021-04-16 23:44:49 +01:00
Jon Atack
79685a8992
doc: update -addnode config option help 2021-04-16 20:39:40 +02:00
Jon Atack
2896c6c4cc
doc: update addnode rpc help 2021-04-16 20:39:27 +02:00