3d8ff0cd2d fix: cppcheck warning about coinst in rpc/coinjoin (Konstantin Akimov)
63dfdd7d42 fix: workaround for buggy cppcheck in masternode/utils (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
`cppcheck 2.11` on my localhost returns 2 failures, that are not caught by our CI, probably due to difference in version:
```
src/rpc/coinjoin.cpp:73:28: warning: Variable 'chainman' can be declared as reference to const [constVariableReference]
src/masternode/utils.cpp:0:0: warning: Internal Error. MathLib::toLongNumber: input was not completely consumed: 5s [cppcheckError]
Advice not applicable in this specific case? Add an exception by updating
IGNORED_WARNINGS in test/lint/lint-cppcheck-dash.sh
```
## What was done?
Adds missing const, workaround for probably a crash in cppcheck 2.11.
## How Has This Been Tested?
Run `test/lint/lint-cppcheck-dash.sh`
## 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:
UdjinM6:
utACK 3d8ff0cd2d
PastaPastaPasta:
utACK 3d8ff0cd2d
Tree-SHA512: c4c7e839161a6eb8d7a25b48cd05914d94dc4e4a6d53cbd39728a74a39d626d9b533afd98a9803550d2754df5c86445e5157e0e48853af52ea5ea5cb2e15d97b
c944908399 refactor: simplify implementation of function CWallet::IsLocked (Konstantin Akimov)
685cf34cb9 fix: unlock descriptor wallet for mixing-only (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
As [noticed by kwvg](https://github.com/dashpay/dash/pull/6090#pullrequestreview-2153639183), mixing doesn't work with descriptor wallets if do "unlock only for mixing". This PR is aiming to fix this issue.
https://github.com/dashpay/dash-issues/issues/59
## What was done?
Removed default argument "bool mixing = false" from WalletStorage interface,
Refactored a logic of CWallet::IsLocked to make it shorter, clearer and unified with bitcoin.
## How Has This Been Tested?
A. Run Dash-Qt with descriptor wallet, run mixing, enter passphrase.
The wallet is partially unlocked (for mixing only) - possible to see yellow lock in status. Mixing happens.
B. Open "send transaction dialog", try to send a transaction: the app asks password to unlock wallet as expected.
Though, I am not sure how exactly to test that **all** rpc are indeed locked when descriptor wallet is unlocked for mixing only.
## 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:
UdjinM6:
LGTM, ~utACK~ light ACK c944908399
kwvg:
ACK c944908399
PastaPastaPasta:
utACK c944908399
Tree-SHA512: 236c895dd75042449282b051e90781ace1c941a3b2c34bb29ddadb6e62ba9c8d57c2a677ed98847630ff7fb6df4e14d2b59f3473d8f299ec104afeeb8103930c
0133c9866d feat: add functional test for submitchainlock far ahead in future (Konstantin Akimov)
6004e06769 feat: return enum in RecoveredSig verifying code, apply for RPC submitchainlock (Konstantin Akimov)
130b6d1e96 refactor: replace static private member method to static method (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
Currently by result of `submitchainlock` impossible to distinct a situation when a signature is invalid and when a core is far behind and just doesn't know about signing quorum yet.
This PR aims to fix this issue, as requested by shumkov for needs of platform:
> mailformed signature and can’t verify signature due to unknown quorum is the same error?
> possible to distingush ?
## What was done?
Return enum in CL verifying code `chainlock_handler.VerifyChainLock`.
The RPC `submitchainlock` now returns error with code=-1 and message `no quorum found. Current tip height: {N} hash: {HASH}`
## How Has This Been Tested?
Functional test `feature_llmq_chainlocks.py` is updated
## Breaking Changes
`submitchainlock` return one more error code - not really a breaking change though, because v21 hasn't released yet.
## 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
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
ACKs for top commit:
UdjinM6:
utACK 0133c9866d
PastaPastaPasta:
utACK 0133c9866d
Tree-SHA512: 794ba410efa57aaa66c47a67914deed97c1d060326e5d11a722c9233a8447f5e9215aa4a5ca401cb2199b8fc445144b2b2a692fc35494bf3296a74e9e115bda7
60e36b786a fix: adjust incorrect parameter description that says there is a default that doesn't exist (pasta)
Pull request description:
## Issue being fixed or feature implemented
This default doesn't actually exist in code.
## What was done?
Remove default from text
## How Has This Been Tested?
## 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)_
ACKs for top commit:
UdjinM6:
utACK 60e36b786a
Tree-SHA512: 658eb2cf101d0450619461b7ffe6069de5c04c1fdcca216713f9374cc1e60413ec9b96c3a2931fb69a4c2f8277dd6677100270960a58197da3b92dffb1e9e327
a42e9df06f fix: createwallet to require 'load_on_startup' for descriptor wallets (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
RPC `createwallet` has changed list of arguments: `createwallet "wallet_name" ( disable_private_keys blank "passphrase" avoid_reuse descriptors load_on_startup )` since https://github.com/dashpay/dash/pull/5965
`load_on_startup` used to be an argument 5 but now it has a number 6. Both arguments 5 and 6 are boolean and it can confuse an user: they may even not notice that something wrong when it meant to be "load on startup" but got "descriptor wallet" which is not expected.
See also previous attempt to resolve issue: https://github.com/dashpay/dash/pull/6029
## What was done?
To prevent confusion if user is not aware about this breaking changes, the RPC createwallet throws an exception if user trying to create descriptor wallet but has not mentioned load_on_startup. This requirement can be removed when major amount of users updated to v21.
## How Has This Been Tested?
Run unit/functional tests
Tested with CLI:
```
$ createwallet "tmp-create" true true "" false true
RPC createwallet would not accept creating descriptor wallets without specifying 'load_on_startup' flag. It is required explicitly in v21 due to breaking changes in createwallet RPC (code -8)
$ createwallet "tmp-create" true true "" false true true
{
"name": "tmp-create",
"warning": "Empty string given as passphrase, wallet will not be encrypted.\nWallet is an experimental descriptor wallet"
}
```
## Breaking Changes
You can't more pass 'descriptor=NN' without https://github.com/dashpay/dash/pull/5965 which has not been released yet.
## 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
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
ACKs for top commit:
UdjinM6:
utACK a42e9df06f
PastaPastaPasta:
utACK a42e9df06f
thephez:
utACK a42e9df06f
Tree-SHA512: bf57fed40d04a32e756e4f8bfabbe39c0cbf87275546c92f4efc19523bc3c5dd3ddc5a884d67285971dc301a6c5808bef979db52c35645ca2db0810046fe1bdc
It helps to detect case of Tip is way too far behind: the signature can be
still valid but core can't verify it yet but later it may become a valid signature.
fa3365430c5fb57d7c0b5f2bce9fbbe290be93c3 net: Use mockable time for ping/pong, add tests (MarcoFalke)
faab4aaf2fa1153c6d76efc8113fa01b06943ece util: Add count_microseconds helper (MarcoFalke)
Pull request description:
Switch `CNode::m_ping_start` and `CNetMessage::m_time` to mockable time, so that tests can be added.
Mockable time is also type-safe, since it uses `std::chrono`
ACKs for top commit:
jonatack:
Code review re-ACK fa33654 re-read code, verified rebase per `git range-diff 4b5c919 fa94d6f fa33654`, previous tested ACKs still valid
troygiorshev:
ACK fa3365430c5fb57d7c0b5f2bce9fbbe290be93c3
Tree-SHA512: 7d632bd6019ce7c882029e71b667a61517e783af82755a85dd979ef09380934e172dec8b8f91d57b200a30a6e096aeaf01f19fee7f3aed0e0e871c72eb44d70e
It fixes this failure:
```
src/rpc/coinjoin.cpp:73:28: warning: Variable 'chainman' can be declared as reference to const [constVariableReference]
Advice not applicable in this specific case? Add an exception by updating
IGNORED_WARNINGS in test/lint/lint-cppcheck-dash.sh
```
It shows this error:
```
src/masternode/utils.cpp:0:0: warning: Internal Error. MathLib::toLongNumber: input was not completely consumed: 5s [cppcheckError]
Advice not applicable in this specific case? Add an exception by updating
IGNORED_WARNINGS in test/lint/lint-cppcheck-dash.sh
```
It doesn't seems as error in our code, but I don't like this warning
createwallet has changed list of arguments: createwallet "wallet_name" ( disable_private_keys blank "passphrase" avoid_reuse descriptors load_on_startup )
load_on_startup used to be an argument 5 but now has a number 6.
Both arguments 5 and 6 are boolean and it can confuse an user.
To prevent confusion if user is not aware about this breaking changes,
the RPC createwallet throws an exception if user trying to create descriptor wallet but has not mentioned load_on_startup.
This requirement can be removed when major amount of users updated to v21
bebea4b9b6 fix: auto backup issue with descriptor wallets for CJ (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
Qt CoinJoin session has problems (https://github.com/dashpay/dash/pull/5579#pullrequestreview-1912946808):
- Autobackup problems
- False keypool depletion reporting
https://github.com/dashpay/dash-issues/issues/59
## What was done?
Disables check for "remaining keys left" and "auto-backups" for non-legacy wallet.
## How Has This Been Tested?
Run unit/functional test
Try to run CJ mixing for descriptor wallet.
## 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 bebea4b9b6
Tree-SHA512: 610551001d054c447ddca9451ac6d94f3d063ecf3ccfab437d99324efc5f99ff86e59d80a36f4ff4983d3c8107aa19292c021cb3210fcf51e79919387169c414
684503db6b feat: add a marker experimental for descriptor wallets (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
Descriptor wallets pass most of functional tests now, but they are not really tested in-the-real-environment by multiple users.
## What was done?
Add a marker "experimental" for 'createwallet' rpc, for create wallet UI form.
## How Has This Been Tested?
Run and check
## 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 684503db6b
Tree-SHA512: e843e5b8080c7cd4273ea532038f3ec65e0260419b2c2a3db07ee1fadd856a7ce47f367705b4ddb19c5fc91cee5a529a54d580dbf53428c3e5e8b433c96ec0c9
375838378a feat: bump protocol version to distinguish v21 from v20.1 (pasta)
Pull request description:
## Issue being fixed or feature implemented
See commit
## What was done?
## How Has This Been Tested?
## Breaking Changes
None really; will require MNs to upgrade in order to not be banned
## 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: c4a61e3c9a1ccda9b00a8982eaaff6ea7672bf59d9538342b0e45a16977554224b44b34db48d3355d28e2b26a01ab3133a5e0c38bb00a3d7a1410cfd1fcfc4ae
6c5246803d test: add tests for both current and future behaviour (UdjinM6)
4e86bda4dc feat: stricter bestCLHeightDiff checks (UdjinM6)
Pull request description:
## Issue being fixed or feature implemented
Current `bestCLHeightDiff` checks are too relaxed
## What was done?
Make`bestCLHeightDiff` checks stricter
## How Has This Been Tested?
Run a node on mainnet/testet, run tests
## Breaking Changes
Old nodes aren't aware of this new logic so it's activated via `mn_rr` hardfork
## 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 6c5246803d
Tree-SHA512: 2028d0ceb00a2270c92831ef38488d009d0bac47be4fc6a23ac93efdcf74847f1b9e99a529863fb4e14c65f120adda4e12c5b9e084d0f667d5f0fbaf80e3701d
8fb863008e refactor: inline sorting and make available through argument (Kittywhiskers Van Gogh)
3e0fcf471f refactor: move accessing CBlockTreeDB global out of Get*Index (Kittywhiskers Van Gogh)
ee9d11214e refactor: move pair value swapping out of CTxMemPool::getAddressIndex() (Kittywhiskers Van Gogh)
808842b1a3 refactor: define all key/value pairings as *Entry and use them instead (Kittywhiskers Van Gogh)
488f0474a8 rpc: extend error-on-failure to GetSpentIndex (Kittywhiskers Van Gogh)
9a6503d9e8 refactor: make CBlockTreeDB::Read*Index arguments const (Kittywhiskers Van Gogh)
625982e8d2 refactor: make CTxMemPool::get*Index functions and arguments const (Kittywhiskers Van Gogh)
5ad49ad668 refactor: move Get{Address*, Timestamp, Spent}Index out of validation (Kittywhiskers Van Gogh)
Pull request description:
## Additional Information
This pull request is motivated by [bitcoin#22371](https://github.com/bitcoin/bitcoin/pull/22371), which gets rid of the `pblocktree` global.
The sole usage of `pblocktree` introduced by Dash is for managing our {address, spent, timestamp} indexes with most of invocations within `BlockManager` or `CChainState`, granting them internal access to `pblocktree` (now `m_block_tree_db`). The sole exception being `Get*Index`, that relies on accessing the global and has no direct internal access.
This pull request aims to refactor code associated with `Get*Index` with the eventual aim of moving gaining access to the global out of the function. `Get*Index` is called exclusively called through RPC, which makes giving it access to `ChainstateManager` quite easy, which makes switching from the global to accessing it through `ChainstateManager` when backporting [bitcoin#22371](https://github.com/bitcoin/bitcoin/pull/22371) a drop-in replacement.
Alongside that, the surrounding code has been given some TLC:
* Moving code out of `validation.cpp` and into `rpc/index_util.cpp`. The code is exclusively used in RPC logic and doesn't aid in validation.
* Add lock annotations for accessing `pblocktree` (while already protected by `::cs_main`, said protection is currently not enforced but will be once moved into `BlockManager` in the backport)
* `const`-ing input arguments and using pass-by-value for input arguments that can be written inline (i.e. types like `CSpentIndexKey` are still pass-by-ref).
* While `const`ing `CTxMemPool` functions were possible (courtesy of the presence of `const_iterator`s), the same is currently not possible with `CBlockTreeDB` functions as the iterator is non-`const`.
* Extend error messages to `GetSpentIndex` to bring it line with other `Get*Index`es.
* Define key-value pairings as a `*Entry` typedef and replacing all explicit type constructions with it.
* Make `CTxMemPool::getAddressIndex` indifferent to how `CMempoolAddressDeltaKey` is constructed.
* Current behaviour is to accept a `std::pair<uint160, AddressType>` and construct the `CMempoolAddressDeltaKey` internally, this was presumably done to account for the return type of `getAddressesFromParams` in the sole call for the `CTxMemPool::getAddressIndex`.
* This has been changed, moving the construction into the RPC call.
* Moving {height, timestamp} sorting out of RPC and into the applicable `Get*Index` functions.
## 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 (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 8fb863008e
UdjinM6:
utACK 8fb863008e
Tree-SHA512: 425a383e8284bbd74a5e9bcda4a9d7988221197055f43faa591e6f0d579625cee28f6a6046dab951e7afa0c3e33af1778fb4bb5f0a2e1e5792fe0d9396897a14
489b44c647 Merge bitcoin/bitcoin#27610: Improve performance of p2p inv to send queues (fanquake)
Pull request description:
## Issue being fixed or feature implemented
Couple of performance improvements when draining the inventory-to-send queue:
* drop txs that have already been evicted from the mempool (or included in a block) immediately, rather than at the end of processing
* marginally increase outgoing trickle rate during spikes in tx volume
## What was done?
Backport bitcoin#27610
## How Has This Been Tested?
Run unit/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:
UdjinM6:
utACK 489b44c647
PastaPastaPasta:
utACK 489b44c647
Tree-SHA512: 4afca4705b0f9680d147f0bef006fb82a6fd9692fef898dd50aede8570d02b6fece367ec30ab2caa973279df28d90348006a1f78b550dd8b0f7e72dbcb1bba5b
5b3406094f2679dfb3763de4414257268565b943 net_processing: Boost inv trickle rate (Anthony Towns)
228e9201efb5574b1b96bb924de1d2e8dd1317f3 txmempool: have CompareDepthAndScore sort missing txs first (Anthony Towns)
Pull request description:
Couple of performance improvements when draining the inventory-to-send queue:
* drop txs that have already been evicted from the mempool (or included in a block) immediately, rather than at the end of processing
* marginally increase outgoing trickle rate during spikes in tx volume
ACKs for top commit:
willcl-ark:
ACK 5b34060
instagibbs:
ACK 5b3406094f
darosior:
utACK 5b3406094f2679dfb3763de4414257268565b943
glozow:
code review ACK 5b3406094f2679dfb3763de4414257268565b943
dergoegge:
utACK 5b3406094f2679dfb3763de4414257268565b943
Tree-SHA512: 155cd3b5d150ba3417c1cd126f2be734497742e85358a19c9d365f4f97c555ff9e846405bbeada13c3575b3713c3a7eb2f780879a828cbbf032ad9a6e5416b30