Commit Graph

15038 Commits

Author SHA1 Message Date
Alexander Block
016681cd38 Add support for serialization of bitsets and tuples (#2293)
* Add serialization support for dynamic and fixed size bitsets

* Support serialization of std::tuple
2018-09-14 18:53:49 +03:00
Alexander Block
9d90b4fa47 Honor filterInventoryKnown for non-tx/non-block items (#2292) 2018-09-14 18:53:26 +03:00
Alexander Block
6adc236d0e Only use dataDir in CEvoDB when not in-memory (#2291) 2018-09-14 18:53:09 +03:00
Alexander Block
8a878bfcfd Call InitializeCurrentBlockTip and activeMasternodeManager->Init after importing has finished (#2286)
While importing, IsInitialBlockDownload always returns true, meaning that
the call to UpdatedBlockTip will also receive true as fInitialDownload.

UpdatedBlockTip is never called again unless a block is mined.
Mining of new blocks in regtest however only starts after mnsync has
finished, which will never happen as it waits for the next call to
UpdatedBlockTip.
2018-09-12 14:13:17 +03:00
Alexander Block
2a95dd30c5 Fix locking issues in DIP3 unit tests (#2285)
* Don't use GetTransaction in CheckProUpRegTx

GetTransaction locks mempool.cs internally. This brings messes up the locking
order of cs_main, mempool.cs and CCheckQueue::ControlMutex.

* Lock cs_main in TestChainSetup::CreateBlock when updating CbTx
2018-09-12 14:13:00 +03:00
PastaPastaPasta
1e74bcace9 [ZMQ] Notify when an IS double spend is attempted (#2262)
* Implement IS Double spend notifications in zmq

* copy/paste error

* typo

* Send both conflicting and conflicts against as ZMQ notifications

* CTransaction based not hash based

* @UdjinM6 requested changes
2018-09-12 14:12:44 +03:00
UdjinM6
28e0476f4c
Squash two logic branches in SubmitDenominate into one (#2270) 2018-09-11 21:33:06 +03:00
Alexander Block
6b3d650280 After DIP3 activation, allow voting with voting keys stored in your wallet (#2281)
* Implement temporary solution to allow voting with owner keys from your wallet

Will later be removed and properly reimplemented when cleaning up
legacy masternode code

* When MN keys from masternode.conf are used, only allow voting when they match with keyIDVoting
2018-09-11 17:33:07 +03:00
Alexander Block
47ca06ab33 DIP3 integration tests (#2280)
* Implement dip3 integration tests

This tests the full upgrade path from legacy MNs to deterministic MNs

* Invoke UpdatedBlockTip signal when invalidateblock RPC is called

Currently, UpdatedBlockTip would only be called if the invalidation resulted
in another chain becoming the longest one. This is inconsistent behavior
and was spotted when running dip3 integration tests.
2018-09-11 17:32:45 +03:00
UdjinM6
9b6eb4765f
Include inputs with max rounds in SelectCoinsDark/SelectCoinsByDenominations (#2277) 2018-09-11 17:32:18 +03:00
UdjinM6
55d7bb9009
Add an option to disable popups for PS mixing txes (#2272)
* Add an option to disable popups for PS mixing txes

* capital S
2018-09-11 17:31:46 +03:00
UdjinM6
38ccfef3be
Identify PS collateral payments in transaction list a bit more accurate (#2271)
This have to be updated due to new rules for PS collateral - we allow OP_RETURN outputs and "non-exact" inputs (1x<=X<2x) now.
2018-09-11 17:31:18 +03:00
UdjinM6
737353c84c
Fix IsBlockValueValid/IsOldBudgetBlockValueValid (#2276) 2018-09-10 17:12:32 +03:00
Alexander Block
c3d6b06518 Remove redundant check for unknown commands in masternode RPC (#2279) 2018-09-10 13:23:42 +03:00
thephez
ad6c2893c0 Docs - Update Core version number in readme files (#2267) 2018-09-10 13:23:22 +03:00
UdjinM6
1560b16775
Merge pull request #2264 from codablock/pr_dip3_unittests
DIP3 and DIP4 unit tests
2018-09-06 01:50:45 +03:00
Alexander Block
bc7924d418 Add unit tests for DIP3 and DIP4 2018-09-05 18:40:53 +02:00
Alexander Block
d653ace99e Update CbTx in TestChainSetup
We need to update the CbTx's merkle root for the masternode list here as
tests might add transactions into a block which cause the list to change.
2018-09-05 18:40:53 +02:00
Alexander Block
9674be8f96 Refactor TestChain100Setup to allow different test chain setups
Allows testing of features which depend on BIP9 deployments
2018-09-05 18:40:53 +02:00
UdjinM6
ad31dbbd73
Add more variance to coin selection in PS mixing (#2261)
* Lean towards "from high to low" branch but still mix via "from low to high" one someties

* Try to mix non-duplicate txids only

* Lean towards edges but still mix starting from the middle sometimes

If failed when started from the middle try mixing from the edges right away.

Note: liqudity providers always start from 0

* map -> set

* Refactor nRoundStart calculations
2018-09-05 19:35:33 +03:00
Alexander Block
cb37c39725 Bump PROTOCOL_VERSION to 70211, bump MIN_* protocols to 70210 (#2256)
Bump PROTOCOL_VERSION to 70211, bump MIN_* protocols to 70210
2018-09-05 19:34:56 +03:00
UdjinM6
f0166389bd
Merge pull request #2258 from codablock/pr_dip3_paymentlogic
DIP3 MN reward payment logic
2018-09-05 15:08:53 +03:00
Alexander Block
d8247dfffa Use refactored payment logic when spork15 is active
Related to https://github.com/dashpay/dash/pull/2237
2018-09-05 14:06:50 +02:00
Alexander Block
60002b7ddb Payout and enforce operator reward payments 2018-09-05 14:06:50 +02:00
Alexander Block
2c481f0f86 Implement deterministic version of CMasternodePayments::IsScheduled
Needed for privatesend when choosing masternodes
2018-09-05 14:06:50 +02:00
Alexander Block
44706dc88a Implement projection of MN reward winners in "masternode winners" 2018-09-05 14:06:50 +02:00
Alexander Block
e6b699bc26 Enforce MN and superblock payments in same block
1. Enforce payment to masternodes in IsBlockPayeeValid even if superblocks
   are triggered. This new rule only gets activated when spork15 activates.

2. Always enforce masternode payments when spork15 is activated and ignore
   spork8 in that case. spork8 can be removed after spork15 activation
   and hardening of the spork15 height into consensus params.
2018-09-05 14:06:31 +02:00
Alexander Block
19fbf8ab76 Move cs_main lock from CMasternode::UpdateLastPaid to CMasternodeMan
Ensure correct locking order to fix deadlock.
2018-09-05 14:06:31 +02:00
Alexander Block
dc7292afa9 Implement new MN payments logic and add compatibility code 2018-09-05 14:06:31 +02:00
PastaPastaPasta
b99886532e add link for developer-notes in contributing (#2260) 2018-09-05 15:05:27 +03:00
PastaPastaPasta
fded838c9d RPC folder: Cleaned up brackets on if, while, for, BOOST_FOREACH. Some whitespace fixes (#2257)
* Cleaned up brackets on if, while, for, BOOST_FOREACH. Some whitespace fixes

* gov, mn and mining cleanup

* Revert "Cleaned up brackets on if, while, for, BOOST_FOREACH. Some whitespace fixes"

This reverts commit 4a2a1b0645c5195025d0c7e6dad2e01a93efbfd6.

* Revert "gov, mn and mining cleanup"

This reverts commit 7cb91aabc67df0ab60db4ee84e3aaaf6cf6b7881.

* cleanup some dash specific

* "if(" -> "if ("     "for(" -> "for (" + corrected some else blocks
2018-09-05 15:04:24 +03:00
UdjinM6
8c9cb29092
Revert 2075 (#2259)
* Revert "Require all participants to submit equal number of inputs (#2075)"

This reverts commit 7ac4b972ab.

* Backward compatibility for nInputCount
2018-09-05 14:19:03 +03:00
UdjinM6
b164bcc7a5
Split PS into Manager and Session and allow running multiple mixing sessions in parallel (client side) (#2203)
* Split PS into Manager and Session

* Adjust log messages accordingly

* add -privatesendsessions cmd-line option

* address review comments

* bump MAX_OUTBOUND_MASTERNODE_CONNECTIONS to 30

+10 for parallel mixing

* protect vecSessions

* constructors

* Rewrite CMasternodeMan::ProcessMasternodeConnections() to use CPrivateSendClientManager::GetMixingMasternodesInfo().

This should solve potential deadlock cs_vecqueue vs cs_vNodes.

* Drop no longer used IsMixingMasternode()

* lock cs_wallet when mixing uses balance related functions
2018-09-04 13:54:59 +03:00
UdjinM6
794921b7b5
Merge pull request #2255 from codablock/pr_dip3_logic
DIP3 compatibility code
2018-09-03 22:05:34 +03:00
Alexander Block
d4530eb7d5 Put all masternodes in MASTERNODE_ENABLED state when spork15 is active 2018-09-03 13:31:40 +02:00
Alexander Block
31b4f83543 Forbid starting of legacy masternodes with non matching ProTx collateral values
If the masternode is already upgraded to ProTx, it's address and key
must match with the started masternode.
2018-09-03 13:31:40 +02:00
Alexander Block
2d8f1244cf Implement 'masternode info <proTxHash>' RPC 2018-09-03 13:31:40 +02:00
Alexander Block
e2a9dbbce1 Better "masternode status" for deterministic masternodes 2018-09-03 13:31:40 +02:00
Alexander Block
50ac6fb3aa Throw exception when trying to invoke start-xxx RPC in deterministic mode 2018-09-03 13:31:40 +02:00
Alexander Block
5050a92053 Add compatibility code for FindRandomNotInVec and GetMasternodeScores 2018-09-03 13:31:40 +02:00
Alexander Block
cc73422f88 Add methods to add/remove (non-)deterministic MNs 2018-09-03 13:31:40 +02:00
Alexander Block
7d14566bcd Add compatibility code to CMasternodeMan so that old code is still compatible
...when deterministic MNs are activated.
2018-09-03 13:31:40 +02:00
Alexander Block
27e8b48a60 Stop executing legacy MN list code when spork 15 is activated 2018-09-03 13:31:40 +02:00
Alexander Block
6764dafece Skip initial masternode list sync if spork 15 is active 2018-09-03 13:31:40 +02:00
Alexander Block
d90b139967 Implement CActiveDeterministicMasternodeManager 2018-09-03 13:31:40 +02:00
UdjinM6
a5e65aa373
Erase mnListCache entry on UndoBlock (#2254) 2018-09-03 13:18:20 +03:00
Alexander Block
88e7888de9 Try using cache in GetListForBlock before reading from disk (#2253)
* Try using cache in GetListForBlock before reading from disk

* Use std::list for vecDiff
2018-09-03 13:17:41 +03:00
UdjinM6
2900760dac
Merge pull request #2251 from codablock/pr_dip4
DIP4 implementation
2018-09-03 13:16:52 +03:00
Alexander Block
fced9a4b86 Ban peers that send us MNLISTDIFF messages
These are only meant to be sent to SPV clients
2018-09-03 10:46:52 +02:00
Alexander Block
c7f75afdd6 Fix nulldummy tests by creating correct DIP4 coinbase transactions 2018-09-03 10:46:52 +02:00