Commit Graph

20856 Commits

Author SHA1 Message Date
Wladimir J. van der Laan
5d12f44d55 Partial Merge #16144: wallet: do not encrypt wallets with disabled private keys
7860c98bd wallet: do not encrypt wallets with disabled private keys (whythat)

Pull request description:

  Fix for #15635.
  Throw an `RPC_WALLET_ENCRYPTION_FAILED` error when attempting to encrypt wallet with disabled private keys. Changed `test/function/wallet_createwallet.py` to test new behavior.

ACKs for commit 7860c9:
  achow101:
    utACK 7860c98bd59cd8f56e9b2b4ae45265c046e7cfd9
  meshcollider:
    utACK 7860c98bd5

Tree-SHA512: d0cc40efd303a00d0b4d3cb2de59d8d2d7dd35647e7f3fe9d4a8986589499c1f567c5780c83a129e1ab8dbe601279c459c6ebce3b48b1d81d47a28616ef4a369
2021-11-09 14:08:49 -05:00
MarcoFalke
053e7f74e2 Merge #16139: Docs: Add riscv64 to outputs list in release-process.md
6f7f141f77 Add riscv64 to outputs list in release-process.md (JeremyRand)

Pull request description:

  The `riscv64` binary is created by the Gitian scripts and distributed by the Bitcoin Core website, so it should be listed in the release process docs.

  I placed it between i686 and x86_64 since it looked like the original list of Linux arches was in alphabetical order; I'm open to including it in a different position if the desire is to keep the two ARM arches together and the two x86 arches together.

ACKs for commit 6f7f14:
  fanquake:
    utACK 6f7f141f77

Tree-SHA512: e87723f7bddd02e33897cfacdaac9f2e3ccc2bde74eb47d52ba1dd6082c868232e58247e427d6f95dc0b54858d8ccd1b6de47a379fce0f90b63a38bd97ebf419
2021-11-09 14:08:49 -05:00
Wladimir J. van der Laan
a92ddf2784 Merge #16124: tests: Limit Python linting to files in the repo
3c5254a820c892b448dfb42991f6109a032a3730 Limit Python linting to files in the repo (practicalswift)

Pull request description:

  Limit Python linting to files in the repo.

  Before:

  ```
  $ test/lint/lint-python.sh
  not_under_version_control.py:195:9: F841 local variable 'e' is assigned to but never used
  $
  ```

  After:

  ```
  $ test/lint/lint-python.sh
  $
  ```

ACKs for commit 3c5254:
  fanquake:
    tACK 3c5254a820
  Empact:
    utACK 3c5254a820

Tree-SHA512: 68733494a5f2a7764eba938af227145f5ef9ddc9ff94840134e4d2684ca7b9a819fac491ec43102f93e5e9867373bfd46b46efc9d11528329b5ecb2282fffb16
2021-11-09 14:08:49 -05:00
Wladimir J. van der Laan
5974914031 Merge #16090: Qt: Add vertical spacer to peer detail widget
36b0a2f2a6b49008c4f37866a9e3ab702eb34eda Add vertical spacer (Josu Goñi)

