Commit Graph

26084 Commits

Author SHA1 Message Date
Konstantin Akimov
d3ad11d056
chore: add release notes for sethdseed RPC 2024-05-10 14:28:16 +07:00
Samuel Dobson
ad25d54300
Merge bitcoin/bitcoin#21329: descriptor wallet: Cache last hardened xpub and use in normalized descriptors
e6cf0ed92de31a5ac35a271b0da8f0a8364d1175 wallet, rpc: listdescriptors does not need unlocked (Andrew Chow)
3280704886b60644d103a5eb310691c003a39328 Pass in DescriptorCache to ToNormalizedString (Andrew Chow)
7a26ff10c2f2e139fbc63e2f37fb33ea4efae088 Change DescriptorImpl::ToStringHelper to use an enum (Andrew Chow)
75530c93a83f3e94bcb78b6aa463c5570c1e737e Remove priv option for ToNormalizedString (Andrew Chow)
74fede3b8ba69e2cc82c617cdf406ab79df58825 wallet: Upgrade existing descriptor caches (Andrew Chow)
432ba9e5434da90d2cf680f23e8c7b7164c9f945 wallet: Store last hardened xpub cache (Andrew Chow)
d87b544b834077f102724415e0fada6ee8b2def2 descriptors: Cache last hardened xpub (Andrew Chow)
cacc3910989c4f3d7afa530dbab042461426abce Move DescriptorCache writing to WalletBatch (Andrew Chow)
0b4c8ef75cd03c8f0a8cfadb47e0fbcabe3c5e59 Refactor Cache merging and writing (Andrew Chow)
976b53b085d681645fd3a008fe382de85647e29f Revert "Cache parent xpub inside of BIP32PubkeyProvider" (Andrew Chow)

Pull request description:

  Currently fetching a normalized descriptor requires the wallet to be unlocked as it needs the private keys to derive the last hardened xpub. This is not very user friendly as normalized descriptors shouldn't require and don't involve the private keys except for derivation. We solve this problem by caching the last hardened xpub (which has to be derived at some point when generating the address pool).

  However the last hardened xpub was not already being cached. We only cached the immediate parent xpub and derived child keys. For example, with a descriptor derivation path of `/84'/0'/0'/0/*`, the parent xpub that is cached is `m/84'/0'/0'/0`, and the child keys of `m/84'/0'/0'/0/i` (note that child keys would not be cached in this case). This parent xpub is not suitable for the normalized descriptor form as we want the key at `m/84'/0'/0'`. So this PR adds another field to `DescriptorCache` to cache the last hardened xpub so that we can use them for normalized descriptors.

  Since `DescriptorCache` is changing, existing descriptor wallets need to be upgraded to use this new cache. The upgrade will occur in the background either at loading time (if the wallet is not encrypted) or at unlocking time in the same manner that `UpgradeKeyMetadata` operates. It will use a new wallet flag `WALLET_FLAG_LAST_HARDENED_XPUB_CACHED` to indicate whether the descriptor wallet has the last hardened xpub cache.

  Lastly `listdescriptors` will not require the wallet to be locked and `getaddressinfo`'s `parent_desc` will always be output (assuming the upgrade has occurred).

ACKs for top commit:
  fjahr:
    tACK e6cf0ed92de31a5ac35a271b0da8f0a8364d1175
  S3RK:
    reACK e6cf0ed
  jonatack:
    Semi ACK e6cf0ed92de31a5ac35a271b0da8f0a8364d1175 reviewed, debug-built and ran unit tests and some of the descriptor functional tests at each commit. I'm not very familiar with this code and it could be clearer to the uninitiated IMHO, so I'm not confident enough to give a full ACK. Various minor suggestions follow, most of them for readability, feel free to pick and choose.
  meshcollider:
    Code review + functional test run ACK e6cf0ed92de31a5ac35a271b0da8f0a8364d1175

Tree-SHA512: ac27aade8644525cd65bfcaf27ff32afb974085b1451faf4ff68c6671a690bd6a41d4f39a33cbf461ae0fbe85995c0a4c08dbd36171da1c1d2a1d00053ad298d
2024-05-10 14:02:01 +07:00
W. J. van der Laan
24b1f6bb27
Merge #21238: A few descriptor improvements to prepare for Taproot support
0b188b751f970027c52729e0c223cc9257669322 Clean up context dependent checks in descriptor parsing (Pieter Wuille)
33275a96490445e293c322a29a3b146ccb91083c refactor: move uncompressed-permitted logic into ParsePubkey* (Pieter Wuille)
17e006ff8d5e42f22474c5191d1b745bbc97571f refactor: split off subscript logic from ToStringHelper (Pieter Wuille)
6ba5dda0c9de75196c6a427d9e59d39e5a41bff7 Account for key cache indices in subexpressions (Pieter Wuille)
4441c6f3c046c0b28ce3f0ca6d938af71d797586 Make DescriptorImpl support multiple subscripts (Pieter Wuille)
a917478db0788b244c0c799b98bf67a94df7035e refactor: move population of out.scripts from ExpandHelper to MakeScripts (Pieter Wuille)
84f3939ece9f4901141b28fd2dd6e3899d01d66e Remove support for subdescriptors expanding to multiple scripts (Pieter Wuille)

Pull request description:

  These are a few refactors and non-invasive improvements to the descriptors code to prepare for adding Taproot descriptors.

  None of the commits change behavior in any way, except the last one which improves error reporting a bit.

ACKs for top commit:
  S3RK:
    reACK 0b188b7
  Sjors:
    re-ACK 0b188b7
  achow101:
    re-ACK 0b188b751f970027c52729e0c223cc9257669322

Tree-SHA512: cb4e999134aa2bace0e13d4883454c65bcf1369e1c8585d93cc6444ddc245f3def5a628d58af7dab577e9d5a4a75d3bb46f766421fcc8cc5c85c01a11f148b3f
2024-05-10 14:02:01 +07:00
Wladimir J. van der Laan
14ac2b77f3
Merge #21127: wallet: load flags before everything else
9305862f71189d47c873d366bf976622447e18af wallet: load flags before everything else (Sjors Provoost)

Pull request description:

  Load and set wallet flags before processing other records. That way we can take them into account while processing those other records.

  Suggested here:
  https://github.com/bitcoin/bitcoin/pull/16546#discussion_r572334983

ACKs for top commit:
  laanwj:
    Code review ACK 9305862f71189d47c873d366bf976622447e18af
  gruve-p:
    ACK 9305862f71
  achow101:
    ACK 9305862f71189d47c873d366bf976622447e18af

