* Move PS mixing entry verification on masternodes into `AddEntry()`
Also streamline logic a bit and drop unused/excessive parts.
* Unify PS checks among masternodes and clients
* No need to re-check outputs over and over again
* No need to count, fail early if any output is missing
* No need to look any further once we found the input we expected
A tx with duplicate inputs would be considered invalid anyway and we also know there are no duplicates because we just verified the final tx above.
Also drop an unused variable.
* Unify LogPrint-s
* Drop human-readable strings for unused PoolMessage-s
* Apply suggestions from code review
Co-Authored-By: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
* Re-introduce zero-fee checks
* fix log
* Move all txin/txout verification logic shared by CPrivateSendClientSession::SignFinalTransaction() and CPrivateSendServer::AddEntry() into CPrivateSendBaseSession::IsValidInOuts()
* fix nit
* Add missing return
* Use CCoinsViewMemPool instead of doing it manually
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
Co-authored-by: Alexander Block <ablock84@gmail.com>
* Hold cs_main/cs_wallet in main MakeCollateralAmounts
Otherwise smth else can alter wallet state and we might end up creating conflicting txes.
* AssertLockHeld
* Disable move ctor/operator for CKeyHolder
Also fixes these warnings:
```
In file included from dsnotificationinterface.cpp:12:
In file included from ./privatesend/privatesend-client.h:8:
./privatesend/privatesend-util.h:18:5: warning: explicitly defaulted move constructor is implicitly deleted [-Wdefaulted-function-deleted]
CKeyHolder(CKeyHolder&&) = default;
^
./privatesend/privatesend-util.h:13:17: note: move constructor of 'CKeyHolder' is implicitly deleted because field 'reserveKey' has a deleted move constructor
CReserveKey reserveKey;
^
./wallet/wallet.h:1282:5: note: 'CReserveKey' has been explicitly marked deleted here
CReserveKey(const CReserveKey&) = delete;
^
In file included from dsnotificationinterface.cpp:12:
In file included from ./privatesend/privatesend-client.h:8:
./privatesend/privatesend-util.h:19:17: warning: explicitly defaulted move assignment operator is implicitly deleted [-Wdefaulted-function-deleted]
CKeyHolder& operator=(CKeyHolder&&) = default;
^
./privatesend/privatesend-util.h:13:17: note: move assignment operator of 'CKeyHolder' is implicitly deleted because field 'reserveKey' has a deleted move assignment operator
CReserveKey reserveKey;
^
./wallet/wallet.h:1283:18: note: 'operator=' has been explicitly marked deleted here
CReserveKey& operator=(const CReserveKey&) = delete;
^
2 warnings generated.
```
* Slightly refactor `CKeyHolderStorage::AddKey()` to clarify that it's ptr and not the object itself that we are moving
* Fix cache usage in SelectCoinsGroupedByAddresses
* Reset cache flags in SelectCoinsGroupedByAddresses when a block is (dis)connected
* MakeCollateralAmounts should call SelectCoinsGroupedByAddresses with a limited number of inputs
* Introduce getprivatesendinfo and deprecate getpoolinfo
* s/ToJson/GetJsonInfo/
* s/queues/queue_size/
* Add TODO to explain `denomination` string convertion
* s/entries/entries_count/
* Use `CURRENCY_UNIT`
* Who needs safety belts after all
* Always check for expired queues on masternodes
* Check if a queue is too old or too far into the future
Instead of only checking that it's to old
* Check that no masternode can spam us with dsqs regardless of dsq readiness
* Remove LogPrints which have been commented out.
We have version control systems for a reason, if we want code to not run it should be removed. I personally see no value in keeping these around. I presume at one point they were spamming debug.log so we commented them out, but we really should have just removed them.
I believe all of this is dash specific code but any conflicts this does create are so minor they are not of concern imo.
Signed-off-by: Pasta <pasta@dashboost.org>
* remove a couple of extra comments
Signed-off-by: Pasta <pasta@dashboost.org>
* remove commented out code
Signed-off-by: Pasta <pasta@dashboost.org>
* remove liquidity provider. The reason behind this is two fold:
1. it is very likely nobody is currently running this on the mainnet (due to already strong liquidity), it provides no use for testnet as there you can just enable mixing and get the same affect. Because of this reason I don't find it okay to just remove it outright.
2. even if people did use it (or if some do as a novelty) it likely hurts the privacy of the system. This is because as a liquidity provider your outputs will always take many (sometimes hundreds) blocks before being used in a new mixing round, whereas real user's funds will normally be mixed again very rapidly.
Signed-off-by: Pasta <pasta@dashboost.org>
* remove unused function
Signed-off-by: Pasta <pasta@dashboost.org>
* Merge #8694: Basic multiwallet support
c237bd7 wallet: Update formatting (Luke Dashjr)
9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr)
a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr)
b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr)
008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr)
19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr)
74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr)
23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr)
9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr)
f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)
Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23
* pwalletMain -> vpwallets
Signed-off-by: Pasta <pasta@dashboost.org>
* add gArgs
Signed-off-by: Pasta <pasta@dashboost.org>
* continued pwalletsMain -> vpwallets
Signed-off-by: Pasta <pasta@dashboost.org>
* remove external pwalletMains and pwalletMain -> vpwallet
Signed-off-by: Pasta <pasta@dashboost.org>
* add external referance to vpwallets
Signed-off-by: Pasta <pasta@dashboost.org>
* more pWalletMain -> vpwallets[0]
Signed-off-by: Pasta <pasta@dashboost.org>
* code review
Signed-off-by: Pasta <pasta@dashboost.org>
* revert LOCK(cs_main) move
Signed-off-by: Pasta <pasta@dashboost.org>
* import wallet.h and remove extern
Signed-off-by: Pasta <pasta@dashboost.org>
* batch.* -> WriteIC and EraseIC
Signed-off-by: Pasta <pasta@dashboost.org>
* wrap wallet.h include inside of an ifdef
Signed-off-by: Pasta <pasta@dashboost.org>
* drop wallet.h
Signed-off-by: Pasta <pasta@dashboost.org>
* add dropped "!"
Signed-off-by: Pasta <pasta@dashboost.org>
* remove DS mixes once they have been included in a chainlocked block
Signed-off-by: Pasta <pasta@dashboost.org>
* Use multiple if checks instead of one line conditional
Signed-off-by: Pasta <pasta@dashboost.org>
* Decouple lite mode and client-side PrivateSend
`-enableprivatesend`:
1. off by default in lite mode but can be overridden
2. does not start mixing, use `-privatesendautostart` (default is off) or `privatesend` rpc instead
* Disable PS when there is no wallet, do not auto-start mixing when wallet is locked
* Check for `!fEnablePrivateSend` and `!fPrivateSendRunning` instead of `!pwalletMain` in ps client code
* Add meaningful `privatesend` rpc error messages for various cases when mmixing is disabled
* Remove skipped denom from the list on tx commit
Regardless of the tx type (PS or not).
* Update src/privatesend/privatesend-client.cpp
Co-Authored-By: Alexander Block <ablock84@gmail.com>
0f3471f net: make CNode's id private (Cory Fields)
9ff0a51 scripted-diff: net: Use accessor rather than node's id directly (Cory Fields)
e50c33e devtools: add script to verify scriptable changes (Cory Fields)
skipped travis changes
Tree-SHA512: a0ff50f4e1d38a2b63109b4996546c91b3e02e00d92c0bf04f48792948f78b1f6d9227a15d25c823fd4723a0277fc6a32c2c1287c7abbb7e50fd82ffb0f8d994
pnode->id to pnode->GetId()
Signed-off-by: Pasta <pasta@dashboost.org>
* Stop reporting/processing the number of mixing participants
* Introduce CPrivateSendStatusUpdate class to encapsulate serialization of DSSTATUSUPDATE msg
And make corresponding enums serializable too.
* Revert range checks removal
* adjust privatesend files formatting and follow some best practices
* code review
Signed-off-by: Pasta <Pasta@dash.org>
* use auto for iterators
Signed-off-by: Pasta <Pasta@dash.org>
* review pt2
Signed-off-by: Pasta <Pasta@dash.org>
* Generalize CBLSLazyWrapper so that it can be used of pubkeys and secret keys
* Implement == and != operators for CBLSLazyWrapper
* Implement cached hash for CBLSLazyWrapper
* Use CBLSLazyPublicKey for CDeterministicMNState::pubKeyOperator
* Speed up GetProjectedMNPayees by sorting the MN list by last paid
Instead of updating a temporary list for each projected height and calling
GetMNPayee() on it.
* Cache intermediate lists in GetListForBlock
This avoids re-loading and applying diffs again and again.
* Only update masternode list UI max once every 3 seconds
This avoids updating the UI on every block, which turned out to be very
expensive.
* Fix compilation
* Drop time restrictions for mn list update in ClientModel
They are fully handled by MasternodeList now.
* Tighten rules for dstx
* Tighten rules for dsvin
* NULL -> nullptr
* Make `ConsumeCollateral()` a private function instead of a lamda and reuse it in `Charge*Fees()`
* Make sure inputs and outputs are of the same size
Introduces new response ERR_SIZE_MISMATCH, old clients will simply bail out.
* Drop now redundant vecTxOut.size() check
* Check max inputs size
* Fix log category
* Contains dashification. disables `-debug dash`
Merge #9424: Change LogAcceptCategory to use uint32_t rather than sets of strings.
6b3bb3d Change LogAcceptCategory to use uint32_t rather than sets of strings. (Gregory Maxwell)
Tree-SHA512: ebb5bcf9a7d00a32dd1390b727ff4d29330a038423611da01268d8e1d2c0229e52a1098e751d4e6db73ef4ae862e1e96d38249883fcaf12b68f55ebb01035b34
Signed-off-by: Pasta <Pasta@dash.org>
31 -> 32
Signed-off-by: Pasta <Pasta@dash.org>
* Merge #10123: Allow debug logs to be excluded from specified component
3bde556 Add -debugexclude option to switch off logging for specified components (John Newbery)
Tree-SHA512: 30202e3f2085fc2fc5dd4bedb92988f4cb162c612a42cf8f6395a7da326f34975ddc347f82bc4ddca6c84c438dc0cc6e87869f90c7ff88105dbeaa52a947fa43
* bump to uint64_t due to added Dash codes
Signed-off-by: Pasta <Pasta@dash.org>
* bump to uint64_t due to added Dash codes cont.
Signed-off-by: Pasta <Pasta@dash.org>
* string -> BCLog format
Signed-off-by: Pasta <Pasta@dash.org>
* uint32_t -> uint64_t
Signed-off-by: Pasta <Pasta@dash.org>
* Fix CBatchedLogger
* Fix most fDebug-s
* Fix `debug` rpc
* Fix BENCH and RAND conflicts
* Add ALERT and use it
* Update LogPrint-s in dash-specific code
* Tweak few log categories
Specifically:
- use PRIVATESEND in `CPrivateSendClientManager::GetRandomNotUsedMasternode()`
- use ZMQ in `CZMQPublishRawGovernanceVoteNotifier::NotifyGovernanceVote()` and `CZMQPublishRawGovernanceObjectNotifier::NotifyGovernanceObject()`
* Drop no longer used MASTERNODE category
* Merge #10153: logging: Fix off-by-one for shrinkdebugfile default
faab624 logging: Fix off-by-one for shrinkdebugfile (MarcoFalke)
Tree-SHA512: d6153e06067906172ff0611af9e585a3ecf0a7d56925b6ad7c12e75aa802441047059b9b6f6c78e79916c3f2abc8f1998bfd2d5b84201ec6421f727c08da3c21
* Shift dash-specific log categories to start from `1ul << 32` to avoid potential future conflicts with bitcoin ones
* Fix `dash` category
* remove debugCategories
Signed-off-by: Pasta <Pasta@dash.org>
* Prepend "std::" to find call
* Check for BCLog::PRIVATESEND instead of logCategories != BCLog::NONE
* Use BCLog::MNPAYMENTS category instead of checking for logCategories != BCLog::NONE
* Move "End Dash" comment below "ALERT"
When adding new entries here, we'll otherwise get confused with ordering
and might end up forgetting that adding something Dash specific must
continue with the bit after 43.
* rename instantx.* file to instantsend.*
* Reorganize Dash Specific code into folders
add to privatesend folder the header files
Signed-off-by: Pasta <Pasta@dash.org>
add "masternode" to imports
Signed-off-by: Pasta <Pasta@dash.org>
add "masternode" to imports
Signed-off-by: Pasta <Pasta@dash.org>
add "masternode" to imports pt 2
Signed-off-by: Pasta <Pasta@dash.org>