Commit Graph

15909 Commits

Author SHA1 Message Date
Alexander Block
a173e6836c Implement integration tests for DKG error handling (#2905)
* Allow modifying simulate DKG error rates via RPC

* Don't lie to yourself :)

* Add some missing new-lines in LogPrintf calls

* More fine grained control over which messages to expect in mine_quorum

* Implement llmq-dkgerrors.py integration tests

These test DKG errors and malicious behavior.
2019-05-08 12:13:27 +03:00
UdjinM6
89f6f75910
Implement zmq notifications for chainlocked blocks (#2899)
* Unify zmq message order

* Implement `zmqpubhashchainlock` and `zmqpubrawchainlock`
2019-05-08 12:12:54 +03:00
Alexander Block
66a2cdeafc Properly handle conflicts between ChainLocks and InstantSend (#2904)
* Move code to write archived ISLOCKs into its own method

We'll need this from another method as well later.

* Return ISLOCK instead of conflicting txid in GetConflictingTx/GetConflictingLock

* Implement GetInstantSendLocksByParent and RemoveChainedInstantSendLocks

These allow to easily delete multiple chains (actually trees) of ISLOCKs
in one go.

* Implement RemoveConflictedTx and call it from RemoveMempoolConflictsForLock

Also add "retryChildren" parameter to RemoveNonLockedTx so that we can
skip retrying of non-locked children TXs.

* Properly handle/remove conflicted TXs (between mempool and new blocks)

* Track non-locked TXs by inputs

* Implement and call ResolveBlockConflicts

* Also call ResolveBlockConflicts from ConnectBlock

But only when a block is known to have a conflict and at the same time is
ChainLocked, which causes the ISLOCK to be pruned.

* Split out RemoveChainLockConflictingLock from ResolveBlockConflicts

* Implement "quorum getrecsig" RPC

* Include decoded TX data in result of create_raw_tx

* Implement support for CLSIG in mininode.py

* Fix condition for update of nonLockedTxs.pindexMined

* Only add entries to nonLockedTxsByInputs when AddNonLockedTx is called for the first time

* Implement support for ISLOCK in mininode.py

* Implement tests for ChainLock vs InstantSend lock conflict resolution

* Handle review comment

Bail out (continue) early
2019-05-07 15:14:33 +03:00
UdjinM6
b63f7dd39a
Fix a crash in masternode winners when count is too large (#2902) 2019-05-06 17:58:59 +03:00
UdjinM6
357b7279de
Implement isolate_node/reconnect_isolated_node in tests (#2901) 2019-05-06 17:58:38 +03:00
Alexander Block
7fdc66dd86
Ask for locked TXs after removing conflicting TXs (#2898)
* Also test conflicts in mempool instead of only in blocks

* Ask for locked TXs after removing conflicting TXs

When we removed a conflicting TX from the mempool, the correct/locked TX
is not available locally as the first-seen rule would have filtered before.
We need to re-request this TX if any other node announced it before.

* Apply suggestions from code review

Co-Authored-By: codablock <ablock84@gmail.com>
2019-05-06 15:26:27 +02:00
UdjinM6
5d05ab17a9
Fix PrivateSend log (#2892) 2019-05-02 02:20:36 +03:00
Alexander Block
53827a3764 Remove code for QDEBUGSTATUS propagation (#2891)
* Remove code for QDEBUGSTATUS propagation

This turned out to be too expensive and could easily take the network
down by bringing all nodes to 100% CPU usage. Better to fully remove this
functionality.

* Apply suggestions from code review

Co-Authored-By: codablock <ablock84@gmail.com>

* Update src/rpc/rpcquorums.cpp

Co-Authored-By: codablock <ablock84@gmail.com>
2019-05-02 02:20:06 +03:00
UdjinM6
783cb9ca69
Skip CheckCbTxMerkleRoots until assumeValid block (#2890) 2019-04-30 16:20:00 +03:00
UdjinM6
4dee7c4a25
Cache heavy parts of CalcCbTxMerkleRoot* (#2885) 2019-04-30 16:19:41 +03:00
UdjinM6
b3ed6410f4
Be more accurate with denom creation/consumption (#2853)
* Be more accurate with denom creation/consumption

- Calculate and pass an actual balance needed to be denominated to CreateDenominated.
- Drop GetNeedsToBeAnonymizedBalance and fix corresponding conditions: do not overshoot, do not check max pool amount - these conditions are handled outside.
- Properly calculate various balance limits.
- Handle edge case for the final denom.

* Add an option to control max number of denoms created and respect it

`-privatesenddenoms`, default is 300

Note: CreateDenominated failure is not an error anymore

* Add few more stats to log in DoAutomaticDenominating
2019-04-30 16:19:23 +03:00
UdjinM6
3d993ee8fa
Translations v14 (#2638)
* `make translate`

* ru

* ar, bg, de, es, fi, fr, it, ja, ko, nl, pl, pt, sk, th, tr, vi, zh_CN, zh_TW

* Update src/qt/locale/dash_ru.ts

Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com>

* Update src/qt/locale/dash_ru.ts

* update sk

* update de

* update de
2019-04-30 16:18:37 +03:00
UdjinM6
fbd244dded
Bail out in few more places when blockchain is not synced yet (#2888)
* Bail out in few more places when blockchain is not synced yet

* Apply review suggestion
2019-04-30 15:55:11 +03:00
Daniel Hoffmann
fd6aaae7f0 Add proTxHash to masternode list rpc response (#2887) 2019-04-30 15:54:49 +03:00
UdjinM6
dd3977523a
More "bench" log for Dash specific parts (#2884) 2019-04-30 15:48:49 +03:00
UdjinM6
8ffdcbf999
A bunch of mostly trivial tweaks/fixes (#2889)
* Trivial: vout->txout

* Re-use SetHexStr in few more places

* Tweak log output

* fix v13 release notes links

* Drop no longer used stuff

* Few more trivial fixes

* Adjust few rpc help strings

* Apply review suggestions
2019-04-30 15:48:21 +03:00
UdjinM6
1951001614
New LLMQ-based IS should have no legacy IS strings in UI and no legacy restrictions (#2883)
(max value/too many inputs/additional fees)
2019-04-29 11:32:43 +03:00
UdjinM6
7f419ae7fc
Accept non-spent LLMQ IS locked outpoints from mempool in PS mixing (#2878) 2019-04-29 11:32:08 +03:00
Alexander Block
2652030a2b Use larger nPruneAfterSizeIn parameter for mapAlreadyAskedFor (#2882)
unordered_limitedmap was meant to be used with much larger
nPruneAfterSizeIn values to maintain good performance. The way it is not
will result in pruning too often on high load.
2019-04-25 18:39:18 +03:00
UdjinM6
03021fa53c
Harden DIP3 activation (#2881)
* Harden DIP3 activation height

Also drop all related but no longer used parts.

* Pass current block index to GetCommitmentsFromBlock

* Allow to change dip3 activation height for tests

And fix them.
2019-04-25 18:39:04 +03:00
UdjinM6
dcdb9dba12
Add NotifyMasternodeListChanged signal to CClientUIInterface (#2880)
And use it instead of BlockTipChanged for mn list changes.
2019-04-25 18:38:49 +03:00
UdjinM6
19a9e2f4cc
Report instantlock: true for transactions locked via ChainLocks (#2877)
* Report `instantlock: true` for transactions locked via ChainLocks

Also introduce `instantlock_internal` to show the actual lock state.

* Always show instantlock_internal
2019-04-25 18:38:26 +03:00
UdjinM6
5cfceab860
Refactor IS-lock GUI notification and implement a similar one for ChainLocks (#2875)
* Refactor IS-lock GUI notification and implement a similar one for ChainLocks

* Initialize cachedNumISLocks in TransactionStatus ctor
2019-04-25 18:37:39 +03:00
UdjinM6
ed30db713c
Ensure wallet is available and unlocked for some governance and evo RPCs (#2874)
* Ensure wallet is available and unlocked for specific governance rpc commands

* Ensure wallet is available and unlocked for specific protx rpc commands

Do this in actual rpc command handlers, not in the top protx rpc

* Fix few pwalletMain occurrences in rpc
2019-04-25 18:37:08 +03:00
UdjinM6
0c2fdf4da8
Refactor some Dash/mixing-specific wallet functions (#2850)
* Refactor GetCollateralTxDSIn

Avoid second loop by providiing coin type. Also, don't pick the first one, shuffle results.

* Refactor IsDenominated

* Refactor GetAnonymizedCredit

* Refactor GetDenominatedCredit

* Refactor GetAnonymizedBalance

* Refactor GetNormalizedAnonymizedBalance

* Refactor GetDenominatedBalance

* Refactor CountInputsWithAmount

* Address review comments
2019-04-25 18:36:40 +03:00
Alexander Block
22ae0bc212 Archive islock hashes when removing confirmed islocks (#2872)
This allows AlreadyHave to check if an announced (via INV) islock was
already known in the past. This avoids requesting islocks which got
obsolete due to ChainLocks.
2019-04-16 16:40:26 +03:00
Alexander Block
b322b4828e Wait longer until re-requesting recovered sigs and ISLOCKs from other peers (#2871)
Observed on testnet that MNs tend to re-request the same objects multiple
times when load becomes high, which results in the same objects being
received multiple times.
2019-04-16 16:40:12 +03:00
Alexander Block
2502aadd7c Fix infinite loop in CDBTransactionIterator::SkipDeletedAndOverwritten (#2870) 2019-04-16 16:39:59 +03:00
Alexander Block
cd94cbe6f0 Track which TXs are not locked yet and use this info in ProcessPendingRetryLockTxs (#2869)
* Track which TXs are not locked yet and use this info in ProcessPendingRetryLockTxs

Instead of relying on ReadBlockFromDisk. This should be less disk+CPU
intensive but require more RAM.

It also fixes a bug in ProcessPendingRetryLockTxs which caused ChainLocked
parents to not be considered for retrying of its children.

* Handle review commments
2019-04-16 16:39:34 +03:00
UdjinM6
c4549aca23
Change quorum list behaviour to list active quorums by default (#2866)
* Change `quorum list` behaviour to list active quorums by default

* Update `quorum list` help text with results and examples
2019-04-15 17:43:04 +03:00
UdjinM6
cff9f97179
Prefix all bls/quorum threads with dash- (#2865)
Makes it easier to find them. Note: had to s/quorum/q/ to fit into 15 characters.
2019-04-15 17:42:43 +03:00
UdjinM6
5e865f9c8a
Bump mempool counter on each successful IS lock (#2864) 2019-04-15 17:41:51 +03:00
Alexander Block
a67e661433
Don't disconnect peers on MNAUTH verification failure (#2868)
* Don't disconnect peers on MNAUTH verification failure

Only give them a DoS score.

* Re-add cs_main lock

Co-Authored-By: codablock <ablock84@gmail.com>
2019-04-15 15:25:27 +02:00
Alexander Block
1d8c7226d0 Fix race condition in sendheaders.py (#2862)
generate() will push INV messages to all nodes, including our test_node.
The original check_last_announcement() call done here will then
sporadically return Fals when the INV message is received shortly after
clear_last_announcement()

Solution is to check for the INV announcement first and then continue with
the test.
2019-04-12 14:37:14 +03:00
Alexander Block
0c54e41f22 Retry locking of child TXs in batches instead of per locked parent (#2858)
This especially avoids many calls to ReadBlockFromDisk
2019-04-12 14:36:52 +03:00
Alexander Block
fbe44761c0 Don't wake up select if it was already woken up (#2863)
This avoids calling WakeupSelect() for each node instead of just once.
2019-04-12 13:58:42 +03:00
Alexander Block
7fe1a4a78b Also invoke WriteInstantSendLockMined when IS lock comes after the mined block (#2861) 2019-04-11 23:11:56 +03:00
Alexander Block
f32f9523b9 Use lazy BLS signatures more often and don't always verify self-recovered sigs (#2860)
* Make CBLSLazySignature thread safe

* Perform malleability check in CBLSLazySignature

* Use CBLSLazySignature in CRecoveredSig and CInstantSendLock

* Only sporadically verify self-recovered signatures

* test
2019-04-11 23:11:39 +03:00
Alexander Block
5e8ae2ceb6 Disable optimistic send in PushMessage by default (#2859)
* Automatically wake up select() when optimistic send was not used

But only when we know that we are actually inside select() and that it
currenlty is unlikely for it to have selected the node's socket for
sending. We accept race conditions here as the select() timeout
will ensure that we always send the data.

* Don't manually call WakeSelect() in CSigSharesManager::SendMessages

Not needed anymore

* Disable optimistic send in PushMessage by default
2019-04-11 15:43:22 +03:00
Alexander Block
90b1b71967 Move processing of InstantSend locks into its own worker thread (#2857)
* Let ProcessPendingInstantSendLocks return true when it did some work

* Introduce own worker thread for CInstantSendManager

Instead of using the scheduler.

* Remove scheduler from CInstantSendManager

* Add missing reset() call for workInterrupt
2019-04-11 15:43:00 +03:00
Alexander Block
ae78360e5d Add cache to CQuorumManager::ScanQuorums (#2856) 2019-04-11 15:42:35 +03:00
Alexander Block
241f76f9bf Collection of minor performance optimizations (#2855)
* Merge #13176: Improve CRollingBloomFilter performance: replace modulus with FastMod

9aac9f90d5e56752cc6cbfac48063ad29a01143c replace modulus with FastMod (Martin Ankerl)

Pull request description:

  Not sure if this is optimization is necessary, but anyway I have some spare time so here it is. This replaces the slow modulo operation with a much faster 64bit multiplication & shift. This works when the hash is uniformly distributed between 0 and 2^32-1. This speeds up the benchmark by a factor of about 1.3:

  ```
  RollingBloom, 5, 1500000, 3.73733, 4.97569e-07, 4.99002e-07, 4.98372e-07 # before
  RollingBloom, 5, 1500000, 2.86842, 3.81630e-07, 3.83730e-07, 3.82473e-07 # FastMod
  ```

  Be aware that this changes the internal data of the filter, so this should probably
  not be used for CBloomFilter because of interoperability problems.

Tree-SHA512: 04104f3fb09f56c9d14458a6aad919aeb0a5af944e8ee6a31f00e93c753e22004648c1cd65bf36752b6addec528d19fb665c27b955ce1666a85a928e17afa47a

* Use unordered_map in CSporkManager

In one of my profiling sessions with many InstantSend transactions
happening, calls into CSporkManager added up to about 1% of total CPU time.
This is easily avoidable by using unordered maps.

* Use std::unordered_map instead of std::map in limitedmap

* Use unordered_set for CNode::setAskFor

* Add serialization support for unordered maps and sets

* Use unordered_map for mapArgs and mapMultiArgs

* Let limitedmap prune in batches and use unordered_multimap

Due to the batched pruning, there is no need to maintain an ordered map
of values anymore. Only when nPruneAfterSize, there is a need to create
a temporary ordered vector of values to figure out what can be removed.

* Instead of using a multimap for mapAskFor, use a vector which we sort on demand

CNode::AskFor will now push entries into an initially unordered vector
instead of an ordered multimap. Only when we later want to use vecAskFor in
SendMessages, we sort the vector.

The vector will actually be mostly sorted in most cases as insertion order
usually mimics the desired ordering. Only the last few entries might need
some shuffling around. Doing the sort on-demand should be less wasteful
then trying to maintain correct order all the time.

* Fix compilation of tests

* Fix limitedmap tests

* Rename limitedmap to unordered_limitedmap to ensure backports conflict

This ensures that future backports that depends on limitedmap's ordering
conflict so that we are made aware of needed action.

* Fix compilation error on Travis
2019-04-11 15:42:14 +03:00
Alexander Block
82a47f5432 Allow testing ChainLocks enforcement with spork19 == 1 (#2854)
This is only for testnet.
2019-04-11 15:41:51 +03:00
Nathan Marley
e67618ac5c Clean up a few GUI related items (#2846)
* Remove unused (old) icons

* Remove red line from top/bottom of frame

* Remove red line from about image

* Clean up theme display names

* Remove DASH at the beginning (just redundant)
* Capitalize theme names

* Flip "about" image back on its end

* Fix up about image a bit
2019-04-11 15:41:23 +03:00
Alexander Block
225c3898d8
Don't skip "safe TX" check when ChainLocks are not enforced yet (#2851) 2019-04-10 18:16:33 +02:00
Alexander Block
6fd9e51059
Merge pull request #2849 from codablock/pr_dip3_notifymnlistchanged
Refactor and fix missing calls to NotifyMasternodeListChanged
2019-04-10 18:16:19 +02:00
Alexander Block
27b2cd2cca
Skip required services and port checks when outgoing connections is a MN (#2847)
* Skip required services and port checks when outgoing connections is a MN

* Only relax default port check when AllowMultiplePorts is true

Co-Authored-By: codablock <ablock84@gmail.com>
2019-04-10 18:14:20 +02:00
Alexander Block
2f8440696f
Merge pull request #2848 from codablock/pr_llmq_betterintraquorum
Connect to most recently updated address in ThreadOpenMasternodeConnections
2019-04-09 13:55:04 +02:00
Alexander Block
aeb4c60c8e Reimplement CMNAuth::NotifyMasternodeListChanged to work with new interface 2019-04-09 13:28:53 +02:00
Alexander Block
fa90c0204f Also call NotifyMasternodeListChanged when MNs have been updated
And not only when added/removed.
2019-04-09 13:28:53 +02:00