Pull request description:

  Before:

  ![image](https://user-images.githubusercontent.com/25986871/58375408-a8f22c80-7f52-11e9-96ca-14f2186e6fa7.png)

  After:

  ![image](https://user-images.githubusercontent.com/25986871/58375420-fa022080-7f52-11e9-8add-eafe98068e8d.png)

ACKs for commit 36b0a2:
  fanquake:
    utACK 36b0a2f2a6
  hebasto:
    tACK 36b0a2f2a6b49008c4f37866a9e3ab702eb34eda on Linux Mint 19.1, Qt 5.9.5
  fanquake:
    re-utACK 36b0a2f2a6
  kristapsk:
    ACK 36b0a2f2a6b49008c4f37866a9e3ab702eb34eda (tested with Qt 5.11.3 under Linux/Xfce4)
  promag:
    Tested ACK 36b0a2f2a6 on macos 10.14.3. Resizing the window works as expected.

Tree-SHA512: 26ec9700aa9116ec2c604f8ec7b825b30c83c1d497c21f2191d3585868db4a2e3921de607dea9f7cd9a1ea49361215d738e2aba1936566d85757d87112d73088
2021-11-09 14:08:49 -05:00
Wladimir J. van der Laan
bd4f568117 Merge #16089: depends: add ability to skip building zeromq
c995c870aa4cc9b9ddf0a84ce15c544757a43a18 depends: add ability to skip building zeromq (fanquake)

Pull request description:

  Similar to other depends packages, add the ability to skip building `zeromq` by passing `NO_ZMQ=1`.

  Fixes #15918.

ACKs for commit c995c8:
  practicalswift:
    utACK c995c870aa4cc9b9ddf0a84ce15c544757a43a18
  jonasschnelli:
    utACK c995c870aa4cc9b9ddf0a84ce15c544757a43a18

Tree-SHA512: 72269707916d5af0bc8ecdd89f61e49264dba29350f9508fe0a497e8ce8dae66f6a828cf0bf4d97b6f95356b505cb3e6c365e8476219dd56c4535c850df393c9
2021-11-09 14:08:49 -05:00
MarcoFalke
a9d4ca1f2a Merge #16078: test: replace tx hash with txid in rawtransaction test
0784af16ef remove parameters -addresstype=legacy in rpc_rawtransaction test (LongShao007)
a65dafa8f1 replace tx hash with txid in test rawtransaction (LongShao007)

Pull request description:

  The transaction hash is different from txid for witness transactions, so we should use txid instead of hash.

ACKs for commit 0784af:

Tree-SHA512: 98b699eb5f25c3a603b11eb7072efe9bc69c0c0ecc7f996405de31bc45d92105970e09fd8e4f75b42a46498817f596d36d9b28eae7d24e63a4f2f2abfcee0eab
2021-11-09 14:08:49 -05:00
Kittywhiskers Van Gogh
0a760bb809
merge bitcoin#8365: Treat high-sigop transactions as larger rather than rejecting them (#4562) 2021-11-08 21:43:24 +03:00
PastaPastaPasta
d4910cab3b
Merge pull request #4323 from kittywhiskers/net
merge bitcoin 15246, 15330, 15697, 16445, 16202, 16562, 18260, 22331, 23271, 16493, 17931: Refactor network message deserialization
2021-11-03 15:40:14 -04:00
UdjinM6
cb7efbf825
Merge pull request #4561 from PastaPastaPasta/develop-trivial-2021-10-30
backport trivial 2021 10 30
2021-11-03 19:28:09 +03:00
MarcoFalke
2d30d33811
Merge #21125: test: Change BOOST_CHECK to BOOST_CHECK_EQUAL for paths
059e8ccc1eba6cd92f4c434325cb56b0533eb744 Change BOOST_CHECK to BOOST_CHECK_EQUAL to see mismatched values when a check fails. (Kiminuo)

Pull request description:

  This is useful to see mismatched values when a check fails as specified in the [Boost documentation](https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref/assertion_boost_level.html).

  This PR would make #20744 PR's diff smaller by a bit.

ACKs for top commit:
  MarcoFalke:
    review ACK 059e8ccc1eba6cd92f4c434325cb56b0533eb744
  theStack:
    Code Review ACK 059e8ccc1eba6cd92f4c434325cb56b0533eb744

Tree-SHA512: 82359ef38e0d1926f12a34aeff6fde6d1d307c703a080547749b908f873c2a2f894f6f094c33470b32987c229e3a1f17f7d1e877663c53293c023bde0e7272c1
2021-11-03 12:24:06 -04:00
MarcoFalke
bdb1a55c0b
Merge #19088: validation: use std::chrono throughout some validation functions
789e9dd3aa727176797529c35b2848f994630a82 validation: use std::chrono in IsCurrentForFeeEstimation() (fanquake)
47be28c8bc475eafeebd4fc58ea92f0d3df0d8c6 validation: use std::chrono in CChainState::FlushStateToDisk() (fanquake)

Pull request description:

  Probably up for debate as to which type is used for the constants. Personally, swapping these to hours is more readable.

ACKs for top commit:
  MarcoFalke:
    ACK 789e9dd3aa727176797529c35b2848f994630a82
  jonatack:
    ACK 789e9dd3aa727176797529c35b2848f994630a82

Tree-SHA512: f4a25cbd00a49a54b7783a1f588be83706dd2a475cecb5c2e8b97b2d4b27c0955a7454d7486f2454e96351c44f233b300c4f4b9ca62fc7336277f10da34dd5c3
2021-11-03 12:24:06 -04:00
Wladimir J. van der Laan
38a0fbee54
Merge #17220: tests: Add unit testing for the CompressScript function
b05ec410f2d9f209796a5df31860e23efd729dfe Add unit testing for the CompressScript functions (marcaiaf)

Pull request description:

  Salvaging #15104 which adds unit tests for CompressScript function in `compressor.cpp`

  Tested following cases for the CScript:
    - CKeyID
    - CScriptID
    - Uncompressed CPubKey (of size: 65)
    - Compressed CPubKey (of size: 32)

ACKs for top commit:
  theStack:
    ACK b05ec410f2

Tree-SHA512: 7e23ace39383122802dfe5f7d38190d772f5db4045a67b7a9bd4c06797a17e0cdc41d6fac92d448057eb7df50172155dc824587c16c68c79fd1a4de37b772001
2021-11-03 12:24:05 -04:00
Wladimir J. van der Laan
29f354e8ec
Merge #17059: util: Simplify path argument for CBlockTreeDB ctor
c2bb3919a8cc52ea35d424c1f31f9474f1ea4911 util: Simplify path argument for CBlockTreeDB ctor (Hennadii Stepanov)

Pull request description:

  This PR:
  - simplifies path argument (`datadir/blocks/index`) for `CBlockTreeDB`  constructor
  - does not change behavior as `GetBlocksDir()` with unset "-blocksdir" returns the same path
  - improves code readability

ACKs for top commit:
  MarcoFalke:
    ACK c2bb3919a8cc52ea35d424c1f31f9474f1ea4911
  laanwj:
    ACK c2bb3919a8cc52ea35d424c1f31f9474f1ea4911
  promag:
    ACK c2bb3919a8cc52ea35d424c1f31f9474f1ea4911.

Tree-SHA512: 646a0a3a31e2f419b05f696cbdfb7d8987f1d89ec0797b72464ae05680fd5f95f6469be0ea5b56f772434c49d48504cd9cf9760c05d4054d11349d502e157ee2
2021-11-03 12:24:05 -04:00
Samuel Dobson
d33c4791f8
Merge #16830: refactor: wallet: Cleanup walletinitinterface.h
4be3b7680e6324294d9241232a6f1eae36c85a9e refactor: Cleanup walletinitinterface.h (Hennadii Stepanov)

Pull request description:

  Forward declarations of `CScheduler` and `CRPCTable` classes are no longer needed after ea961c3d7256c66146b4976ab1293db4a628c0de (#14437) commit.

  Including `<string>` is no longer needed after 4d4185a4f0e40c033a587871839a47cb3f89ee93 (#13190) commit.

ACKs for top commit:
  theStack:
    ACK 4be3b76
  promag:
    ACK 4be3b7680e6324294d9241232a6f1eae36c85a9e.
  kristapsk:
    ACK 4be3b7680e6324294d9241232a6f1eae36c85a9e (tested that it builds)

Tree-SHA512: 5ed72e3deda3d7c7fb698a1a11db76199727e6c570dfc78422690dbda9a92af32e1913920062dd3c9f618095e7498c219ff9c145a4c151486865ebeaa20a1d3c
2021-11-03 12:24:05 -04:00
Wladimir J. van der Laan
0cb1a9d39f
Merge #16563: test: Add unit test for AddTimeData
7cd069d8ef900c6c6b904ddd6fbd64e14bd0f53e Add test for AddTimeData (Martin Zumsande)

Pull request description:

  `AddTimeData()` has poor test coverage but interesting logic (including a bug turned into a feature). This PR adds a unit test for it.

ACKs for top commit:
  laanwj:
    ACK 7cd069d8ef900c6c6b904ddd6fbd64e14bd0f53e, thanks for adding a test

Tree-SHA512: 8228f9027e52ed534411d595c7e45cf4edeee9757f26f5141fbcfae3fc6f598a8cea7f734bb8f55238857a37ad2f2d518e859e1fe8c106c0712da976792ac132
2021-11-03 12:24:04 -04:00
MarcoFalke
7dca136101
Merge #16538: test: Add missing sync_blocks to feature_pruning
fa566b2601ee5a40bf814e529d7db253dacd28e7 test: Add missing sync_blocks to feature_pruning (MarcoFalke)

Pull request description:

  Fixes #16537
  Fixes #16520

ACKs for top commit:
  promag:
    ACK fa566b2601ee5a40bf814e529d7db253dacd28e7.
  jonatack:
    ACK fa566b2601ee5a40bf814e529d7db253dacd28e7. These past few months I have been seeing intermittent failures with this test on master. Ran `(for i in {1..40}; do test/functional/feature_pruning.py -l=debug; done)` overnight with this change; no failures.

Tree-SHA512: 5181d5ea525f43ad09e1c8b9ae72e32219f483948854c6dc07dda24b790cbdf4012e586253a0e158a71a980d1ca9f5fdf06aafbe95b8ea3d9154ef2c8687395b
2021-11-03 12:23:59 -04:00
UdjinM6
1ff4e7599c
Merge pull request #4537 from PastaPastaPasta/backport-14711
Backport 14711, 15342, partial 15855
2021-11-03 17:12:31 +03:00
Kittywhiskers Van Gogh
b0ee2a40a4 merge bitcoin#17931: Fix p2p_invalid_messages failing in Python 3.8 because of warning 2021-11-03 10:45:00 +05:30
Kittywhiskers Van Gogh
4caa6d394c merge bitcoin#16493: Fix test failures 2021-11-03 10:45:00 +05:30
Kittywhiskers Van Gogh
bb30e9f007 merge bitcoin#23271: Fix K1/K2 use in the comments in ChaCha20-Poly1305 AEAD 2021-11-03 10:45:00 +05:30
Kittywhiskers Van Gogh
df06dfa435 merge bitcoin#22331: Fix K1/K2 use in ChaCha20-Poly1305 AEAD 2021-11-03 10:45:00 +05:30
Kittywhiskers Van Gogh
d949c90bc0 merge bitcoin#18260: Fix implicit value conversion in formatPingTime 2021-11-03 10:45:00 +05:30
Kittywhiskers Van Gogh
31cdcb64b8 merge bitcoin#16562: Refactor message transport packaging 2021-11-03 10:45:00 +05:30
Kittywhiskers Van Gogh
c0d4df0a06 merge bitcoin#16202: Refactor network message deserialization
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-11-03 10:45:00 +05:30
Kittywhiskers Van Gogh
907101098d merge bitcoin#16445: Skip flaky p2p_invalid_messages test on macOS 2021-11-03 10:45:00 +05:30
Kittywhiskers Van Gogh
a5445a4584 merge bitcoin#15697: Make swap_magic_bytes in p2p_invalid_messages atomic 2021-11-03 10:45:00 +05:30
Kittywhiskers Van Gogh
2ecf042619 merge bitcoin#15330: Fix race in p2p_invalid_messages 2021-11-03 10:45:00 +05:30
Kittywhiskers Van Gogh
e96ed3b6ac merge bitcoin#15246: Add tests for invalid message headers
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-11-03 10:44:59 +05:30
MarcoFalke
0bc782dfcb
partial Merge #15855: [refactor] interfaces: Add missing LockAnnotation for cs_main
fa3c651143 [refactor] interfaces: Add missing LockAnnotation for cs_main (MarcoFalke)

Pull request description:

  This adds missing `LockAnnotation lock(::cs_main);` to `src/interfaces/chain.cpp` (as well as tests and  benchmarks)

ACKs for commit fa3c65:
  practicalswift:
    utACK fa3c6511435149782545ac0d09d4722dc115d709
  ryanofsky:
    utACK fa3c6511435149782545ac0d09d4722dc115d709

Tree-SHA512: b67082fe3718c94b4addf7f2530593915225c25080f20c3ffa4ff7e08f1f49548f255fb285f89a8feff84be3f6c91e1792495ced9f6bf396732396d1356d597a
2021-11-02 23:49:10 -04:00
MarcoFalke
dfa040e9b9
Merge #15342: Suggested wallet code cleanups from #14711
aebafd0edf Rename Chain getLocator -> getTipLocator (Russell Yanofsky)
2c1fbaa771 Drop redundant get_value_or (Russell Yanofsky)
84adb206fc Fix ScanForWalletTransactions start_block comment (Russell Yanofsky)
2efa66b464 Document rescanblockchain returned stop_height being null (Russell Yanofsky)
db2d093233 Add suggested rescanblockchain comments (Russell Yanofsky)
a8d645c934 Update ScanForWalletTransactions result comment (Russell Yanofsky)
95a812b599 Rename ScanResult stop_block field (Russell Yanofsky)

Pull request description:

  This implements suggested changes from #14711 review comments that didn't make make it in before merging.

  There are no changes in behavior in this PR, just documentation updates, simplifications, and variable renames.

Tree-SHA512: 39f1a5718195732b70b5e427c3b3e4295ea5af6328a5991763a422051212dfb95383186db0c0504ce2c2782fb61998dfd2fe9851645b7cb4e75d849049483cc8

# Conflicts:
#	src/interfaces/chain.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
2021-11-02 23:49:09 -04:00
MeshCollider
48826b429d
Merge #14711: Remove uses of chainActive and mapBlockIndex in wallet code
44de1561a Remove remaining chainActive references from CWallet (Russell Yanofsky)
db21f0264 Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis (Russell Yanofsky)
2ffb07929 Add findFork and findBlock to the Chain interface (Russell Yanofsky)
d93c4c1d6 Add time methods to the Chain interface (Russell Yanofsky)
700c42b85 Add height, depth, and hash methods to the Chain interface (Russell Yanofsky)

Pull request description:

  This change removes uses of `chainActive` and `mapBlockIndex` globals in wallet code. It is a refactoring change which does not affect external behavior.

  This is the next step in the larger #10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in #10102.

Tree-SHA512: 4dcec8a31c458f54e2ea6ecf01e430469b0994c5b41a21a2d150efa67cd209f4c93ae210a101e064b3a87c52c6edfc70b070e979992be0e3a00fd425de6230a8
2021-11-02 23:49:09 -04:00
UdjinM6
c679fd9ab6
Merge pull request #4559 from kittywhiskers/auxbps
merge bitcoin#16566...#18004: auxillary backports
2021-11-02 13:09:07 +03:00
Kittywhiskers Van Gogh
13e26024c4 merge bitcoin#17095: Filter control characters out of log messages 2021-11-01 21:42:49 +05:30
Kittywhiskers Van Gogh
6db0332d14 merge bitcoin#17427: Fix missing qRegisterMetaType for size_t 2021-11-01 21:41:35 +05:30
Kittywhiskers Van Gogh
d863696814 merge bitcoin#18004: don't embed a build-id when building libdmg-hfsplus 2021-11-01 21:41:35 +05:30
Kittywhiskers Van Gogh
8278e8ab0f merge bitcoin#17135: Make polling in ClientModel asynchronous 2021-11-01 21:41:35 +05:30
Kittywhiskers Van Gogh
e13d93ec78 merge bitcoin#16566: refactor upper/lowercase functions 2021-11-01 21:41:35 +05:30
PastaPastaPasta
2204c85370
governance: Implement reduced governance fee (#4241)
* Implement hf for reduced governance fee

Signed-off-by: pasta <pasta@dashboost.org>

* update VersionBitsDeploymentInfo

* Adjust activation times for gov fee hard fork

* Use raw timestamps

* Adjust timestamps

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-11-01 18:31:48 +03:00
UdjinM6
12c399b3f0
Merge pull request #4554 from UdjinM6/bp15402_16849_15971
backport 15402, 16849, 15971
2021-11-01 18:26:11 +03:00
UdjinM6
bbe9b3d1e0
Merge pull request #4494 from kittywhiskers/descaddr
merge bitcoin#14150, #14477, #14646, #14667, #14886, #14565, #14491, #15368: descriptors
2021-11-01 18:25:32 +03:00
PastaPastaPasta
ea4bd7193a
minor refactoring after #4351 (#4556) 2021-11-01 13:30:18 +03:00
Stefan
f0d49e4f69
Qt: Adds Governance tab (#4351)
* Qt: Adds settings option to showGovernanceTab

* Qt: Adds not-yet-functional Governance tab to UI

* library: adds hook into governance rom node interface

* Qt: WIP: puts CGovernanceObject hashes on Governance tab

WIP: basically ready to be filled out, most of the infra in place
now.

* Qt: Populates Governance table values

Governance table now contains real values for current columns. Display
columns may potentially change.

- want url in table if right click option opens url?
- What set of cols wanted? Show yes/no votes?
- Decide refresh functionality.
- Do we even want filter func? (checkbox show: proposal, trigger, active coming)

* qt: Shows Voting Status on Governance page

Towards DMT like Governance page, now shows voting status, but needs to
look at super blocks to determine if proposal period has passed and show
final funded or unfunded for past proposals.

* Qt: refactor governance tab to use Model-View arch

Refactors the QT Governance tab to use a Model-View architecture. The
list of Proposals is stored in a QAbstractItemModel, and a QTableView is
used to display.

This makes a much cleaner separation of concerns in the implementation.
Also, can now use the QSortFilterProxyModel to get responsive filtering.
Less internal state inside the GovernanceList, critical sections
removed.

- Needs update loop implemented.
- Needs Proposal detail widget implemented.

* qt: adds periodic update to gov proposal list

Periodically update list of governance related proposals.

* qt: populates governancelist voting status column

* qt: governancelist Porposal shows extra info on doubleClick

* qt: governancelist: reorder .cpp impl to match .h

* qt: governancelist: fixup based on CI

- Adds LOCK(cs_main) for call to pGovObj->IsValidLocally.
- retab, removes trailing whitespace in governancelist.{cpp,h}

* qt: clang-format for governancelist

* Fixes

- drop unused include
- use proper univalue "get_" functions
- shorter/translatable statuses
- shorter dates
- add missing css styles

* qt: addresses governancelist code review items

* qt: use enum to name columns of governancelist

* fix: clear context menu before adding new items

* fix: skip potential nullptr proposals

* improve: show proposal url in context menu

* refactor: tweak enum name, make sure it's int starting from 0, use full name

* fix: column count

* improve: make it sortable, sort by start_date by default

* qt: use full col name in voting status col change signal emit

* better sorting

* use mapToSource to fix data fetching

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-10-29 21:14:25 -04:00
Kittywhiskers Van Gogh
e534b48820 merge bitcoin#16887: Abstract out some of the descriptor Span-parsing helpers 2021-10-29 23:36:54 +05:30
Kittywhiskers Van Gogh
8647ba1316 merge bitcoin#15986: Add checksum to getdescriptorinfo 2021-10-29 23:36:54 +05:30
Kittywhiskers Van Gogh
84097e861d partial bitcoin#15749: fix importmulti only imports origin info for PKH outputs 2021-10-29 23:36:50 +05:30
MarcoFalke
847a75ba4a
Merge #15971: validation: Add compile-time checking for negative locking requirement in LimitValidationInterfaceQueue
62d50ef308 Add LOCKS_EXCLUDED(cs_main) to LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main) (practicalswift)

Pull request description:

  This PR adds compile-time checking for negative locking requirements that follow from the run-time locking requirement `AssertLockNotHeld(cs_main)` in `LimitValidationInterfaceQueue(...)`.

  Changes:
  * Add `LOCKS_EXCLUDED(cs_main)` to `LimitValidationInterfaceQueue(...)` which does `AssertLockNotHeld(cs_main)`
  * Add `LOCKS_EXCLUDED(cs_main)` to `CChainState::ActivateBestChain(…)`, `CChainState:: InvalidateBlock(…)` and `CChainState::RewindBlockIndex(…)` which all call `LimitValidationInterfaceQueue(...)` which does `AssertLockNotHeld(cs_main)`
  * Add `LOCKS_EXCLUDED(cs_main)` to `InvalidateBlock(…)` which calls `CChainState::InvalidateBlock(...)` which in turn calls `LimitValidationInterfaceQueue(...)` which  does `AssertLockNotHeld(cs_main)`
  * Add `LOCKS_EXCLUDED(cs_main)` to `RewindBlockIndex(…)` which calls `CChainState::RewindBlockIndex(...)` which in turn calls `LimitValidationInterfaceQueue(...)` which does `AssertLockNotHeld(cs_main)`

ACKs for commit 62d50e:
  MarcoFalke:
    utACK 62d50ef308

Tree-SHA512: 73d092ccd08c851ae3c5d60370c369fc030c5793f5507e2faccb6f91c851ddc0ce059fbea3899f2856330d7a8c78f2ac6a2988e8268b03154f946be9e60e3be1
2021-10-29 16:29:53 +03:00
UdjinM6
42fb46d470
Fix block index inconsistency in MarkConflictingBlock()
Same idea as in 16849
2021-10-29 16:29:53 +03:00
Wladimir J. van der Laan
fba2a546f6
Merge #16849: Fix block index inconsistency in InvalidateBlock()
2a4e60b48261d3f0ec3d85f97af998ef989134e0 Fix block index inconsistency in InvalidateBlock() (Suhas Daftuar)

Pull request description:

  Previously, we could release `cs_main` while leaving the block index in a state
  that would fail `CheckBlockIndex()`, because `setBlockIndexCandidates` was not being
  fully populated before releasing `cs_main`.

ACKs for top commit:
  TheBlueMatt:
    utACK 2a4e60b48261d3f0ec3d85f97af998ef989134e0. I also discovered another issue in InvalidateBlock while reviewing, see #16856.
  Sjors:
    ACK 2a4e60b. Tested on top of #16899. Also tested `invalidateblock` with `-checkblockindex=1`.
  fjahr:
    ACK 2a4e60b. Ran tests, reviewed code, inspected behavior while manually testing `invalidateblock`.

Tree-SHA512: ced12f9dfff0d413258c709921543fb154789898165590b30d1ee0cdc72863382f189744f7669a7c924d3689a1cc623efdf4e5ae3efc60054572c1e6826de612
2021-10-29 16:29:53 +03:00
Wladimir J. van der Laan
6f0646a262
Merge #15402: Granular invalidateblock and RewindBlockIndex
519b0bc5dc5155b6f7e2362c2105552bb7618ad0 Make last disconnected block BLOCK_FAILED_VALID, even when aborted (Pieter Wuille)
8d220417cd7bc34464e28a4861a885193ec091c2 Optimization: don't add txn back to mempool after 10 invalidates (Pieter Wuille)
9ce9c37004440d6a329874dbf66b51666d497dcb Prevent callback overruns in InvalidateBlock and RewindBlockIndex (Pieter Wuille)
9bb32eb571a846b66ed3bac493f55cee11a3a1b9 Release cs_main during InvalidateBlock iterations (Pieter Wuille)
9b1ff5c742dec0a6e0d6aab29b0bb771ad6d8135 Call InvalidateBlock without cs_main held (Pieter Wuille)
241b2c74ac8c4c3000e778554da1271e3f293e5d Make RewindBlockIndex interruptible (Pieter Wuille)
880ce7d46b51835c00d77a366ec28f54a05239df Call RewindBlockIndex without cs_main held (Pieter Wuille)
436f7d735f1c37e77d42ff59d4cbb1bd76d5fcfb Release cs_main during RewindBlockIndex operation (Pieter Wuille)
1d342875c21b5d0a17cf4d176063bb14b35b657e Merge the disconnection and erasing loops in RewindBlockIndex (Pieter Wuille)
32b2696ab4b079db736074b57bbc24deaee0b3d9 Move erasure of non-active blocks to a separate loop in RewindBlockIndex (Pieter Wuille)
9d6dcc52c6cb0cdcda220fddccaabb0ffd40068d Abstract EraseBlockData out of RewindBlockIndex (Pieter Wuille)

Pull request description:

  This PR makes a number of improvements to the InvalidateBlock (`invalidateblock` RPC) and RewindBlockIndex functions, primarily around breaking up their long-term cs_main holding. In addition:
  * They're made safely interruptible (`bitcoind` can be shutdown, and no progress in either will be lost, though if incomplete, `invalidateblock` won't continue after restart and will need to be called again)
  * The validation queue is prevented from overflowing (meaning `invalidateblock` on a very old block will not drive bitcoind OOM) (see #14289).
  * `invalidateblock` won't bother to move transactions back into the mempool after 10 blocks (optimization).

  This is not an optimal solution, as we're relying on the scheduler call sites to make sure the scheduler doesn't overflow. Ideally, the scheduler would guarantee this directly, but that needs a few further changes (moving the signal emissions out of cs_main) to prevent deadlocks.

  I have manually tested the `invalidateblock` changes (including interrupting, and running with -checkblockindex and -checkmempool), but haven't tried the rewinding (which is probably becoming increasingly unnecessary, as very few pre-0.13.1 nodes remain that would care to upgrade).

Tree-SHA512: 692e42758bd3d3efc2eb701984a8cb5db25fbeee32e7575df0183a00d0c2c30fdf72ce64c7625c32ad8c8bdc56313da72a7471658faeb0d39eefe39c4b8b8474
2021-10-29 16:29:49 +03:00
PastaPastaPasta
5781bd5ee3
refactor: more llmq refactoring (#4552)
* replace raw owning ptr with unique ptr

Signed-off-by: pasta <pasta@dashboost.org>

* Add GUARDED_BY annotation to llmq_versionbitscache

Signed-off-by: pasta <pasta@dashboost.org>

* limit scope of locking cs_llmq_vbc

Signed-off-by: pasta <pasta@dashboost.org>

* use llmq_versionbitscache instead of versionbitscache in UpdatedBlockTip to avoid cs_main locking

Signed-off-by: pasta <pasta@dashboost.org>

* drop unneeded cs_main ::mempool.cs

* lock cs_main and mempool.cs in Db::Upgrade
2021-10-28 22:11:34 +03:00