Tree-SHA512: 7104523e369ce3c670571fe5e8b52c67b9ca92b8e36a2da5eb6f9f8bf8ed0544897007257204b68f6f371d682b3ef0d0635d36e6e8416ac74af1999d9fbc869c
2024-05-10 14:01:58 +07:00
MarcoFalke
19b2b27785
Merge #20403: wallet: upgradewallet fixes, improvements, test coverage
3eb6f8b2e61c24a22ea9396d86672307845f35eb wallet (not for backport): improve upgradewallet error messages (Jon Atack)
ca8cd893bb56bf5d455154b0498b1f58f77d20ed wallet: fix and improve upgradewallet error responses (Jon Atack)
99d56e357159c7154f69f28cb5587c5ca20d6594 wallet: fix and improve upgradewallet result responses (Jon Atack)
2498b04ce88696a3216fc38b7d393906b733e8b1 Don't upgrade to HD split if it is already supported (Andrew Chow)
c46c18b788cb0862aafbb116fd37936cbed6a431 wallet: refactor GetClosestWalletFeature() (Jon Atack)

Pull request description:

  This follows up on #18836 and #20282 to fix and improve the as-yet unreleased `upgradewallet` feature and also implement review follow-up in https://github.com/bitcoin/bitcoin/pull/18836#discussion_r519328607.

  This PR fixes 4 upgradewallet issues:

  - this bug: https://github.com/bitcoin/bitcoin/pull/20403#discussion_r526063920
  - it returns nothing in the absence of an RPC error, which isn't reassuring for users
  - it returns the same thing both in the case of a successful upgrade and when no upgrade took place
  - the error message object is currently dead code

  This PR fixes the above and provides:

  ...user feedback to not silently return without upgrading
  ```
  {
    "wallet_name": "disable private keys",
    "previous_version": 169900,
    "current_version": 169900,
    "result": "Already at latest version. Wallet version unchanged."
  }
  ```
  ...better feedback after successfully upgrading
  ```
  {
    "wallet_name": "watch-only",
    "previous_version": 159900,
    "current_version": 169900,
    "result": "Wallet upgraded successfully from version 159900 to version 169900."
  }
  ```
  ...helpful error responses
  ```
  {
    "wallet_name": "blank",
    "previous_version": 169900,
    "current_version": 169900,
    "error": "Cannot downgrade wallet from version 169900 to version 159900. Wallet version unchanged."
  }
  {
    "wallet_name": "blank",
    "previous_version": 130000,
    "current_version": 130000,
    "error": "Cannot upgrade a non HD split wallet from version 130000 to version 169899 without upgrading to support pre-split keypool. Please use version 169900 or no version specified."
  }
  ```
  updated help:
  ```
  upgradewallet ( version )

  Upgrade the wallet. Upgrades to the latest version if no version number is specified.
  New keys may be generated and a new wallet backup will need to be made.
  Arguments:
  1. version    (numeric, optional, default=169900) The version number to upgrade to. Default is the latest wallet version.

  Result:
  {                            (json object)
    "wallet_name" : "str",     (string) Name of wallet this operation was performed on
    "previous_version" : n,    (numeric) Version of wallet before this operation
    "current_version" : n,     (numeric) Version of wallet after this operation
    "result" : "str",          (string, optional) Description of result, if no error
    "error" : "str"            (string, optional) Error message (if there is one)
  }
  ```

ACKs for top commit:
  achow101:
    ACK  3eb6f8b
  MarcoFalke:
    review ACK 3eb6f8b2e61c24a22ea9396d86672307845f35eb 🛡

Tree-SHA512: b767314069e26b5933b123acfea6aa40708507f504bdb22884da020a4ca1332af38a7072b061e36281533af9f4e236d94d3c129daf6fe5b55241127537038eed
2024-05-10 13:59:59 +07:00
Andrew Chow
708586c77e
Merge #18836: wallet: upgradewallet fixes and additional tests
5f9c0b6360215636cfa62a70d3a70f1feb3977ab wallet: Remove -upgradewallet from dummywallet (MarcoFalke)
a314271f08215feba53ead27096ac7fda34acb3c test: Remove unused wallet.dat (MarcoFalke)
bf7635963c03203e7189ddaa56c6b086a0108cbf tests: Test specific upgradewallet scenarios and that upgrades work (Andrew Chow)
4b418a9decc3e855ee4b0bbf9e61121c8e9904e5 test: Add test_framework/bdb.py module for inspecting bdb files (Andrew Chow)
092fc434854f881330771a93a1280ac67b1d3549 tests: Add a sha256sum_file function to util (Andrew Chow)
0bd995aa19be65b0dd23df1df571c71428c2bc32 wallet: upgrade the CHDChain version number when upgrading to split hd (Andrew Chow)
8e32e1c41c995e832e643f605d35a7aa112837e6 wallet: remove nWalletMaxVersion (Andrew Chow)
bd7398cc6258c258e9f4411c50630ec4a552341b wallet: have ScriptPubKeyMan::Upgrade check against the new version (Andrew Chow)
5f720544f34dedf75b063b962845fa8eca604514 wallet: Add GetClosestWalletFeature function (Andrew Chow)
842ae3842df489f1b8d68e67a234788966218184 wallet: Add utility method for CanSupportFeature (Andrew Chow)

Pull request description:

  This PR cleans up the wallet upgrade mechanism a bit, fixes some probably bugs, and adds more test cases.

  The `nWalletMaxVersion` member variable has been removed as it made `CanSupportFeature` unintuitive and was causing a couple of bugs. The reason this was introduced originally was to allow a wallet upgrade to only occur when the new feature is first used. While this makes sense for the old `-upgradewallet` option, for an RPC, this does not quite make sense. It's more intuitive for an upgrade to occur if possible if the `upgradewallet` RPC is used as that's an explicit request to upgrade a particular wallet to a newer version. `nWalletMaxVersion` was only relevant for upgrades to `FEATURE_WALLETCRYPT` and `FEATURE_COMPRPUBKEY` both of which are incredibly old features. So for such wallets, the behavior of `upgradewallet` will be that the feature is enabled immediately without the wallet needing to be encrypted at that time (note that `FEATURE_WALLETCRYPT` indicates support for encryption, not that the wallet is encrypted) or for a new key to be generated.

  `CanSupportFeature` would previously indicate whether we could upgrade to `nWalletMaxVersion` not just whether the current wallet version supported a feature. While this property was being used to determine whether we should upgrade to HD and HD chain split, it was also causing a few bugs. Determining whether we should upgrade to HD or HD chain split is resolved by passing into `ScriptPubKeyMan::Upgrade` the version we are upgrading to and checking against that. By removing `nWalletMaxVersion` we also fix a bug where you could upgrade to HD chain split without the pre-split keypool.

  `nWalletMaxVersion` was also the version that was being reported by `getwalletinfo` which meant that the version reported was not always consistent across restarts as it depended on whether `upgradewallet` was used. Additionally to make the wallet versions consistent with actually supported versions, instead of just setting the wallet version to whatever is given to `upgradewallet`, we normalize the version number to the closest supported version number. For example, if given 150000, we would store and report 139900.

  Another bug where CHDChain was not being upgraded to the version supporting HD chain split is also fixed by this PR.

  Lastly several more tests have been added. Some refactoring to the test was made to make these tests easier. These tests check specific upgrading scenarios, such as from non-HD (version 60000) to HD to pre-split keypool. Although not specifically related to `upgradewallet`, `UpgradeKeyMetadata` is now being tested too.

  Part of the new tests is checking that the wallet files are identical before and after failed upgrades. To facilitate this, a utility function `sha256sum_file` has been added. Another part of the tests is to examine the wallet file itself to ensure that the records in the wallet.dat file have been correctly modified. So a new `bdb.py` module has been added to deserialize the BDB db of the wallet.dat file. This format isn't explicitly documented anywhere, but the code and comments in BDB's source code in file `dbinc/db_page.h` describe it. This module just dumps all of the fields into a dict.

