Commit graph

28651 commits

Author SHA1 Message Date
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
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
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
fanquake
585cbe2257
Merge #21695: Remove no longer used contrib/bitcoin-qt.pro from the repo
5f2be6e71e Remove no longer used contrib/bitcoin-qt.pro from the repo (Hennadii Stepanov)

Pull request description:

  From [IRC](http://www.erisian.com.au/bitcoin-core-dev/log-2021-04-15.html#l-209):
  > \<hebasto> wumpus: I cannot see any way how the `contrib/bitcoin-qt.pro` is used in the  translation process, neither in the main repo nor in https://github.com/bitcoin-core/bitcoin-maintainer-tools. Besides it looks outdated and unmaintained. May I ask you to confirm/deny my assumption?
  > \<wumpus> hebasto: it is not used for anything, it exists to be able to edit the qt forms in qt designer nothing more
  > \<wumpus> i'm not sure if it is even *necessary* for that, but it is why it is there
  > \<hebasto> wumpus: thanks, qt designer does not need *.pro file at all
  > \<hebasto> maybe qt creator does
  > \<wumpus> feel free to create a PR to remove it, best way to find out if someone wants to keep it, you are right it hasn't been updated in a long time
  > \<hebasto> ok
  > \<wumpus> fwiw, the only question i get about it ever is why it exists
  > \<hebasto> it was in use with `qmake` years ago (what I found digging into the repo history)
  > \<wumpus> yes, that was the original reason, but when we switched to automake it was kept around for use w/ qt's GUI tools
  > \<hebasto> I've noticed it in https://github.com/bitcoin/bitcoin/blame/master/doc/translation_process.md#L25
  > \<wumpus> what it says there is definitely not true anymore

ACKs for top commit:
  laanwj:
    ACK 5f2be6e71e
  jarolrod:
    ACK 5f2be6e71e

Tree-SHA512: 7c105612f28185097fee9e4108b162b4c8b07cc527f4438bdf5bcab08c65421ea301de8584d58770cd113fa871f6781daa8145bd6463278523449e28bfc49d06
2021-04-16 11:08:32 +08:00
Hennadii Stepanov
5f2be6e71e
Remove no longer used contrib/bitcoin-qt.pro from the repo 2021-04-15 15:39:42 +03:00
MarcoFalke
c6b30ccb2e
Merge #21630: fuzz: split FuzzedSock interface and implementation
549c82ad3a fuzz: use ConsumeBool() instead of !ConsumeBool() (Vasil Dimov)
29ae1c13a5 fuzz: split FuzzedSock interface and implementation (Vasil Dimov)
9668e43d8e fuzz: make FuzzedSock::Wait() sometimes simulate an occurred event (Vasil Dimov)
0c90ff1429 fuzz: set errno from FuzzedSock::Wait() if it simulates a failure (Vasil Dimov)
5198a02de4 style: remove extra white space (Vasil Dimov)

Pull request description:

  * split FuzzedSock interface and implementation
  * make FuzzedSock::Wait() sometimes simulate an occurred event
  * set errno from FuzzedSock::Wait() if it simulates a failure

  (this is a followup from https://github.com/bitcoin/bitcoin/pull/21617)

ACKs for top commit:
  practicalswift:
    cr ACK 549c82ad3a: patch looks correct and touches only `src/test/fuzz/`
  MarcoFalke:
    re-ACK 549c82ad3a only change is rebase 🎬

Tree-SHA512: 8ba965a8319074ad2ef840219c35c77e37cc79f00fb3926f20ccbf5f58e9616f5a3ac96434ad33996b47d292fa760d5d00a529001ac0d1d254262e5df93f616f
2021-04-15 10:48:39 +02:00
MarcoFalke
7cb0bcb681
Merge #21686: Speedy trial activation parameters for Taproot
f979b3237f Add mainnet and testnet taproot activation params (Andrew Chow)

Pull request description:

  Adds the activation parameters for taproot as specified in https://github.com/bitcoin/bips/pull/1104

ACKs for top commit:
  gmaxwell:
    utACK f979b3237f
  ajtowns:
    ACK f979b3237f
  instagibbs:
    ACK f979b32
  clarkmoody:
    ACK f979b32
  Sjors:
    ACK f979b3237f
  jonatack:
    utACK f979b3237f verified with the BIP draft

Tree-SHA512: f95538bcec46c36f9532a99fcf697b143083c25b2427dd578b88514add0a807371530c18f0a8ed040dc885ad6eca8234235e1d762f6f837eafc5daed856a9dcf
2021-04-15 10:19:02 +02:00
MarcoFalke
a5e756b74e
Merge #21676: test: Use mocktime to avoid intermittent failure in rpc_tests
fa40d6a1c4 test: Reset mocktime in the common setup (MarcoFalke)
fa78590a8f test: Use mocktime to avoid intermittent failure (MarcoFalke)

Pull request description:

  See https://github.com/bitcoin/bitcoin/pull/21602#discussion_r611176103

ACKs for top commit:
  jonatack:
    Code review ACK fa40d6a1c4
  jarolrod:
    ACK fa40d6a1c4

Tree-SHA512: 4967e006f3d2c4eb92f03c9086a6abe3190ad54755d251c30d20422c574bb1a154c06f3d5bcb0d4deaa3c4abfd3864d743b71d84897edd358e829bb42233ad12
2021-04-15 10:05:21 +02:00
Vasil Dimov
549c82ad3a
fuzz: use ConsumeBool() instead of !ConsumeBool()
The former is shorter and ends up with a "random" bool anyway.
2021-04-15 08:51:39 +02:00
Vasil Dimov
29ae1c13a5
fuzz: split FuzzedSock interface and implementation
Move the `FuzzedSock`'s implementation from `src/test/fuzz/util.h` to
`src/test/fuzz/util.cpp`.

A separate interface and implementation make the code more readable for
consumers who don't need to (better not) know the implementation
details.
2021-04-15 08:51:36 +02:00
Vasil Dimov
9668e43d8e
fuzz: make FuzzedSock::Wait() sometimes simulate an occurred event 2021-04-15 08:19:49 +02:00
Vasil Dimov
0c90ff1429
fuzz: set errno from FuzzedSock::Wait() if it simulates a failure 2021-04-15 08:19:48 +02:00
Vasil Dimov
5198a02de4
style: remove extra white space 2021-04-15 08:19:44 +02:00
practicalswift
63631beef6 test: Remove intermittently failing and not very meaningful BOOST_CHECK in cnetaddr_basic 2021-04-15 06:19:30 +00:00
MarcoFalke
9712f75746
Merge #21677: fuzz: Avoid use of low file descriptor ids (which may be in use) in FuzzedSock
6262182b3f Avoid use of low file descriptor ids (which may be in use) in FuzzedSock and StaticContentsSock (practicalswift)

Pull request description:

  Avoid use of low file descriptor ids (which may be in use) in `FuzzedSock`.

  Context: https://github.com/bitcoin/bitcoin/pull/21630/files#r610694541

ACKs for top commit:
  vasild:
    ACK 6262182b3f

Tree-SHA512: e622acb4d01446c3db01adbbbb779038be7247e13f3f4e72c614bc2880c3efd710fd3b189f87abb00f236fa5ddf91f4c215f420ca4eb08a97aaba31593254c3d
2021-04-15 08:02:22 +02:00
Andrew Chow
f979b3237f Add mainnet and testnet taproot activation params 2021-04-14 22:53:54 -04:00
fanquake
2cd834e6c0
Merge #21377: Speedy trial support for versionbits
ffe33dfbd4 chainparams: drop versionbits threshold to 90% for mainnnet and signet (Anthony Towns)
f054f6bcd2 versionbits: simplify state transitions (Anthony Towns)
55ac5f568a versionbits: Add explicit NEVER_ACTIVE deployments (Anthony Towns)
dd07e6da48 fuzz: test versionbits delayed activation (Anthony Towns)
dd85d5411c tests: test versionbits delayed activation (Anthony Towns)
73d4a70639 versionbits: Add support for delayed activation (Anthony Towns)
9e6b65f6fa tests: clean up versionbits test (Anthony Towns)
5932744450 tests: test ComputeBlockVersion for all deployments (Anthony Towns)
63879f0a47 tests: pull ComputeBlockVersion test into its own function (Anthony Towns)

Pull request description:

  BIP9-based implementation of "speedy trial" activation specification, see https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-March/018583.html

  Edge cases are tested by fuzzing added in #21380.

ACKs for top commit:
  instagibbs:
    tACK ffe33dfbd4
  jnewbery:
    utACK ffe33dfbd4
  MarcoFalke:
    review ACK ffe33dfbd4 💈
  achow101:
    re-ACK ffe33dfbd4
  gmaxwell:
    ACK ffe33dfbd4
  benthecarman:
    ACK ffe33dfbd4
  Sjors:
    ACK ffe33dfbd4
  jonatack:
    Initial approach ACK ffe33dfbd4 after a first pass of review, building and testing each commit, mostly looking at the changes and diffs. Will do a more high-level review iteration. A few minor comments follow to pick/choose/ignore.
  ariard:
    Code Review ACK ffe33df

Tree-SHA512: f79a7146b2450057ee92155cbbbcec12cd64334236d9239c6bd7d31b32eec145a9781c320f178da7b44ababdb8808b84d9d22a40e0851e229ba6d224e3be747c
2021-04-15 10:04:14 +08:00
fanquake
7fcf53f7b4
Merge #21672: doc: remove boostrap info from GUIX_COMMON_FLAGS doc
09b3e46848 doc: remove boostrap info from GUIX_COMMON_FLAGS doc (fanquake)

Pull request description:

  Passing `ADDITIONAL_GUIX_COMMON_FLAGS="--no-substitutes --bootstrap"` as suggested doesn't work:
  ```bash
        ...outputting in: '/bitcoin/guix-build-a1f0b8b62eb8/output/x86_64-linux-gnu'
            ...bind-mounted in container to: '/outdir-base/x86_64-linux-gnu'
  guix time-machine: error: bootstrap: unrecognized option
  ```

  and I think bootstrapping is more than covered in the preceding "Choose your security model" section.

ACKs for top commit:
  dongcarl:
    ACK 09b3e46848
  jarolrod:
    ACK 09b3e46848
  laanwj:
    Documentation review ACK 09b3e46848

Tree-SHA512: e533a0b925a2ec091884ec04313f56376b4e85f615c8853dd51840181493d61bd01fee1c019e34880c32d7896e4871ea77e63398ba02b022f614c03bb16531aa
2021-04-15 08:51:14 +08:00
practicalswift
6262182b3f Avoid use of low file descriptor ids (which may be in use) in FuzzedSock and StaticContentsSock 2021-04-14 22:21:17 +00:00
Hennadii Stepanov
16c157de3c
qt, refactor: Use better QMenu::addAction overloaded function
This overloaded function was introduced in Qt 5.6 and makes code more
concise.
2021-04-14 18:51:26 +03:00
Hennadii Stepanov
79311750b5
qt: Do not assign Alt+<KEY> shortcuts to context menu actions
Such shortcuts are useless as pressing the Alt key closes a context menu
widget immediately.
2021-04-14 18:47:40 +03:00
Hennadii Stepanov
963e12058f
qt: Drop menu separator that separates nothing 2021-04-14 18:47:39 +03:00
Hennadii Stepanov
1398a6536c
qt, refactor: Make AddressBookPage::deleteAction a local variable 2021-04-14 18:47:30 +03:00
MarcoFalke
fa40d6a1c4
test: Reset mocktime in the common setup
Doing it there will reduce code bloat and also ensure no test can "forget" to reset it
2021-04-14 17:38:07 +02:00
Carl Dong
586190f0b4 rpc/rest: Take and reuse local Chain/ChainState obj
In all rest/rpc-related modules, if there are multiple calls to
ActiveChain{,State}(), and the calls fall under the same ::cs_main lock,
we can simply take a local reference and use/reuse it instead of calling
ActiveChain{,State}() again and again.
2021-04-14 11:17:31 -04:00
Carl Dong
bc3bd36902 rpc: style: Improve BuriedForkDescPushBack signature 2021-04-14 11:13:09 -04:00
Carl Dong
f99913969f rpc: Remove unnecessary casting of block height 2021-04-14 11:13:09 -04:00
Carl Dong
6a3d192020 rpc: Tidy up local references (see commit message)
Organize local variables/references such that:

1. There is always a `ChainstateManager` reference before any `LOCK(cs_main)`.
2. NodeContext references are used with Ensure*() functions introduced in
   previous commit where appropriate to avoid duplicate assertions.
2021-04-14 11:13:09 -04:00
Carl Dong
038854f31e rest/rpc: Remove now-unused old Ensure functions
The scripted-diff in the previous commit should have removed all calls
to functions like: Ensure(?!Any)\(const std::any& (context|ctx)\), so we
can remove them now.
2021-04-14 11:10:08 -04:00
Carl Dong
6fb65b49f4 scripted-diff: rest/rpc: Use renamed EnsureAny*()
-BEGIN VERIFY SCRIPT-
sed -i -E 's@Ensure([^(]+)(\((request\.|)context\))@EnsureAny\1\2@g' \
    -- src/rest.cpp src/rpc/*.cpp
-END VERIFY SCRIPT-
2021-04-14 11:09:34 -04:00
Carl Dong
1570c7ee98 rpc: Add renamed EnsureAny*() functions
- The original Ensure*(const std::any& context) functions are kept and
  the parameter renamed to ctx so that the scripted-diff in the
  subsequent commit will work as expected

- The renaming avoids overloading mistakes arising out of the untyped
  std::any argument.
2021-04-14 10:54:27 -04:00
MarcoFalke
773f8c1a7d
Merge #21678: test: Fix TestPotentialDeadLockDetected suppression
f2ef5a8afd test: Fix TSan suppression (Hennadii Stepanov)

Pull request description:

  This PR is a #21669 follow up, and fixes [locally running `make check`](https://github.com/bitcoin/bitcoin/pull/21669#issuecomment-819403540).

ACKs for top commit:
  MarcoFalke:
    cr ACK f2ef5a8afd

Tree-SHA512: bb0c4d1707c6194358d2e9abfed5aa8dd487e014199025fb89f6e5a66d774af041b46a03358a9a5412e1683675c05c42a3b719217d940412ee3fe1ed18a5274c
2021-04-14 16:51:30 +02:00
MarcoFalke
8c867ed4ec
Merge #21675: ci: Only cache depends/sdk-sources for macos/apk task in cirrus
11115c8ee5 ci: Only cache depends/sdk-sources for macos/apk task in cirrus (MarcoFalke)

Pull request description:

  Only macos needs the sdk-sources, so move it there (and remove it from showing up in the other tasks)

ACKs for top commit:
  hebasto:
    ACK 11115c8ee5

Tree-SHA512: 9e80e74016052e7b00314e191acc84c5e400bbf2e0d93ee7b1494b6be99e671cc326ddaa1fbded82f0912a9e338ad1891019dce78199b08c5180af42cb59729a
2021-04-14 16:43:00 +02:00
MarcoFalke
a12962ca89
Merge #21585: Fix assumeutxo crash due to truncated file
fa73ce6e65 Fix assumeutxo crash due to truncated file (MarcoFalke)

Pull request description:

ACKs for top commit:
  jamesob:
    ACK fa73ce6e65
  ryanofsky:
    Code review ACK fa73ce6e65. Easy fix. It seems like this could have been caught in review, though.

Tree-SHA512: 3a98687c386e3995114ddf0ad7194fadd9520989290681ef703b578e3ca21aee51eadfb83aa38a489bac13d12709ea137b9b184b08e5bfa2919cca177aab90be
2021-04-14 15:12:14 +02:00
W. J. van der Laan
03ecceedf6
Merge #260: Handle exceptions instead of crash
b8e5d0d3fe qt: Handle exceptions in SendCoinsDialog::sendButtonClicked slot (Hennadii Stepanov)
1ac2bc7ac0 qt: Handle exceptions in TransactionView::bumpFee slot (Hennadii Stepanov)
bc00e13bc8 qt: Handle exceptions in WalletModel::pollBalanceChanged slot (Hennadii Stepanov)
eb6156ba1b qt: Handle exceptions in BitcoinGUI::addWallet slot (Hennadii Stepanov)
f7e260a471 qt: Add GUIUtil::ExceptionSafeConnect function (Hennadii Stepanov)
64a8755af3 qt: Add BitcoinApplication::handleNonFatalException function (Hennadii Stepanov)
af7e365b15 qt: Make PACKAGE_BUGREPORT link clickable (Hennadii Stepanov)

Pull request description:

  This PR is an alternative to https://github.com/bitcoin/bitcoin/pull/18897, and is based on Russ' [idea](https://github.com/bitcoin/bitcoin/pull/18897#pullrequestreview-418703664):
  > IMO it would be nice to have a followup PR that eliminated the one-line forwarding methods ...

  Related issues
  - #91
  - https://github.com/bitcoin/bitcoin/issues/18643

  Qt docs: https://doc.qt.io/qt-5.12/exceptionsafety.html#exceptions-in-client-code

  With this PR the GUI handles the wallet-related exception, and:
  - display it to a user:

  ![Screenshot from 2021-04-01 02-55-59](https://user-images.githubusercontent.com/32963518/113226183-33ff8480-9298-11eb-8fe6-2168834ab09a.png)

  - prints a message to `stderr`:
  ```

  ************************
  EXCEPTION: 18NonFatalCheckError
  wallet/wallet.cpp:2677 (IsCurrentForAntiFeeSniping)
  Internal bug detected: '!chain.findBlock(block_hash, FoundBlock().time(block_time))'
  You may report this issue here: https://github.com/bitcoin/bitcoin/issues

  bitcoin in QPushButton->SendCoinsDialog

  ```

  - writes a message to the `debug.log`
  - and, if the exception is a non-fatal error, leaves the main window running.

ACKs for top commit:
  laanwj:
    Code review ACK b8e5d0d3fe
  ryanofsky:
    Code review ACK b8e5d0d3fe. This is great! I think more improvements are possible but implementation is very clean and I love how targeted each commit is. Changes since last review: adding more explanatory text, making links clickable, reorganizing.

Tree-SHA512: a9f2a2ee8e64b993b0dbc454edcbc39c68c8852abb5dc1feb58f601c0e0e8014dca81c72733aa3fb07b619c6f49b823ed20c7d79cc92088a3abe040ed2149727
2021-04-14 14:17:30 +02:00
Hennadii Stepanov
f2ef5a8afd
test: Fix TSan suppression
This change fixes locally running tests.
2021-04-14 13:27:48 +03:00