Commit Graph

25286 Commits

Author SHA1 Message Date
Kittywhiskers Van Gogh
d4aa891735
refactor: more passing CDeterministicMNManager by ref 2024-03-19 15:21:00 +00:00
Kittywhiskers Van Gogh
e628d7517a
refactor: pass CDeterministicMNManager by ref to CJContext members 2024-03-19 15:21:00 +00:00
Kittywhiskers Van Gogh
d731f4127e
refactor: pass CDeterministicMNManager by ref to LLMQContext members 2024-03-19 15:21:00 +00:00
Kittywhiskers Van Gogh
6bd23f40aa
refactor: pass CDeterministicMNManager by ref to CGovernanceManager 2024-03-19 15:20:59 +00:00
Kittywhiskers Van Gogh
055dbba1fa
refactor: move GetListAtChainTip() calls out of llmq::utils::*, misc changes 2024-03-19 15:20:59 +00:00
Kittywhiskers Van Gogh
da39b73f01
refactor: move GetListAtChainTip() calls out of CGovernanceVote 2024-03-19 15:20:59 +00:00
Kittywhiskers Van Gogh
e9de972982
refactor: move GetListAtChainTip() calls out of CGovernanceObject 2024-03-19 15:20:58 +00:00
pasta
ada0cf2b25
Merge #5929: refactor: move special transaction processing to helper, move C{CreditPool, NetFulfilledRequest}Manager to NodeContext, CDSTXManager to CJContext
991c9ec1a2 refactor: accept NodeContext arg into BlockAssembler instead of managers (Kittywhiskers Van Gogh)
c427305805 refactor: remove CNetFulfilledRequestManager global, move to NodeContext (Kittywhiskers Van Gogh)
a53046c4a9 refactor: remove CDSTXManager global and alias, move to CJContext (Kittywhiskers Van Gogh)
f0451fb98d refactor: remove CCreditPoolManager global, move to NodeContext (Kittywhiskers Van Gogh)
67cfee70f8 refactor: remove CMNHFManager::GetSignalsStage alias from CChainState (Kittywhiskers Van Gogh)
667852c851 refactor: cleanup CDSNotificationInterface member names, add asserts (Kittywhiskers Van Gogh)
0d6f736a19 fix: add missing entity for destruction in DashTestSetupClose (Kittywhiskers Van Gogh)
2dd6082e54 refactor: move special transaction processing into helper class (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

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

  ## Breaking Changes

  None. Changes are limited to refactoring, no logical changes have been made.

  ## 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 991c9ec1a2

Tree-SHA512: 7a8d90416b6de4915639908b5f6bd59caee73e26462864d12a14a5d74af300a3733d8d9b0863e267b82d2807a8a5753acf5574306a0493bb7f3d83d8f0a7da4f
2024-03-19 08:45:20 -05:00
pasta
26e886a3fe
Merge #5939: fix: avoid hSocket double lock
c9ffb72fb5 fix: avoid `hSocket` double lock (UdjinM6)

Pull request description:

  ## Issue being fixed or feature implemented
  It's is locked in `CloseSocketDisconnect()` already.

  To be merged before #5511 or 19915 backport is going to cause issues otherwise.

  ## What was done?
  Assert the lock is held already, instead of locking it again.

  ## How Has This Been Tested?
  Run tests, run a node on testnet and drop connections to peers

  ## 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:
    utACK c9ffb72fb5

Tree-SHA512: 6042d0683bf9b1326a74d73b5b44896a0470865b88e1c686d6eefe55c0d419b11a134474499bb6c9c308af69b2f7c4a60070d4535072304330cb640f91f5e367
2024-03-18 19:39:12 -05:00
Kittywhiskers Van Gogh
991c9ec1a2
refactor: accept NodeContext arg into BlockAssembler instead of managers
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2024-03-18 21:36:35 +00:00
Kittywhiskers Van Gogh
c427305805
refactor: remove CNetFulfilledRequestManager global, move to NodeContext
Decoupling initialization from loading the database means we need to
assert if the database is actually loaded before performing any operations
on it (i.e. check if the manager is "valid")
2024-03-18 21:36:34 +00:00
Kittywhiskers Van Gogh
a53046c4a9
refactor: remove CDSTXManager global and alias, move to CJContext
We don't need to run `GetDSTX` in `HandleNewRecoveredSig` since we know
for sure the transaction being handled is for enhanced hard forking
2024-03-18 21:36:34 +00:00
Kittywhiskers Van Gogh
f0451fb98d
refactor: remove CCreditPoolManager global, move to NodeContext 2024-03-18 21:36:34 +00:00
Kittywhiskers Van Gogh
67cfee70f8
refactor: remove CMNHFManager::GetSignalsStage alias from CChainState
GetMNHFSignalsStage doesn't actually probe anything from CChainState
nor is necessary for CChainState members.
2024-03-18 21:36:34 +00:00
Kittywhiskers Van Gogh
667852c851
refactor: cleanup CDSNotificationInterface member names, add asserts 2024-03-18 21:36:33 +00:00
Kittywhiskers Van Gogh
0d6f736a19
fix: add missing entity for destruction in DashTestSetupClose 2024-03-18 21:36:33 +00:00
Kittywhiskers Van Gogh
2dd6082e54
refactor: move special transaction processing into helper class 2024-03-18 21:36:32 +00:00
pasta
1c20180271
Merge #5936: backport: bitcoin#19528, #19455, #19717, #19849, #19994 - assert for RPCArg names
c5031685bc fix: rename arguments for 'voteraw' (Konstantin Akimov)
3621966f12 feat: add todo to drop Throw() from rpc/util.h (Konstantin Akimov)
b54f03a0c1 fix: wrong name of argument for coinjoin (Konstantin Akimov)
d0163543d9 refactor: use new format CPCCommand for rpc/coinjoin (Konstantin Akimov)
0e1a31159f Merge #19994: Assert that RPCArg names are equal to CRPCCommand ones (net, rpcwallet) (MarcoFalke)
af9eb81e56 fix: wrong name of arguments for RPC (Konstantin Akimov)
c30c8f22dd Merge #19849: Assert that RPCArg names are equal to CRPCCommand ones (blockchain,rawtransaction) (MarcoFalke)
f525f574b0 fix: follow-up missing changes from Merge #18607: rpc: Fix named arguments in documentation (Konstantin Akimov)
7ac1ee0fb4 Merge #19717: rpc: Assert that RPCArg names are equal to CRPCCommand ones (mining,zmq,rpcdump) (MarcoFalke)
860d31f504 Merge #19455: rpc generate: print useful help and error message (Wladimir J. van der Laan)
41c35fd8dc fix: adjust missing arguments and help for misc rpc: debug, echo, mnsync (Konstantin Akimov)
58d923cd5b Merge #19528: rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc) (MarcoFalke)

Pull request description:

  ## Issue being fixed or feature implemented
  This batch of backports asserts that RPCArg names are equal to CRPCCommand ones.

  ## What was done?
  done backports:
   - bitcoin/bitcoin#19994
   - bitcoin/bitcoin#19849
   - bitcoin/bitcoin#19717
   - bitcoin/bitcoin#19455
   - bitcoin/bitcoin#19528

  Beside that same changes are applied for src/coinjoin's rpc.

  There's also applied multiple fixes for various rpcs for cases when RPCArg names are mismatched with CPCCommand

  **Please, note, that this PR is not final fix for all RPCArgs**. There's a lot of dash's rpc that is not refactored that.
  That it is not easy to implement for `quorum command` because the list of arguments (and even their numbers) are different for each sub-command. This fixes are out-of scope of this PR and should be done before bitcoin#18531 is backported.

  See also relevant bitcoin#21035.

  ## How Has This Been Tested?
  I used this helper to see which exactly args are specified wrongly:
  ```cpp
  diff --git a/src/rpc/server.h b/src/rpc/server.h
  index d4a7ba60eb..cdfd741f54 100644
  --- a/src/rpc/server.h
  +++ b/src/rpc/server.h
  @@ -16,6 +16,7 @@
   #include <string>

   #include <univalue.h>
  +#include <logging.h>

   class CRPCCommand;

  @@ -110,6 +111,19 @@ public:
                 fn().GetArgNames(),
                 intptr_t(fn))
       {
  +        if (fn().m_name != name_in || fn().GetArgNames() != args_in) {
  +            std::cerr << "names:  " << fn().m_name << ' ' << name_in << std::endl;
  +            std::cerr << "arg names: " << fn().GetArgNames().size() << std::endl;
  +            for (const auto& i : fn().GetArgNames()) {
  +                std::cerr << "arg: " << i << std::endl;
  +            }
  +            std::cerr << "FIASCO FIASCO FIASCO FIASCO FIASCO FIASCO" << std::endl;
  +        }
           CHECK_NONFATAL(fn().m_name == name_in);
           CHECK_NONFATAL(fn().GetArgNames() == args_in);
       }
  ```

  ## Breaking Changes
  N/A

  Some arguments are renamed in RPC but they have been broken (used incorrect name not same as in docs)

  ## 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:
    (self)utACK c5031685bc

Tree-SHA512: e885a8f8fa8bc282dae092fe8df65a37e2ab6ca559cd0598d54bfc06cacddb3bd6f3c74fa2d9c1551f8a4fbdfdeabb8d065649df66d5809e792aec6f51d0df14
2024-03-18 15:12:34 -05:00
pasta
857a27916d
Merge #5938: ci: adjust amount of parallel jobs from 4 to variable
86dd0eabb4 chore: increase amount of build jobs from 4 to 8 for depends (Konstantin Akimov)

Pull request description:

  ## What was done?
  Bump CI yaml to use 8 threads for build depends

  ## How Has This Been Tested?
  Builds logs says:
  ```
  $ make -j$(nproc) -C depends HOST=$HOST $DEP_OPTS
  make: Entering directory '/builds/dashpay/dash/depends'
  ```
  https://gitlab.com/dashpay/dash/-/jobs/6409522172

  ## 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 86dd0eabb4

Tree-SHA512: dfdcae5473a5315d3fc64721f432d671a14cab9811305334f948a73ddc13e5f3e58be433988030ef6019cddd3f383c87722eaed40d8b3ab570e5c224c20191e0
2024-03-18 15:07:34 -05:00
pasta
4c06535f83
Merge #5941: trivial: remove unneeded header, enumerate circular dependencies
dfddfd09a4 trivial: remove unneeded header, enumerate circular dependencies (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  As found in https://github.com/dashpay/dash/pull/5929#discussion_r1526663050, `validation.h` is not needed for `specialtxman.cpp` and removing the header uncovers other circular dependencies that were obscured by the shortest circular path (see https://github.com/dashpay/dash/pull/5929#discussion_r1527594636).

  ## Breaking Changes

  None.

  ## 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 dfddfd09a4

Tree-SHA512: c3e74c1a381c0b69985a29f57da3565ec7681548389f09ab8b9907386f0a9f221db92a39409eb46595f3546edffa389774b96b0c9dd8f4fedff46f2d3bd635f1
2024-03-18 14:31:12 -05:00
Kittywhiskers Van Gogh
dfddfd09a4
trivial: remove unneeded header, enumerate circular dependencies
As found in a review comment in #5908[1], validation.h is not needed for
specialtxman.cpp and removing the header uncovers other circular
dependencies that were obscured by the shortest circular path[2].

[1] - https://github.com/dashpay/dash/pull/5929#discussion_r1526663050
[2] - https://github.com/dashpay/dash/pull/5929#discussion_r1527594636
2024-03-18 09:09:53 +00:00
Konstantin Akimov
c5031685bc
fix: rename arguments for 'voteraw' 2024-03-17 13:03:19 -05:00
Konstantin Akimov
3621966f12
feat: add todo to drop Throw() from rpc/util.h 2024-03-17 13:03:18 -05:00
Konstantin Akimov
b54f03a0c1
fix: wrong name of argument for coinjoin 2024-03-17 13:03:18 -05:00
Konstantin Akimov
d0163543d9
refactor: use new format CPCCommand for rpc/coinjoin 2024-03-17 13:03:18 -05:00
MarcoFalke
0e1a31159f
Merge #19994: Assert that RPCArg names are equal to CRPCCommand ones (net, rpcwallet)
fa14f57fbc3c1fa2b9eea5df687f0fb36d452bd5 Assert that RPCArg names are equal to CRPCCommand ones (net, rpcwallet) (MarcoFalke)

Pull request description:

  This is the last part split out from #18531 to just touch some RPC methods. Description from the main pr:

  ### Motivation

  RPCArg names in the rpc help are currently only used for documentation. However, in the future they could be used to teach the server the named arguments. Named arguments are currently registered by the `CRPCCommand`s and duplicate the RPCArg names from the documentation. This redundancy is fragile, and has lead to errors in the past (despite having linters to catch those kind of errors). See section "bugs found" for a list of bugs that have been found as a result of the changes here.

  ### Changes

  The changes here add an assert in the `CRPCCommand` constructor that the RPCArg names are identical to the ones in the `CRPCCommand`.

  ### Future work

  > Here or follow up, makes sense to also assert type of returned UniValue?

  Sure, but let's not get ahead of ourselves. I am going to submit any further works as follow-ups, including:

  * Removing the CRPCCommand arguments, now that they are asserted to be equal and thus redundant
  * Removing all python regex linters on the args, now that RPCMan can be used to generate any output, including the cli.cpp table
  * Auto-formatting and sanity checking the RPCExamples with RPCMan
  * Checking passed-in json in self-check. Removing redundant checks
  * Checking returned json against documentation to avoid regressions or false documentation
  * Compile the RPC documentation at compile-time to ensure it doesn't change at runtime and is completely static

  ### Bugs found

  * The assert identified issue #18607
  * The changes itself fixed bug #19250

ACKs for top commit:
  fjahr:
    tACK fa14f57fbc3c1fa2b9eea5df687f0fb36d452bd5
  ryanofsky:
    Code review ACK fa14f57fbc3c1fa2b9eea5df687f0fb36d452bd5. Just straightforward replacements except code moved in `addnode`, and displatching updated in `bumpfee_helper`

Tree-SHA512: e07af150f1d95a88e558256ce197a6b7dc6cd722a6d6c13c75d944c49c2e2441f8b8237e9f94b03db69fa18f9bda627b0781d5e1da70bf5415e09b38728a8cb1
2024-03-17 13:03:15 -05:00
Konstantin Akimov
af9eb81e56
fix: wrong name of arguments for RPC 2024-03-17 13:02:59 -05:00
MarcoFalke
c30c8f22dd
Merge #19849: Assert that RPCArg names are equal to CRPCCommand ones (blockchain,rawtransaction)
fa6bb0ce5dba33970e2c1e47ea4d0d2c0718eccb Assert that RPCArg names are equal to CRPCCommand ones (rawtransaction) (MarcoFalke)
fa80c814874a2893e4323ba5148fba21d7f421cd Assert that RPCArg names are equal to CRPCCommand ones (blockchain) (MarcoFalke)

Pull request description:

  This is split out from #18531 to just touch some RPC methods. Description from the main pr:

  ### Motivation

  RPCArg names in the rpc help are currently only used for documentation. However, in the future they could be used to teach the server the named arguments. Named arguments are currently registered by the `CRPCCommand`s and duplicate the RPCArg names from the documentation. This redundancy is fragile, and has lead to errors in the past (despite having linters to catch those kind of errors). See section "bugs found" for a list of bugs that have been found as a result of the changes here.

  ### Changes

  The changes here add an assert in the `CRPCCommand` constructor that the RPCArg names are identical to the ones in the `CRPCCommand`.

  ### Future work

  > Here or follow up, makes sense to also assert type of returned UniValue?

  Sure, but let's not get ahead of ourselves. I am going to submit any further works as follow-ups, including:

  * Removing the CRPCCommand arguments, now that they are asserted to be equal and thus redundant
  * Removing all python regex linters on the args, now that RPCMan can be used to generate any output, including the cli.cpp table
  * Auto-formatting and sanity checking the RPCExamples with RPCMan
  * Checking passed-in json in self-check. Removing redundant checks
  * Checking returned json against documentation to avoid regressions or false documentation
  * Compile the RPC documentation at compile-time to ensure it doesn't change at runtime and is completely static

  ### Bugs found

  * The assert identified issue #18607
  * The changes itself fixed bug #19250

ACKs for top commit:
  fjahr:
    utACK fa6bb0ce5dba33970e2c1e47ea4d0d2c0718eccb
  tryphe:
    utACK fa6bb0ce5dba33970e2c1e47ea4d0d2c0718eccb. Reducing data duplication is nice. Code changes are minimal and concise.

Tree-SHA512: deb0edc3f999baf055526eaa199b98c500635e12502dece7aa3cad5319db330eb5ee7459a5c8f040a83671a7f20c560c19a2026fb76c8416f138aa332727cbce
2024-03-17 13:02:58 -05:00
Konstantin Akimov
f525f574b0
fix: follow-up missing changes from Merge #18607: rpc: Fix named arguments in documentation 2024-03-17 13:02:58 -05:00
MarcoFalke
7ac1ee0fb4
Merge #19717: rpc: Assert that RPCArg names are equal to CRPCCommand ones (mining,zmq,rpcdump)
fa3d9ce3254882c545d700990fe8e9a678f31eed rpc: Assert that RPCArg names are equal to CRPCCommand ones (rpcdump) (MarcoFalke)
fa32c1d5ec25bc53bf989a8ae68e688593d2859d rpc: Assert that RPCArg names are equal to CRPCCommand ones (zmq) (MarcoFalke)
faaa46dc204d6d714f71dbc6f0bf02215dba0f0f rpc: Assert that RPCArg names are equal to CRPCCommand ones (mining) (MarcoFalke)
fa93bc14c7411a108dd024d391344fabf0f76369 rpc: Remove unused return type from appendCommand (MarcoFalke)

Pull request description:

  This is split out from #18531 to just touch the RPC methods in misc. Description from the main pr:

  ### Motivation

  RPCArg names in the rpc help are currently only used for documentation. However, in the future they could be used to teach the server the named arguments. Named arguments are currently registered by the `CRPCCommand`s and duplicate the RPCArg names from the documentation. This redundancy is fragile, and has lead to errors in the past (despite having linters to catch those kind of errors). See section "bugs found" for a list of bugs that have been found as a result of the changes here.

  ### Changes

  The changes here add an assert in the `CRPCCommand` constructor that the RPCArg names are identical to the ones in the `CRPCCommand`.

  ### Future work

  > Here or follow up, makes sense to also assert type of returned UniValue?

  Sure, but let's not get ahead of ourselves. I am going to submit any further works as follow-ups, including:

  * Removing the CRPCCommand arguments, now that they are asserted to be equal and thus redundant
  * Removing all python regex linters on the args, now that RPCMan can be used to generate any output, including the cli.cpp table
  * Auto-formatting and sanity checking the RPCExamples with RPCMan
  * Checking passed-in json in self-check. Removing redundant checks
  * Checking returned json against documentation to avoid regressions or false documentation
  * Compile the RPC documentation at compile-time to ensure it doesn't change at runtime and is completely static

  ### Bugs found

  * The assert identified issue #18607
  * The changes itself fixed bug #19250

ACKs for top commit:
  fjahr:
    tested ACK fa3d9ce3254882c545d700990fe8e9a678f31eed
  promag:
    Code review ACK fa3d9ce3254882c545d700990fe8e9a678f31eed.

Tree-SHA512: 068ade4b55cc195868d53b7f9a27151d45b440857bb069e261a49d102a49a38fdba5d68868516a1d66a54a73ba34681362f934ded7349e894042bde873b75719
2024-03-17 13:02:58 -05:00
Wladimir J. van der Laan
860d31f504
Merge #19455: rpc generate: print useful help and error message
f0aa8aeea5a183ea44a877255d12db7732f2e0a8 test: add rpc_generate functional test (Jon Atack)
92d94ffb8d07cc0d2665c901de5903a3a90d5fd0 rpc: print useful help and error message for generate (Jon Atack)
8d32d2011d3f4e1d9e587d6f80dfa4a3e9f9393d test: consider generate covered in _get_uncovered_rpc_commands() (Jon Atack)

Pull request description:

  This was a requested follow-up to #19133 and #17700 to alleviate confusion and head-scratching by people following tutorials that use `generate`. See https://github.com/bitcoin/bitcoin/pull/19455#issuecomment-668172916 below, https://github.com/bitcoin/bitcoin/pull/19133#issuecomment-636860943 and https://github.com/bitcoin/bitcoin/pull/17700#issuecomment-566159096.

  before
  ```
  $ bitcoin-cli help generate
  help: unknown command: generate

  $ bitcoin-cli generate
  error code: -32601
  error message:
  Method not found
  ```

  after
  ```
  $ bitcoin-cli help generate
  generate ( nblocks maxtries ) has been replaced by the -generate cli option. Refer to -help for more information.

  $ bitcoin-cli generate
  error code: -32601
  error message:
  generate ( nblocks maxtries ) has been replaced by the -generate cli option. Refer to -help for more information.
  ```

  In the general help it remains hidden, as requested by laanwj.
  ```
  $ bitcoin-cli help

  == Generating ==
  generateblock "output" ["rawtx/txid",...]
  generatetoaddress nblocks "address" ( maxtries )
  generatetodescriptor num_blocks "descriptor" ( maxtries )
  ```

ACKs for top commit:
  adamjonas:
    utACK f0aa8aeea5a183ea44a877255d12db7732f2e0a8
  pinheadmz:
    ACK f0aa8aeea5a183ea44a877255d12db7732f2e0a8

Tree-SHA512: d083652589ad3e8228c733455245001db22397559c3946e7e573cf9bd01c46e9e88b72d934728ec7f4361436ae4c74adb8f579670b09f479011924357e729af5
2024-03-17 13:02:57 -05:00
Konstantin Akimov
41c35fd8dc
fix: adjust missing arguments and help for misc rpc: debug, echo, mnsync 2024-03-17 13:02:57 -05:00
MarcoFalke
58d923cd5b
Merge #19528: rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc)
fa77de2baa40ee828c850ef4068c76cc3619e87b rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc) (MarcoFalke)
fa50bdc755489b2e291ea5ba0e39e44a20c6c6de rpc: Limit echo to 10 args (MarcoFalke)
fa89ca9b5bd334813fd7e7edb202c56b35076e8d refactor: Use C++11 range based for loops to simplify rpc code (MarcoFalke)
fa459bdc87bbb050ca1c8d469023a96ed798540e rpc: Treat all args after a hidden arg as hidden as well (MarcoFalke)

Pull request description:

  This is split out from #18531 to just touch the RPC methods in misc. Description from the main pr:

  ### Motivation

  RPCArg names in the rpc help are currently only used for documentation. However, in the future they could be used to teach the server the named arguments. Named arguments are currently registered by the `CRPCCommand`s and duplicate the RPCArg names from the documentation. This redundancy is fragile, and has lead to errors in the past (despite having linters to catch those kind of errors). See section "bugs found" for a list of bugs that have been found as a result of the changes here.

  ### Changes

  The changes here add an assert in the `CRPCCommand` constructor that the RPCArg names are identical to the ones in the `CRPCCommand`.

  ### Future work

  > Here or follow up, makes sense to also assert type of returned UniValue?

  Sure, but let's not get ahead of ourselves. I am going to submit any further works as follow-ups, including:

  * Removing the CRPCCommand arguments, now that they are asserted to be equal and thus redundant
  * Removing all python regex linters on the args, now that RPCMan can be used to generate any output, including the cli.cpp table
  * Auto-formatting and sanity checking the RPCExamples with RPCMan
  * Checking passed-in json in self-check. Removing redundant checks
  * Checking returned json against documentation to avoid regressions or false documentation
  * Compile the RPC documentation at compile-time to ensure it doesn't change at runtime and is completely static

  ### Bugs found

  * The assert identified issue #18607
  * The changes itself fixed bug #19250

ACKs for top commit:
  laanwj:
    Code review ACK fa77de2baa40ee828c850ef4068c76cc3619e87b
  fjahr:
    tested ACK fa77de2baa40ee828c850ef4068c76cc3619e87b
  theStack:
    ACK fa77de2baa
  ryanofsky:
    Code review ACK fa77de2baa40ee828c850ef4068c76cc3619e87b. Pretty straightfoward changes

Tree-SHA512: badae1606518c0b55ce2c0bb9025d14f05556532375eb20fd6f3bfadae1e5e6568860bff8599d037e655bf1d23f1f464ca17f4db10a6ab3d502b6e9e61c7b3d3
2024-03-17 13:02:57 -05:00
pasta
c23514dc49
Merge #5823: backport: bitcoin#19200, #19405, #20282
9c54cb16de Merge #19405: rpc, cli: add network in/out connections to `getnetworkinfo` and `-getinfo` (Wladimir J. van der Laan)
19aba38cab Merge #19200: rpc: remove deprecated getaddressinfo fields (Samuel Dobson)
f5642281cc Merge #20282: wallet: change upgradewallet return type to be an object (Samuel Dobson)

Pull request description:

  ## Issue being fixed or feature implemented
  Bitcoin backports with breaking changes

  ## What was done?
   - bitcoin/bitcoin#20282
   - bitcoin/bitcoin#19200
   - bitcoin/bitcoin#19405

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

  ## Breaking Changes
  ### RPC:
  - `upgradewallet` now returns object for future extensibility (#20282)

  - `getnetworkinfo` now returns fields `connections_in`, `connections_out`,
    `connections_mn_in`, `connections_mn_out`, `connections_mn`
    that provide the number of inbound and outbound peer
    connections. These new fields are in addition to the existing `connections`
    field, which returns the total number of peer connections. Old fields
    `inboundconnections`, `outboundconnections`, `inboundmnconnections`,
    `outboundmnconnections` and `mnconnections` are removed (#19405)

  - Backwards compatibility has been dropped for two `getaddressinfo` RPC
    deprecations, as notified in the 19.1.0 and 19.2.0 release notes.
    The deprecated `label` field has been removed as well as the deprecated `labels` behavior of
    returning a JSON object containing `name` and `purpose` key-value pairs. Since
    20.1, the `labels` field returns a JSON array of label names. (#19200)

  ### CLI

  - The `connections` field of `bitcoin-cli -getinfo` is expanded to return a JSON
    object with `in`, `out` and `total` numbers of peer connections and `mn_in`,
    `mn_out` and `mn_total` numbers of verified mn connections. It previously
    returned a single integer value for the total number of peer connections. (#19405)

  ## 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 9c54cb16de

Tree-SHA512: 9710cdd062d02d64e2eebcecca1b5c2e6ccda5ca6d9bd6d1833700f4273fcfb206ae99134f71bbc8b0843cb8ebba208c72139f5a624d79ec7362bd73b117bfb2
2024-03-17 12:58:46 -05:00
Konstantin Akimov
86dd0eabb4
chore: increase amount of build jobs from 4 to 8 for depends 2024-03-17 01:09:41 +07:00
UdjinM6
c9ffb72fb5
fix: avoid hSocket double lock
It's is locked in `CloseSocketDisconnect()` already.
2024-03-16 15:54:08 +03:00
Wladimir J. van der Laan
9c54cb16de
Merge #19405: rpc, cli: add network in/out connections to getnetworkinfo and -getinfo
581b343d5bf517510ab0236583ca96628751177d Add in/out connections to cli -getinfo (Jon Atack)
d9cc13e88d096c1a171159c01cbb96444f7f8d7f UNIX_EPOCH_TIME fixup in rpc getnettotals (Jon Atack)
1ab49b81cf32b6ef9e312a0a8ac45c68a3262f0d Add in/out connections to rpc getnetworkinfo (Jon Atack)

Pull request description:

  This is basic info that is present in the GUI that I've been wishing to have exposed via the RPC and CLI without needing a bash workaround or script. For human users it would also be useful to have it in `-getinfo`.

  `bitcoin-cli getnetworkinfo`
  ```
    "connections": 15,
    "connections_in": 6,
    "connections_out": 9,
  ```

  `bitcoin-cli -getinfo`
  ```
    "connections": {
      "in": 6,
      "out": 9,
      "total": 15
    },
  ```

  Update the tests, RPC help, and release notes for the changes. Also fixup the `getnettotals` timemillis help while touching `rpc/net.cpp`.

  -----

  Reviewers can manually test this PR by [building from source](https://jonatack.github.io/articles/how-to-compile-bitcoin-core-and-run-the-tests), launching bitcoind, and then running `bitcoin-cli -getinfo`, `bitcoin-cli getnetworkinfo`, `bitcoin-cli help getnetworkinfo`, and `bitcoin-cli help getnettotals` (for the UNIX epoch time change).

ACKs for top commit:
  eriknylund:
    > tACK [581b343](581b343d5b) on master at [a0a422c](a0a422c34c), ran unit & functional tests and and confirmed changes on an existing datadir ✌️
  benthecarman:
    tACK `581b343`
  willcl-ark:
    tACK for 581b343d5bf517510ab0236583ca96628751177d, this time rebased onto master at 862fde88be706adb20a211178253636442c3ae00.
  shesek:
    tACK `581b343`. This provides what I needed, thanks!
  n-thumann:
    tACK 581b343 on master at a0a422c, ran unit & functional tests and and confirmed changes on an existing datadir ✌️

Tree-SHA512: 08dd3ac8fefae401bd8253ff3ac027603c528eeccba53cedcb127771316173a7052fce44af8fa33ac98ebc4cf2a2b11cdefd949995d55e9b9a5942b876d00dc5
2024-03-16 02:39:45 +07:00
Samuel Dobson
19aba38cab
Merge #19200: rpc: remove deprecated getaddressinfo fields
BACKPORT NOTICE:
These backports #17578 and #17585 are included to 19.1 and 19.2. That's long enough!
------------------------------------------
bc01f7ae0538d3c647ce8dfbc29f7914d5df3fbb doc: release note for rpc getaddressinfo removals (Jon Atack)
90e989390ee50633fff0e4f210a1ea23ff00e012 rpc: getaddressinfo RPCResult fixup (Jon Atack)
a8507c99da10791aa69ca277128e06753942e976 rpc: remove deprecated getaddressinfo `labels: purpose` (Jon Atack)
645a8653c895e4fc7717e9e5ac045612b5deaa60 rpc: remove deprecated getaddressinfo `label` field (Jon Atack)

Pull request description:

  These were deprecated in #17578 and #17585, with expected 0.21 removal notified in the 0.20 release notes.
  ```
  - The `getaddressinfo` RPC has had its `label` field deprecated
    (re-enable for this release using the configuration parameter
    `-deprecatedrpc=label`).  The `labels` field is altered from returning
    JSON objects to returning a JSON array of label names (re-enable
    previous behavior for this release using the configuration parameter
    `-deprecatedrpc=labelspurpose`).  Backwards compatibility using the
    deprecated configuration parameters is expected to be dropped in the
    0.21 release.  (#17585, #17578)
  ```

ACKs for top commit:
  Sjors:
    utACK bc01f7a
  adamjonas:
    utACK bc01f7a
  meshcollider:
    utACK bc01f7ae0538d3c647ce8dfbc29f7914d5df3fbb

Tree-SHA512: ae1af381e32c4c3bde8b061a56382838513a9a82c88767843cdeae3a2ab8aa7d8c2e66e106d2b31ea07d74bb80c191a2f842c9aaecc7c5438ad9a9bc66d1b251
2024-03-16 02:39:42 +07:00
pasta
2110c0c309
Merge #5908: refactor: move masternode payments processing to helper class, move C{Governance,Spork}Manager to NodeContext
a93de8690b refactor: s/governanceManager/govman/g (Kittywhiskers Van Gogh)
0aa08ba80d refactor: remove CGovernanceManager global, move to NodeContext (Kittywhiskers Van Gogh)
405b8c669a refactor: s/sporkManager/sporkman/g (Kittywhiskers Van Gogh)
60fd1aa774 refactor: remove CSporkManager global, move to NodeContext (Kittywhiskers Van Gogh)
24ba2f027c refactor: remove redundant condition check in `IsOldBudgetBlockValueValid` (Kittywhiskers Van Gogh)
e2405e67fb refactor: move MasternodePayments::* functions into helper class (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * `PeerManager`'s initialization has been moved downwards (it used to be initialized _after_ `CGovernanceManager`) to now _after_ `CMasternodeSync`. This is to avoid having to pass `CSporkManager`'s `unique_ptr` container and instead pass the its dereferenced pointer.
  * `CChainstateHelper` is just proxy for helper classes meant to hold references to managers that would be needed by functions that are called by `CChainState`. It's the alternative to passing every single manager into `CChainState` through `ChainstateManager`.

    Instead, they're all bunched up via `CChainstateHelper` and is accessible to `CChainState` through passing it as an argument. For this reason, it should ideally initialized _after_ all relevant managers are setup but _before_ the chain is validated. We would want to avoid deferred dereferencing if we can help it.
    * Internal/private functions have been marked as `[[nodiscard]]`.

  ## Breaking Changes

  None. Changes are limited to refactoring, no logical changes have been made.

  ## 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 a93de8690b

Tree-SHA512: b576ca61a94b86b8a6fa8909379d156ff902198b5824fcfb4665e5eb9d1d5e250db737f84a877de634a490146b82759c2350370903f430997423fd71142106d1
2024-03-15 12:21:26 -05:00
pasta
dd97ce61d3
Merge #5911: backport: bitcoin#18788, #18974, #19230, #19239, #19441, #19568, #19668, #20226, #21049, #22446 (descriptor wallets part II)
85fa6e4585 Merge bitcoin/bitcoin#22446: test: Fix wallet_listdescriptors.py if bdb is not compiled (fanquake)
9a02f7da94 fix: drop requirement of HD in CanGetAddresses for watch-only wallets (Konstantin Akimov)
d04c1a703e fix: unify ScriptPubKeyMan implementation with bitcoin's (Konstantin Akimov)
953b6706f4 Merge #18788: tests: Update more tests to work with descriptor wallets (Wladimir J. van der Laan)
da2a7ed6d7 Merge #21049: Add release notes for listdescriptors RPC (MarcoFalke)
56d9fe9510 Merge #20226: wallet, rpc: add listdescriptors command (Samuel Dobson)
59c30e610b fix: add missing dashification for bitcoin#18067 (Konstantin Akimov)
3575a6c4b1 Merge #19568: Wallet should not override signing errors (fanquake)
9600f9ca35 Merge #19441: walletdb: don't reinitialize desc cache with multiple cache entries (Samuel Dobson)
a1e3885a68 Merge #19239: tests: move generate_wif_key to wallet_util.py (MarcoFalke)
eaf31ad2be Merge #19230: [TESTS] Move base58 to own module to break circular dependency (MarcoFalke)
6668e21e1f Merge #18974: test: Check that invalid witness destinations can not be imported (MarcoFalke)

Pull request description:

  ## Issue being fixed or feature implemented
  This PR continues supporting of Descriptor Wallets, see https://github.com/dashpay/dash/pull/5579 for prior work.
  See https://github.com/dashpay/dash-issues/issues/59 for Check-list issue

  ## What was done?

  Particularly:
   - bitcoin/bitcoin#18974
   - bitcoin/bitcoin#19230
   - bitcoin/bitcoin#19239
   - bitcoin/bitcoin#19441
   - bitcoin/bitcoin#19568
   - bitcoin/bitcoin#20226
   - bitcoin/bitcoin#21049
   - bitcoin/bitcoin#18788
   - bitcoin/bitcoin#22446

  Beside that fixed:
   - drop requirement of HD in CanGetAddresses for watch-only wallets
   - unify ScriptPubKeyMan implementation for KeyOrigin with bitcoin's
   - minor dashification for  bitcoin/bitcoin#18067

  ## How Has This Been Tested?
  Run unit + functional test. Backport bitcoin#18788 enables descriptor wallets for multiple functional tests.

  ## 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 85fa6e4585

Tree-SHA512: 4759e834c04d0f66e765399e3941afcaad2b63503d79a5cef2c04393bbeccaa8e85c06ae3633504c74ad7854180d4d7f3d4eb11c1c3a27ab9ac166a9811b90df
2024-03-13 23:15:15 -05:00
Kittywhiskers Van Gogh
a93de8690b
refactor: s/governanceManager/govman/g 2024-03-14 03:29:06 +00:00
Kittywhiskers Van Gogh
0aa08ba80d
refactor: remove CGovernanceManager global, move to NodeContext 2024-03-14 03:29:06 +00:00
Kittywhiskers Van Gogh
405b8c669a
refactor: s/sporkManager/sporkman/g
sporkManager was the name of the global that's been removed a commit ago,
remove variable names that could be misread as the global still existing
2024-03-14 03:29:06 +00:00
Kittywhiskers Van Gogh
60fd1aa774
refactor: remove CSporkManager global, move to NodeContext 2024-03-14 03:29:05 +00:00
Kittywhiskers Van Gogh
24ba2f027c
refactor: remove redundant condition check in IsOldBudgetBlockValueValid
We're already checking if the block height is after the budget payment
start block and fast-failing if it isn't. There's no need to check again
a few lines later (consensus params are expected to be constant).

Reported by linter in CI build, https://gitlab.com/dashpay/dash/-/jobs/6281174570#L99
2024-03-14 03:29:05 +00:00
Kittywhiskers Van Gogh
e2405e67fb
refactor: move MasternodePayments::* functions into helper class
Co-authored-by: Konstantin Akimov <knstqq@gmail.com>
2024-03-14 03:29:04 +00:00
pasta
1cbaa7b957
Merge #5927: fix: check if message can be handled before attempting to deserialize
afbae06520 fix: check if message can be handled before attempting to deserialize (thephez)

Pull request description:

  ## Issue being fixed or feature implemented
  Currently `message-capture-parser.py` crashes when encountering certain messages (e.g. mnauth). This at least makes it possible to run the script without crashing. There may be better options for solving this.

  ## What was done?
  Check if the dictionary is going to return `None` before we attempt to do something further with it. Hide whitespace changes to see the few lines that were added: https://github.com/dashpay/dash/pull/5927/files?diff=unified&w=1

  ## How Has This Been Tested?
  Running script locally

  ## Breaking Changes
  N/A

  ## Checklist:
    _Go over all the following points, and put an `x` in all the boxes that apply._
  - [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
  - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

Top commit has no ACKs.

Tree-SHA512: 041af57afcfd1d93487fd41d34a50e3a99f7fa129563dfe1e1cf2498974c8e658bd6acb9c810887c841160074056ba999e9b6607ac9336b98b9d42806682c607
2024-03-12 15:18:35 -05:00
thephez
afbae06520
fix: check if message can be handled before attempting to deserialize
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2024-03-12 15:17:16 -05:00
pasta
9b0f15c39e
Merge #5935: ci: fail clang-diff-format on failure
d1f881d7b4 ci: fail clang-diff-format on failure (pasta)

Pull request description:

  ## Issue being fixed or feature implemented
  I have it now where CI marks this as not-required; but this will better inform us when someone should run clang-diff-format :) Should be ignored for backports or other instances where a diff would be annoying.

  ## What was done?
  Fail CI

  ## How Has This Been Tested?
  Run script locally

  ## Breaking Changes
  None

  ## 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)_

Top commit has no ACKs.

Tree-SHA512: dd915f509bd8fc89bd22a5875210eb99a67a96151573c058e52c2fb900c77757a89031b0e872e8f06f5be98b6a12f11543f753b5b1fd8ad06553452456db1414
2024-03-12 14:54:04 -05:00
pasta
d1f881d7b4
ci: fail clang-diff-format on failure 2024-03-12 14:53:46 -05:00