ACKs for top commit:
  MarcoFalke:
    approach ACK 5f9c0b6360
  laanwj:
    Code review ACK 5f9c0b6360215636cfa62a70d3a70f1feb3977ab
  jonatack:
    ACK 5f9c0b6360215636cfa62a70d3a70f1feb3977ab, approach seems fine, code review, only skimmed the test changes but they look well done, rebased on current master, debug built and verified the `wallet_upgradewallet.py` test runs green both before and after running `test/get_previous_releases.py -b v0.19.1 v0.18.1 v0.17.2 v0.16.3 v0.15.2`

Tree-SHA512: 7c4ebf420850d596a586cb6dd7f2ef39c6477847d12d105fcd362abb07f2a8aa4f7afc5bfd36cbc8b8c72fcdd1de8d2d3f16ad8e8ba736b6f4f31f133fe5feba
2024-05-10 13:59:59 +07:00
Samuel Dobson
752e4ca048
Merge #19490: wallet: Fix typo in comments; Simplify assert
facd7dd3d1f9d51e1133974ff69eeb48f5ae282b wallet: Fix typo in comments; Simplify assert (MarcoFalke)

Pull request description:

  Follow up to https://github.com/bitcoin/bitcoin/pull/19046#discussion_r443783101 and https://github.com/bitcoin/bitcoin/pull/19046#discussion_r443793690

ACKs for top commit:
  practicalswift:
    ACK facd7dd3d1f9d51e1133974ff69eeb48f5ae282b
  jonatack:
    ACK facd7dd3d1f9d51e1133974ff69eeb48f5ae282b
  hebasto:
    ACK facd7dd3d1f9d51e1133974ff69eeb48f5ae282b, spelling verified with `test/lint/lint-spelling.sh`: all remaining warnings are false positive.

Tree-SHA512: 2b185d138058840db56726bb6bcc42e5288a954e2a410c49e04806a047fbbdaf0bb2decc70ecf7613c69caa766655705ca44151613e7ea5015b386d1e726d870
2024-05-10 13:59:58 +07:00
Andrew Chow
63895fde23
Merge #19046: Replace CWallet::Set* functions that use memonly with Add/Load variants
3a9aba21a49a6d80bd187940d5e26893937b6832 Split SetWalletFlags into Add/LoadWalletFlags (Andrew Chow)
d9cd095b5965fc20c09f401370e7ba99446663e3 Split SetActiveScriptPubKeyMan into Add/LoadActiveScriptPubKeyMan (Andrew Chow)
0122fbab4c340b23ae56173de6c5ab866ba25ab8 Split SetHDChain into AddHDChain and LoadHDChain (Andrew Chow)

Pull request description:

  `SetHDChaiin`, `SetActiveScriptPubKeyMan`, and `SetWalletFlags` have a `memonly` argument which is kind of confusing, as noted in https://github.com/bitcoin/bitcoin/pull/17681#discussion_r427633081. This PR replaces those functions with `Add*` and `Load*` variants so that they follow the pattern used elsewhere in the wallet.

  `AddHDChain`, `AddActiveScriptPubKeyMan`, and `AddWalletFlags` both set their respective variables in `CWallet` and writes them to disk. These functions are used by the actions which modify the wallet such as `sethdseed`, `importdescriptors`, and creating a new wallet.

  `LoadHDChain`, `LoadActiveScriptPubKeyMan`, and `LoadWalletFlags` just set the `CWallet` variables. These functions are used by `LoadWallet` when loading the wallet from disk.

ACKs for top commit:
  jnewbery:
    Code review ACK 3a9aba21a49a6d80bd187940d5e26893937b6832
  ryanofsky:
    Code review ACK 3a9aba21a49a6d80bd187940d5e26893937b6832. Only changes since last review tweaks making m_wallet_flags updates more safe
  meshcollider:
    utACK 3a9aba21a49a6d80bd187940d5e26893937b6832

Tree-SHA512: 365aeaafc5ba42879c0eb797ec3beb29ab70e27f917dc880763f743420b3be6ddf797240996beed8a9ad70fb212c2590253c6b44c9dc244529c3939d9538983f
2024-05-10 13:59:58 +07:00
Konstantin Akimov
2c0d5b7c71
refactor: rename hdChain to m_hd_chain
This commit helps to unify our implementation with bitcoin which has
the similar refactoring in bitcoin#17681 but we DNM it due to difference in
sethdseed behavior: we do not replace seed ever
2024-05-10 13:59:58 +07:00
Konstantin Akimov
266aefc544
feat: sethdseed rpc added. Based on bitcoin#12560 and the newest related changes
The key difference between bitcoin's and dash's implementation that sethdseed
does not update existing seed for wallet. Seed can be set only once.
It behave similarly to `upgradetohd` rpc, but since v20.1 all wallets are HD and
the name `upgradetohd` is not relevant more.
2024-05-10 13:59:44 +07:00
pasta
c617d4a50b
Merge #5992: fix(qt): remove stretchers from Overview page when it's not needed
b9a2ce74c0 fix: remove stretching from Overview page when it's not needed (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  Overview page has strange stretching on sides, which make balance moving left-right when window is scalled.
  ![image](https://github.com/dashpay/dash/assets/545784/a2b3332a-55f4-4abc-a96f-9ca6c1184360)
  ![image](https://github.com/dashpay/dash/assets/545784/1b8e7eca-d0db-4574-a337-096bfa645242)

  ## What was done?
  Removed stretches for Overview Page from the sides, it makes window a little more balanced. This PR lets to do backport of bitcoin-core/gui#176 which improves behavior further more be increasing size of "transaction list" part of window.

  ## How Has This Been Tested?
  See screenshot. Resized window with/without patch, in "Discreet mode" off and on. Both looks not perfect but better than before.

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone

Top commit has no ACKs.

Tree-SHA512: f599f4f40986b37c3c9a8c36e2146bdf7b8e38d15a6f65f26fec4e30440ab54d07ea1f36a2b11e48a6dc3bcd64ececd3c4da6255fc6c9f58fba2a4abb2221b8d
2024-05-09 11:49:37 -05:00
Kittywhiskers Van Gogh
5dde8e7b33
merge bitcoin#25109: Strengthen AssertLockNotHeld assertions 2024-05-09 08:52:48 +00:00
Kittywhiskers Van Gogh
a1f005ee71
merge bitcoin#24157: Replace RecursiveMutex cs_totalBytesSent with Mutex and rename it 2024-05-09 08:52:48 +00:00
Kittywhiskers Van Gogh
de4b4bf9ee
merge bitcoin#24108: Replace RecursiveMutex cs_addrLocal with Mutex, and rename it 2024-05-09 08:52:48 +00:00
Kittywhiskers Van Gogh
2f7a138452
merge bitcoin#24079: replace RecursiveMutex cs_SubVer with Mutex (and rename) 2024-05-09 08:52:48 +00:00
Kittywhiskers Van Gogh
23b152cd37
merge bitcoin#22829: various RecursiveMutex replacements in CConnman 2024-05-09 08:52:47 +00:00
Kittywhiskers Van Gogh
362e3101ad
merge bitcoin#21943: Dedup and RAII-fy the creation of a copy of CConnman::vNodes 2024-05-08 16:21:51 +00:00
Kittywhiskers Van Gogh
bf98ad6a42
merge bitcoin#22782: Remove unused MaybeSetAddrName 2024-05-08 16:20:19 +00:00
Kittywhiskers Van Gogh
2b65526818
merge bitcoin#21167: make CNode::m_inbound_onion public, initialize explicitly 2024-05-08 16:20:18 +00:00
pasta
a8cfd70587
Merge #6011: backport: Merge bitcoin/bitcoin#28097: depends: xcb-proto 1.15.2 - fix ubuntu 24.04
94a8e1a713 Merge bitcoin/bitcoin#28097: depends: xcb-proto 1.15.2 (fanquake)

Pull request description:

  ## Issue being fixed or feature implemented
    Resolves build failures with Python 3.12, i.e building on rawhide:
    ```bash
    make -C depends -j9
    ...
    make[3]: Nothing to be done for 'install-exec-am'.
     /usr/bin/mkdir -p '/bitcoin/depends/work/staging/aarch64-unknown-linux-gnu/xcb_proto/1.14.1-4a91ac9dc41/bitcoin/depends/aarch64-unknown-linux-gnu/lib/python3.12/site-packages/xcbgen'
     /usr/bin/install -c -m 644 __init__.py error.py expr.py align.py matcher.py state.py xtypes.py '/bitcoin/depends/work/staging/aarch64-unknown-linux-gnu/xcb_proto/1.14.1-4a91ac9dc41/bitcoin/depends/aarch64-unknown-linux-gnu/lib/python3.12/site-packages/xcbgen'
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
    ModuleNotFoundError: No module named 'imp'
    make[3]: *** [Makefile:271: install-pkgpythonPYTHON] Error 1
    ```

    `imp` was removed in 3.12: https://docs.python.org/3/library/imp.html.

  ## What was done?
  Bitcoin backport bitcoin#28097

  ## How Has This Been Tested?
  Run build `depends` with clean - it doesn't fail

  ## Breaking Changes
  n/a

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone

Top commit has no ACKs.

Tree-SHA512: 61415fcc0c86f57d6b124907505102ae5b319c95d6ee0b531ce75fa2370a82bafd7a40b21e24eb7d1ac38ba93d59d9e7b89829667c61f4f4caf46029e6dd1cf7
2024-05-07 12:34:54 -05:00
fanquake
94a8e1a713
Merge bitcoin/bitcoin#28097: depends: xcb-proto 1.15.2
7cb88c8b46723d306b96953a6a60c90a4ab211e3 depends: xcb-proto 1.15.2 (fanquake)

Pull request description:

  Resolves build failures with Python 3.12, i.e building on rawhide:
  ```bash
  make -C depends -j9
  ...
  make[3]: Nothing to be done for 'install-exec-am'.
   /usr/bin/mkdir -p '/bitcoin/depends/work/staging/aarch64-unknown-linux-gnu/xcb_proto/1.14.1-4a91ac9dc41/bitcoin/depends/aarch64-unknown-linux-gnu/lib/python3.12/site-packages/xcbgen'
   /usr/bin/install -c -m 644 __init__.py error.py expr.py align.py matcher.py state.py xtypes.py '/bitcoin/depends/work/staging/aarch64-unknown-linux-gnu/xcb_proto/1.14.1-4a91ac9dc41/bitcoin/depends/aarch64-unknown-linux-gnu/lib/python3.12/site-packages/xcbgen'
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
  ModuleNotFoundError: No module named 'imp'
  make[3]: *** [Makefile:271: install-pkgpythonPYTHON] Error 1
  ```

  `imp` was removed in 3.12: https://docs.python.org/3/library/imp.html.

  Guix Build:
  ```bash
  6d1725c9346bdf04e1eeec2deffda90957bd081700ba896834a143756410fb0e  guix-build-7cb88c8b4672/output/aarch64-linux-gnu/SHA256SUMS.part
  34486c39daea8a3ce8d92e9c1501f26e5f5e300d9612a25bd56c48ab56353329  guix-build-7cb88c8b4672/output/aarch64-linux-gnu/bitcoin-7cb88c8b4672-aarch64-linux-gnu-debug.tar.gz
  cb0080d75d0fc4fc5c7fc022b5771470c60609c35836e7b66c4f479a2edcd098  guix-build-7cb88c8b4672/output/aarch64-linux-gnu/bitcoin-7cb88c8b4672-aarch64-linux-gnu.tar.gz
  395c332f83206125819aabf9a5dad5c906bdcd78ec13269fdfb4215bb5cc3247  guix-build-7cb88c8b4672/output/arm-linux-gnueabihf/SHA256SUMS.part
  f9e72693dd59f1b4dce6b6efa7bf325b2b589075a904c57b430dbe5c39add4ff  guix-build-7cb88c8b4672/output/arm-linux-gnueabihf/bitcoin-7cb88c8b4672-arm-linux-gnueabihf-debug.tar.gz
  14cfcebcd557d30d5a07837ab38ca217346f9b97e238a96376d6467d0db39e1a  guix-build-7cb88c8b4672/output/arm-linux-gnueabihf/bitcoin-7cb88c8b4672-arm-linux-gnueabihf.tar.gz
  1aaa7c04156a78628060a2ec47077589fb5dfb7a2e558fe604aaaa916b8a7f51  guix-build-7cb88c8b4672/output/arm64-apple-darwin/SHA256SUMS.part
  94585898babc8fdce7660c3160fe7b26c6f6749ac53a177f91a8b4226856ab7b  guix-build-7cb88c8b4672/output/arm64-apple-darwin/bitcoin-7cb88c8b4672-arm64-apple-darwin-unsigned.dmg
  9bcc693e5fad668e6c7beb8280c9c3e6988318569e0efa7d24f8cd990a3c1dd4  guix-build-7cb88c8b4672/output/arm64-apple-darwin/bitcoin-7cb88c8b4672-arm64-apple-darwin-unsigned.tar.gz
  3e427a7c2530cc3bb2f87125997bafa94234c21ebb7004cc36dc8408c0b0c9ff  guix-build-7cb88c8b4672/output/arm64-apple-darwin/bitcoin-7cb88c8b4672-arm64-apple-darwin.tar.gz
  988909c91077cb83b8d5ee77933192525d1fa1fd0bba0874138433314cb64927  guix-build-7cb88c8b4672/output/dist-archive/bitcoin-7cb88c8b4672.tar.gz
  b13c8b1f4f75505d2356f9e702db384dbb58ee3f7f0af3b110df4b7bc4c80f52  guix-build-7cb88c8b4672/output/powerpc64-linux-gnu/SHA256SUMS.part
  6f2f204401c36ee59564c8d56f9adf4f2587471ea0705e0f6a89ade4a8decf55  guix-build-7cb88c8b4672/output/powerpc64-linux-gnu/bitcoin-7cb88c8b4672-powerpc64-linux-gnu-debug.tar.gz
  c1af63ec54fcbfd267a047d2dca41bdfcace1ae6a5746df11bd710217b17b205  guix-build-7cb88c8b4672/output/powerpc64-linux-gnu/bitcoin-7cb88c8b4672-powerpc64-linux-gnu.tar.gz
  2407bc6d0beaa12dd7601ff14ef2c077346752a7b57fdf27df0a512f2af825bd  guix-build-7cb88c8b4672/output/powerpc64le-linux-gnu/SHA256SUMS.part
  ff033b4b2a3c2816555ee3a443e4087cba47d4eb05b00e092603892ff91acc30  guix-build-7cb88c8b4672/output/powerpc64le-linux-gnu/bitcoin-7cb88c8b4672-powerpc64le-linux-gnu-debug.tar.gz
  ebd9c3ab462290e2c3264dd4184a1d132b90cc93d8359ae28bc23a120b918716  guix-build-7cb88c8b4672/output/powerpc64le-linux-gnu/bitcoin-7cb88c8b4672-powerpc64le-linux-gnu.tar.gz
  57afcfe859903b960ef792447d34a17d556e44c98c021f5a35bfbd963f9e7be5  guix-build-7cb88c8b4672/output/riscv64-linux-gnu/SHA256SUMS.part
  105e6ef4fbac91e1bbbea3e98c80915654894d247cbfe0e4d2ff89b633ace10e  guix-build-7cb88c8b4672/output/riscv64-linux-gnu/bitcoin-7cb88c8b4672-riscv64-linux-gnu-debug.tar.gz
  e893e321ddd966c29fa949c3d7866fd0dca6ea87f9185e702a17c62896acf90b  guix-build-7cb88c8b4672/output/riscv64-linux-gnu/bitcoin-7cb88c8b4672-riscv64-linux-gnu.tar.gz
  80e7610cdb2ea9f1a503fa7c9ac7e29600e98fdac020951a76525494822416d9  guix-build-7cb88c8b4672/output/x86_64-apple-darwin/SHA256SUMS.part
  8fe050ca40af1d2830f7efe928f8ea8e30800dfa286f5d22549255d7ed893a30  guix-build-7cb88c8b4672/output/x86_64-apple-darwin/bitcoin-7cb88c8b4672-x86_64-apple-darwin-unsigned.dmg
  51a06c78edb9b29008deab11f5e98acac04de64080804d22b5a4f30c4b195ee5  guix-build-7cb88c8b4672/output/x86_64-apple-darwin/bitcoin-7cb88c8b4672-x86_64-apple-darwin-unsigned.tar.gz
  5cb44b69b2315fd2bb4122fa252158a9460269f24121226d88f6146e52aafc5b  guix-build-7cb88c8b4672/output/x86_64-apple-darwin/bitcoin-7cb88c8b4672-x86_64-apple-darwin.tar.gz
  d57f8ad1041a8112b012472ff00593a214f55215a29c5e5c3bc724d5eb645b1e  guix-build-7cb88c8b4672/output/x86_64-linux-gnu/SHA256SUMS.part
  76f1865d49cedf4b03f9ac5c4cb968968e54f8b19e96391340d82669a9395e93  guix-build-7cb88c8b4672/output/x86_64-linux-gnu/bitcoin-7cb88c8b4672-x86_64-linux-gnu-debug.tar.gz
  63cca6f0cbfd74148b20093bc2494b9abf50594cfb7055c5b5d702583d6c37a4  guix-build-7cb88c8b4672/output/x86_64-linux-gnu/bitcoin-7cb88c8b4672-x86_64-linux-gnu.tar.gz
  8d2afd4156525bc4684271092b5017e12f01fcc3dad29608886d10c0ef01b09d  guix-build-7cb88c8b4672/output/x86_64-w64-mingw32/SHA256SUMS.part
  6ebb038dc1f589bf92bcf3766dfcb0310f7df9ff4f75c943c2eb6fcced1a2580  guix-build-7cb88c8b4672/output/x86_64-w64-mingw32/bitcoin-7cb88c8b4672-win64-debug.zip
  d73aad8495174a49dad172278fbe590b86104bca9fcec8301a548a9fc8b1118f  guix-build-7cb88c8b4672/output/x86_64-w64-mingw32/bitcoin-7cb88c8b4672-win64-setup-unsigned.exe
  7697fffdb9b2c2f0c6042f56daf9940c561ed4c950692a2adbb039ecd885e047  guix-build-7cb88c8b4672/output/x86_64-w64-mingw32/bitcoin-7cb88c8b4672-win64-unsigned.tar.gz
  4483876d0e5709b25bd2e238958a820f7996eaebe21c1c3f3a8c3f490a0c8562  guix-build-7cb88c8b4672/output/x86_64-w64-mingw32/bitcoin-7cb88c8b4672-win64.zip
  ```

ACKs for top commit:
  hebasto:
    ACK 7cb88c8b46723d306b96953a6a60c90a4ab211e3, tested on Ubuntu Mantic with:

Tree-SHA512: 7e01c20f15864c29ada6719051e683fbf7a533aaed810aa74763f50f6810fa49e8d3773d13d18ba88a20404305fc92d3c95190e799ebaf25a82301e97422e7a8
2024-05-07 12:34:22 -05:00
pasta
df33e74c31
Merge #6006: fix: resolve potential deadlocks in CJ
b2910fba02 fix: resolve potential deadlocks in CJ (UdjinM6)

Pull request description:

  ## Issue being fixed or feature implemented

  ```
  POTENTIAL DEADLOCK DETECTED
  Previous lock order was:
   (2) 'cs_wallet' in wallet/wallet.cpp:3826 (in thread 'qt-init')
   (2) 'pwallet->cs_wallet' in wallet/walletdb.cpp:705 (in thread 'qt-init')
   (1) 'cs_KeyStore' in wallet/scriptpubkeyman.cpp:971 (in thread 'qt-init')
  Current lock order is:
   'cs_deqsessions' in coinjoin/client.cpp:261 (in thread 'main')
   (1) 'cs_KeyStore' in wallet/scriptpubkeyman.cpp:1522 (in thread 'main')
   (2) 'cs_wallet' in wallet/wallet.cpp:1629 (in thread 'main')
  ```

  This one is for `ResetPool()`.

  ## What was done?
  Lock `cs_wallet` when calling `keyHolderStorage.ReturnAll()` in some places* to ensure the right order of locks.

  (*In other places `cs_wallet` is held already, no need to double lock).

  ## How Has This Been Tested?
  Mixing

  ## Breaking Changes
  n/a

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  PastaPastaPasta:
    utACK b2910fba02

Tree-SHA512: 8be98df021f7683cd496ebe095dd7b32ebea76c7f9c7c085af3bc0a6901d9cfd4d4624e20a2eee1f3b0d69fd711f8fceb9a91c386b9bf02475632a23b3a0f09a
2024-05-07 12:32:30 -05:00
Konstantin Akimov
a33dcb3283
fix: CheckWalletOwnsScript/CheckWalletOwnsKey to use wallet instead of SPK 2024-05-07 00:17:19 +07:00
Konstantin Akimov
b2ede8bfee
feat: update list of tests that still doesn't support descriptor wallets
That are:
 - feature_dip3_deterministicmns.py
 - interface_zmq_dash.py
 - feature_governance.py
 - wallet_upgradetohd.py (as expected to be implemented for legacy-only wallets)
 - p2p_timeouts.py (why? can not understand it)

This partially reverts commit b20f812674.
2024-05-07 00:17:18 +07:00
Konstantin Akimov
838d06f2fd
feat: enable descriptor wallets for more tests
Enables for rpc_quorum.py, feature_notifications.py

see #5981, it partial revert of b20f812674
2024-05-07 00:17:18 +07:00
Konstantin Akimov
5ab108c982
feat: implementation of RPC 'protx register' for descriptor wallets 2024-05-07 00:17:12 +07:00
pasta
d44b0d5dcb
Merge #5990: refactor: minimize locking in ChainLocks Cleanup
04ba164064 refactor: immediately update lastCleanupTime (pasta)
d0d2641154 refactor: minimize locking of cs_main in chainlocks.cpp (pasta)

Pull request description:

  ## Issue being fixed or feature implemented
  Simple changes, just look at the two commits: first we minimize scope of cs_main to what actually needs it. Then we change where we update the `lastCleanupTime` to right after we check it to minimize any chance of two threads entering at the same time.

  ## What was done?

  ## How Has This Been Tested?
  Built, ran for a bit

  ## Breaking Changes
  None

  ## Checklist:
    _Go over all the following points, and put an `x` in all the boxes that apply._
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

Top commit has no ACKs.

Tree-SHA512: 63432ccc16a67e6478e578c96fe809cf33d08e5068285c21e65ccc175c0c9e82c23519d57f0c4ebac162a094bfc20eb44df30cbe85b26815d02eaac06ceb66ad
2024-05-03 10:16:00 -05:00
pasta
765ad2015d
Merge #6001: refactor: replace LOCKS_EXCLUDED with stricter negative EXCLUSIVE_LOCKS_REQUIRED in Dash-specific code
0bba55f6af spork: replace `LOCKS_EXCLUDED` with negative `EXCLUSIVE_LOCKS_REQUIRED` (Kittywhiskers Van Gogh)
d657951f90 masternode: replace `LOCKS_EXCLUDED` with negative `EXCLUSIVE_LOCKS_REQUIRED` (Kittywhiskers Van Gogh)
8b1d3b55ab llmq: replace `LOCKS_EXCLUDED` with negative `EXCLUSIVE_LOCKS_REQUIRED` (Kittywhiskers Van Gogh)
cceff152ef coinjoin: replace `LOCKS_EXCLUDED` with negative `EXCLUSIVE_LOCKS_REQUIRED` (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  With the exception some usages of `cs_main` and a few (`Recursive`)`Mutex`es, Bitcoin has replaced their usage of `LOCKS_EXCLUDED(cs)` with `EXCLUSIVE_LOCKS_REQUIRED(!cs)` due to the stricter enforcement that negative locking brings with Clang (and it having a trickle-up effect caused by needing lock annotations on calling functions as well).

  Dash intensively uses `LOCKS_EXCLUDED` for Dash-specific logic and moving it over also required updating (or adding) lock annotations for calling functions.

  This pull request is being opened due to an upcoming pull request that includes https://github.com/bitcoin/bitcoin/pull/25109, which requires all `AssertLockNotHeld` usage to accompany a negative lock annotation.

  ## Breaking Changes

  None expected. (Negative) lock enforcement has been made stricter but no new locks should be introduced by changes.

  ## Checklist:

  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)**
  - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)**
  - [x] I have made corresponding changes to the documentation **(note: N/A)**
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  PastaPastaPasta:
    utACK 0bba55f6af

Tree-SHA512: 54c6b80f6ad8dc821cbe9250f8e8f111bc49fb7b38ef0de10423110c066c3e7ea4b93dc61580f319837ac4690ed21912f3ec43aaa1d3cd954043798a675226ee
2024-05-03 10:15:06 -05:00
pasta
3b2c8bdcc5
Merge #6002: fix: missing lock cs_wallet in rpc/evo
10869fff3b fix: order of locks cs_wallet and cs_main in rpc/evo (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  Changing order of locking `cs_main` and `cs_wallet` to prevent a deadlock.

  There's call `protx_list` -> `BuildDMNListEntry` -> `CheckWalletOwnsScript`:
  ```
  return WITH_LOCK(pwallet->cs_wallet, return pwallet->IsMine(script)) == isminetype::ISMINE_SPENDABLE;
  ```

  It can cause a deadlock due to wrong order of locks (cs_wallet supposed to be blocked in prior of cs_main)

  ## What was done?
  This PR adds and extra lock of cs_wallet and reduce scope of cs_main for a bit

  ## How Has This Been Tested?
  Deadlock warning is reproduced with this PR: https://github.com/dashpay/dash/pull/6003

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone

Top commit has no ACKs.

Tree-SHA512: 6d166fe7c47067c1c6d889d87e015ff3bc43aa9f66234341840cc8465ce00a79e7140bc09cbdb2fd08feaae5463b320e0b66bbe410422783f86cbc9d616af6b3
2024-05-03 10:13:29 -05:00
UdjinM6
b2910fba02
fix: resolve potential deadlocks in CJ
```
POTENTIAL DEADLOCK DETECTED
Previous lock order was:
 (2) 'cs_wallet' in wallet/wallet.cpp:3826 (in thread 'qt-init')
 (2) 'pwallet->cs_wallet' in wallet/walletdb.cpp:705 (in thread 'qt-init')
 (1) 'cs_KeyStore' in wallet/scriptpubkeyman.cpp:971 (in thread 'qt-init')
Current lock order is:
 'cs_deqsessions' in coinjoin/client.cpp:261 (in thread 'main')
 (1) 'cs_KeyStore' in wallet/scriptpubkeyman.cpp:1522 (in thread 'main')
 (2) 'cs_wallet' in wallet/wallet.cpp:1629 (in thread 'main')
```
2024-05-02 22:33:22 +03:00
Konstantin Akimov
10869fff3b
fix: order of locks cs_wallet and cs_main in rpc/evo
It also reduce scope of both locks
2024-05-02 23:49:25 +07:00
pasta
acd0f49d7b
refactor: significant Mutex refactoring
Includes:
RecursiveMutex -> Mutex,
renaming of `cs` to something more meaningful,
usage of atomics where trivially possible,
introduce a method CQuorum::SetVerificationVector to avoid needing to lock an internal mutex externally

fix: avoid cs_vvec_shShare double-lock

Co-authored-by: UdjinM6 <udjinm6@users.noreply.github.com>
2024-04-30 12:41:34 -05:00
Konstantin Akimov
b9a2ce74c0
fix: remove stretching from Overview page when it's not needed 2024-04-30 19:37:49 +07:00
Kittywhiskers Van Gogh
0bba55f6af
spork: replace LOCKS_EXCLUDED with negative EXCLUSIVE_LOCKS_REQUIRED 2024-04-30 11:47:07 +00:00
Kittywhiskers Van Gogh
d657951f90
masternode: replace LOCKS_EXCLUDED with negative EXCLUSIVE_LOCKS_REQUIRED 2024-04-30 11:47:04 +00:00
Kittywhiskers Van Gogh
8b1d3b55ab
llmq: replace LOCKS_EXCLUDED with negative EXCLUSIVE_LOCKS_REQUIRED 2024-04-30 11:47:02 +00:00
Kittywhiskers Van Gogh
cceff152ef
coinjoin: replace LOCKS_EXCLUDED with negative EXCLUSIVE_LOCKS_REQUIRED 2024-04-30 11:46:59 +00:00
pasta
c3f34dcd98
Merge #5982: backport: merge bitcoin#20769, #19499, #23575, #23695, #21160, #24692, partial bitcoin#20196, #25176, merge bitcoin-core/gui#526 (networking backports: part 4)
ab7ac1b85b partial bitcoin#25176: Fix frequent -netinfo JSON errors from null getpeerinfo#relaytxes (Kittywhiskers Van Gogh)
c89799d46c merge bitcoin#24692: Follow-ups to #21160 (Kittywhiskers Van Gogh)
33098aefff merge bitcoin#21160: Move tx inventory into net_processing (Kittywhiskers Van Gogh)
24205d94fe partial bitcoin#20196: fix GetListenPort() to derive the proper port (Kittywhiskers Van Gogh)
7f7200986b merge bitcoin-core/gui#526: Add address relay/processed/rate-limited fields to peer details (Kittywhiskers Van Gogh)
a9114f1ce8 merge bitcoin#23695: Always serialize local timestamp for version msg (Kittywhiskers Van Gogh)
d936c28b4e merge bitcoin#23575: Rework FillNode (Kittywhiskers Van Gogh)
6f8c730f35 merge bitcoin#19499: Make timeout mockable and type safe, speed up test (Kittywhiskers Van Gogh)
43a82bdd29 merge bitcoin#20769: fixes "advertised address where nobody is listening" (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * Dependent on https://github.com/dashpay/dash/pull/5978
  * Dependent on https://github.com/dashpay/dash/pull/5977

  ## Breaking Changes

  None observed.

  ## Checklist:

  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)**
  - [x] I have added or updated relevant unit/integration/functional/e2e tests
  - [x] I have made corresponding changes to the documentation **(note: N/A)**
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  PastaPastaPasta:
    utACK ab7ac1b85b

Tree-SHA512: 87bf5108bb80576c5bff8cd577add7800044da252fd18590e06a727f0bf70de94e2e9294b4412cdd9f1f6676472b0359902af361aaffc4c9ee299ad07d6af009
2024-04-28 12:39:40 -05:00
Kittywhiskers Van Gogh
ab7ac1b85b
partial bitcoin#25176: Fix frequent -netinfo JSON errors from null getpeerinfo#relaytxes
excludes:
- a17c5e96b602fed65166037b78d98605e915206b
2024-04-26 20:25:55 +00:00
Kittywhiskers Van Gogh
c89799d46c
merge bitcoin#24692: Follow-ups to #21160 2024-04-26 20:25:55 +00:00
Kittywhiskers Van Gogh
33098aefff
merge bitcoin#21160: Move tx inventory into net_processing 2024-04-26 20:25:55 +00:00
Kittywhiskers Van Gogh
24205d94fe
partial bitcoin#20196: fix GetListenPort() to derive the proper port
excludes:
- 0cfc0cd32239d3c08d2121e028b297022450b320
- 7d64ea4a01920bb55bc6de0de6766712ec792a11
2024-04-26 20:25:31 +00:00
Kittywhiskers Van Gogh
7f7200986b
merge bitcoin-core/gui#526: Add address relay/processed/rate-limited fields to peer details 2024-04-26 20:25:31 +00:00
Kittywhiskers Van Gogh
a9114f1ce8
merge bitcoin#23695: Always serialize local timestamp for version msg 2024-04-26 20:25:31 +00:00
Kittywhiskers Van Gogh
d936c28b4e
merge bitcoin#23575: Rework FillNode 2024-04-26 20:25:31 +00:00
Kittywhiskers Van Gogh
6f8c730f35
merge bitcoin#19499: Make timeout mockable and type safe, speed up test 2024-04-26 20:25:31 +00:00
Kittywhiskers Van Gogh
43a82bdd29
merge bitcoin#20769: fixes "advertised address where nobody is listening" 2024-04-26 20:25:31 +00:00
pasta
b1852e0a89
Merge #5995: fix(qt): tab switching via shortcuts doesn't work after 5986
c8742057ac fix(qt): tab switching via shortcuts doesn't work after 5986 (UdjinM6)

Pull request description:

  ## Issue being fixed or feature implemented
  Looks like 3265b54a2f (#5986) broke it

  ## What was done?

  ## How Has This Been Tested?
  run dash-qt, try using shortcuts `cmd+1`, `cmd+2` etc. (on macos)

  ## Breaking Changes
  n/a

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  PastaPastaPasta:
    ACK c8742057ac
  kwvg:
    ACK c8742057ac

Tree-SHA512: 62a593ec804d75ff8aada0ef9ea90106adbf8cd11b202a6296086f55c2a4d2181e56dc8e56193a0ed49d94e55ee3236ab441ab477c8ca6d7b0c649dff987dbbc
2024-04-26 14:50:46 -05:00
pasta
f9e123efd6
Merge #5987: refactor: reduce fMasternodeMode usage, remove fDisableGovernance global
b4477e409c trivial: don't print `fDisableGovernance` value anymore (Kittywhiskers Van Gogh)
a42370df93 refactor: remove fDisableGovernance global, define default in variable (Kittywhiskers Van Gogh)
b1527599e4 refactor: remove fMasternodeMode and fDisableGovernance from Qt code (Kittywhiskers Van Gogh)
9402ce7171 refactor: limit usage of fDisableGovernance, use `IsValid()` instead (Kittywhiskers Van Gogh)
106f6bdd4e refactor: reduce fMasternodeMode usage in governance and mnauth (Kittywhiskers Van Gogh)
3ba293fbcc refactor: remove fMasternodeMode checks in CActiveMasternodeManager (Kittywhiskers Van Gogh)
b0216ac8a6 refactor: remove fMasternodeMode usage in rpc logic (Kittywhiskers Van Gogh)
4d629a04fb refactor: limit fMasternodeMode usage in blockstorage, init, net_processing (Kittywhiskers Van Gogh)
a9cbdfcebc refactor: remove fMasternodeMode usage from llmq logic (Kittywhiskers Van Gogh)
c62a3d5778 refactor: remove fMasternodeMode usage from coinjoin logic (Kittywhiskers Van Gogh)

Pull request description:

  ## Motivation

  Since https://github.com/dashpay/dash/pull/5940, `CActiveMasternodeManager` ceased to be a global variable and became a conditional smart pointer initialized based on the value of `fMasternodeMode`.

  Likewise, since https://github.com/dashpay/dash/pull/5555, we can tell if any `CFlatDB`-based manager has successfully loaded its database. `CGovernanceManager` is one of them and conditionally loads its database based on the value of `fGovernanceDisabled`.

  `fMasternodeMode` and `fGovernanceDisabled` were (and the former to a certain degree still is) unavoidable globals due to the way the functionality they influenced was structured (i.e. decided in initialization code with no way to query from the manager itself). As we can directly ask the managers now, we can start reducing the usage of these globals and at least in this PR, get rid of one of them.

  This PR was the idea of PastaPastaPasta, special thanks for the suggestion!

  ## Additional Information

  * There are two conventions being used for checking `nullptr`-ity of a pointer, `if (mn_activeman)` and `if (mn_activeman != nullptr)`. The former is used in initialization and RPC code due to existing conventions there ([source](2dacfb08bd/src/init.cpp (L1659-L1677)), [source](2dacfb08bd/src/rpc/net.cpp (L942-L945)), [source](2dacfb08bd/src/rpc/misc.cpp (L215-L218))). The latter is used whenever the value has to be passed as a `bool` (you cannot pass the implicit conversion to a `bool` argument without explicitly casting it) and in Dash-specific code where it is the prevalent convention ([source](2dacfb08bd/src/governance/governance.cpp (L125)), [source](2dacfb08bd/src/coinjoin/client.cpp (L1064))).

    Unfortunately, that means this PR expresses the same thing sometimes in two different ways but this approach was taken so that reading is consistent within the same file. Codebase-wide harmonization is outside the scope of this PR.

  * Where `mn_activeman` isn't directly available, the result of the check is passed as an argument named `is_masternode` and/or set for the manager during its construction as `m_is_masternode` (`const bool`) as it is expected for the `CActiveMasternodeManager`'s presence or absence to remain as-is for the duration of the manager's lifetime.

    This does mean that some parts of the codebase check for `mn_activeman` while others check for {`m_`}`is_masternode`, which does reduce clarity while reading. Suggestions on improving this are welcomed.

  * One of the reasons this PR was made was to avoid having to deal the _possibility_ of `fMasternodeMode` or `fDisableGovernance` from desynchronizing from the behaviour of the managers it's suppose to influence. It's why additional assertions were placed in to make sure that `fMasternodeMode` and the existence of `mn_activeman` were always in sync ([source](2dacfb08bd/src/evo/mnauth.cpp (L137-L139)), [source](2dacfb08bd/src/rpc/governance.cpp (L319-L320))).

    But removing the tracking global and relying on a manager's state itself prevents a potential desync, which is what this PR is aiming to do.

  ## Breaking Changes

  None expected.

  ## Checklist:

  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas
  - [x] I have added or updated relevant unit/integration/functional/e2e tests
  - [x] I have made corresponding changes to the documentation **(note: N/A)**
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

Top commit has no ACKs.

Tree-SHA512: 7861afd17c83b92af4c95b2841e9b0f676116eb3f234c4d0b1dcd3c20395452893e8ca3a17c7225389c8411dac80aeb5050f06a2ae35df5ec48998a571ef120c
2024-04-26 11:02:46 -05:00
pasta
e00f1ca88e
Merge #5991: fix: various fixes for HD wallets implementation
e5129e6c41 fix: if hdseed is wrong - do not setup random seed, user can lost his fund (Konstantin Akimov)
e52498b7d5 chore: add todoes to UpgradeToHD function (Konstantin Akimov)
0d12ea9fa6 fix: wrong if/else branches for key refill in wallet creation (Konstantin Akimov)
d2c3dcb839 refactor: move list of function in rpcwallet to the end (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  Reviewed our implementation of HD wallets and compare it to bitcoin's for aiming to backport or re-implement `sethdseed` rpc.
  Noticed some strange things in our implementation, which this PR is aim to fix.

  ## What was done?
  See each commit for detailed changes.

  ## How Has This Been Tested?
  Run unit/functional tests

  ## Breaking Changes

  `-hdseed` doesn't assign a random seed anymore if an user provided an invalid hex string.

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  PastaPastaPasta:
    utACK e5129e6c41

Tree-SHA512: b404dbc0762777abf421a847f58cd243e0aa00151ba3f036835c9ff54c1109b6159921ec24e29455e975797f49d54832c55f7876188da90f37dd1e4a811a21e0
2024-04-25 12:02:20 -05:00