Commit Graph

270 Commits

Author SHA1 Message Date
Alexander Block
7ee31cbd65 Speed up integration tests with masternodes (#2642)
* Implement copy_datadir to allow easy copying of state from one node to another

* Instead of starting with a fresh datadir for MNs, reuse a copy of the faucet

* Start masternodes in parallel instead of waiting for the previous to finish

* Allow specifying of window and threshold with -bip9params

* Implement -dip3activationheight for regtests

* Implement fast DIP3 activation in DashTestFramework

* Speed up activation of DIP3 in dip3-deterministicmns.py

* Update qa/rpc-tests/test_framework/test_framework.py

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

* Always assign fast_dip3_activation
2019-01-23 19:36:51 +03:00
Alexander Block
e7981e468d Remove fLLMQAllowDummyCommitments from consensus params (#2636)
This should have been removed together with removal of the dummy DKG
2019-01-22 14:16:30 +03:00
Alexander Block
43fd1b352f Implement CSigningManager to process and propagage recovered signatures 2019-01-21 14:42:08 +01:00
Alexander Block
5958f8b81d Remove dkgRndSleepTime from consensus params and make sleeping it non-random 2019-01-10 07:07:58 +01:00
Alexander Block
6836f8c38b Implement LLMQ DKG 2019-01-09 12:16:12 +01:00
PastaPastaPasta
5c5932eb93 [PrivateSend] Allow more than 3 mixing participants (#2612) 2019-01-07 13:21:10 +03:00
Alexander Block
0c9fb69687 Harden spork15 on testnet (#2586)
* Replace IsDeterministicMNsSporkActive with IsDIP3Active

IsDIP3Active will now use a fixed parameter from consensus params.
Values for DIP0003Height/DIP0003Hash need to be updated when spork15
activates on mainnet.

Also enforce correct block hash on testnet/mainnet for DIP3 activation
block.

* Remove SPORK_15_DETERMINISTIC_MNS_ENABLED

* Replace all uses of IsDeterministicMNsSporkActive with IsDIP3Active

* Remove DIP3 upgrade-path tests and directly start with DIP3 enabled tests

* Make -masternodeprivkey non-mandatory

This code will vanish later.
2018-12-28 19:13:44 +03:00
Alexander Block
3861c6a82e Add BIP9 deployment for DIP3 on mainnet (#2585) 2018-12-28 16:03:17 +03:00
Alexander Block
79d543e896 Don't check for nSuperblockStartHash on testnet 2018-12-13 20:30:41 +01:00
Alexander Block
24ebcbd12c Remove checkpoints above block 4000 2018-12-13 15:07:40 +01:00
Alexander Block
ab3fe4fa86 Update nMinimumChainWork and defaultAssumeValid for block 4000 2018-12-13 15:07:38 +01:00
Alexander Block
b2d3e220b5 Change DIP0003 deployment to start today 2018-12-13 14:31:09 +01:00
Alexander Block
d6fa7026c9 Change CSV, DIP0001 and BIP147 deployments to start today 2018-12-13 14:31:05 +01:00
Alexander Block
431ef26280 Bump nPowKGWHeight for testnet and cause a fork at height 4001
This will reset testnet so that we can start with a clean state.
2018-12-13 13:57:08 +01:00
Alexander Block
9d33d216b7 Remove temporary code which forked testnet at block 274000 2018-12-13 13:55:46 +01:00
Alexander Block
a4f5ba38b6
Implement CDummyDKG and CDummyCommitment until we have the real DKG merged (#2492)
* Add SPORK_17_QUORUM_DKG_ENABLED spork

* Implement CDummyDKG and CDummyCommitment until we have the real DKG merged

This is only used on testnet/devnet/regtest and will NEVER be used on
mainnet. It is NOT SECURE AT ALL!

See comment in quorums_dummydkg.h for more details.

* Test simple PoSe in DIP3 tests

* Generate 2 instead of 4 blocks per iteration in PoSe tests

4 was based on old chainparams where I used larger phases.

* Only sleep when necessary in PoSe tests

* Fix typo in comment

* Give PoSe tests more time and sync after fast-forward
2018-11-26 16:53:20 +01:00
Alexander Block
80656038fa Bump nTemporaryTestnetForkHeight to 274000 (#2498) 2018-11-26 16:23:29 +03:00
Alexander Block
22b5952c5a
Implement and enforce DIP6 commitments (#2477)
* Add LLMQ parameters to consensus params

* Add DIP6 quorum commitment special TX

* Implement CQuorumBlockProcessor which validates and handles commitments

* Add quorum commitments to new blocks

* Propagate QFCOMMITMENT messages to all nodes

* Allow special transactions in blocks which have no inputs/outputs

But only for TRANSACTION_QUORUM_COMMITMENT for now.

* Add quorum commitments to self-crafted blocks in DIP3 tests

* Add simple fork logic for current testnet

This should avoid a fork on the current testnet. It only applies to the
current chain which activated DIP3 at height 264000 and block
00000048e6e71d4bd90e7c456dcb94683ae832fcad13e1760d8283f7e89f332f.

When we revert the chain to retest the DIP3 deployment, this fork logic
can be removed again.

* Use quorumVvecHash instead of quorumHash to make null commitments unique

Implementation of https://github.com/dashpay/dips/pull/31

* Re-add quorum commitments after pruning mempool selected blocks

* Refactor CQuorumBlockProcessor::ProcessBlock to have less nested if/else statements

Also add BEGIN/END markers for temporary code.

* Add comments/documentation to LLMQParams

* Move code which determines if a commitment is required into IsCommitmentRequired

This should make the code easier to read and also removes some duplication.

The also changes the error types that are possible from 3 to 2 now. Instead
of having "bad-qc-already-mined" and "bad-qc-not-mining-phase", there is
only "bad-qc-not-allowed" now.

* Use new parameter from consensus parames for the temporary fork
2018-11-23 15:42:09 +01:00
Alexander Block
d40a5ce31f
Properly initialize confirmedHash in CSimplifiedMNListEntry (#2479)
* Properly initialize confirmedHash in CSimplifiedMNListEntry

* Add consensus params for temporary hard-fork on testnet

This hard-fork is required on testnet as we have to fix a few consensus
bugs in DIP3/DIP4. It will also be required to introduce LLMQ commitments
to testnet.

* Add temporary fork-logic for testnet, which sets confirmedHash to null

...before fork activation. Otherwise we'd invalidate all DIP3 blocks on
testnet.

* Bump nTemporaryTestnetForkHeight to 273000
2018-11-23 10:40:46 +01:00
Alexander Block
76a38f6ceb
Update defaultAssumeValid, nMinimumChainWork and checkpoints (#2428)
* Update defaultAssumeValid and nMinimumChainWork for mainnet

* Update defaultAssumeValid and nMinimumChainWork for testnet

* Add checkpoint for mainnet

* Add checkpoint for testnet
2018-11-10 10:54:01 +01:00
Alexander Block
28a6007a40 Prepare DIP3 for testnet and reuse DIP3 deployment for autoix deployment (#2389)
* Add BIP9 parameters for DIP3 deployment on testnet

* Remove autoix BIP9 deployment and reuse DIP3 deployment

* Add BIP9CheckMasternodesUpgraded to chain params

This controls if miners should check for upgraded masternodes first before
adding BIP9 bits to the block version. This only makes sense in network
where masternodes are up and running before BIP9 activation, which is not
necessarely the case in regtest and devnet.

Also refactor ComputeBlockVersion to use fCheckMasternodesUpgraded instead
of the inverse fAssumeMasternodeIsUpgraded. It is set to false by default
and only set to true in CreateNewBlock.

* Check for upgraded masternodes for DIP3 activation (only mainnet and testnet)

* Bump PROTOCOL_VERSION and DMN_PROTO_VERSION

We probably have nodes with 70211 already running on testnet.
2018-10-26 19:42:52 +03:00
Alexander Block
e3046adb3e
Clear devNetParams and mimic behavior of other param types (#2367)
* Clear devNetParams and mimic behavior of other param types

Mainnet, testnet and regtest params are global and thus zero initialized,
we should mimic the same for devnet params.

Not doing so results in all kinds of issues on devnet.

* Remove unnecessary <string.h> includein chainparamsbase.cpp
2018-10-25 09:17:37 +02:00
Alexander Block
1c25356ff8
Allow to use low difficulty and higher block rewards for devnet (#2369)
* Allow to use low difficulty and higher block rewards for devnet

Configurable through -minimumdifficultyblocks, -highsubsidyblocks and -highsubsidyfactor

* Fix review comments

* Handle review comments
2018-10-25 09:16:38 +02:00
gladcow
f7ab6c469c M-of-N-like sporks (#2288)
* support set of keys to sign spork

* several addresses support in -sporkkey

* tests for multykey sporks

* command line option -minsporkkeys

* make spork active only after given number of signers

* use signature in spork hash calculation

* test for new and old spork messages interaction

* add multikeyspork.py to integration tests

* change test to have ability to distinguish default spork value

* require min spork keys number to be more than the half of the common spork keys number

* calc current spork value with majority of signers

* set test nodes time in integration test

* extract keyid from signed spork message directly

* change -sporkaddr option syntax to process several addresses

* codestyle fixes

* fix test comments

* codestyle fixes

* simplify CSporkManager::SporkValueIsActive

* Calc signature hash without signature field

* do not restore pubkey ids from cach

* Calc different keyids to check signature because not all sporks can be synced at moment

* codestyle fixes

* Fix CSporkManager::CheckAndRemove to use several keys

* codestyle fixes

* Correct processing of not actual spork6 value with GetSignerKeyID
2018-09-30 20:01:33 +03:00
UdjinM6
a4ff2a19a7
Fix some warnings and do a couple of other trivial cleanups (#2315)
* Fix various warnings

* A couple of trivial cleanups

* fix 2320
2018-09-28 10:55:11 +03:00
gladcow
5454bea377 Automatic InstantSend locks for "simple" transactions (#2140)
* add locktransaction rpc call

* Remove special instantsend fee for simple transactions

* Function to check if trx is simple enough to be autolocked

* Automatic lock for all received from peers simple trxes

If we get a new transaction with CInv message and it is "simple" and
is accepted in mempool, we initiate its lock. We don't lock orphan trxes
that accepted in mempool after this trx because they are locked by other
peers.

* Automatically lock simple trxes in wallet

* protocol bump for InstantSend without special fee

* Add function to detect used mempool share

* Mempool threshold for auto IX locks

* Add SPORK_16_INSTANTSEND_AUTOLOCKS spork

* Make autolocks active only when spork SPORK_16_INSTANTSEND_AUTOLOCKS is active

* BIP9 autolocks activation

* revert increasing min peer protocol version for mn rank

* move IsTrxSimple check to CTxLockRequest class

* make MAX_INPUTS_FOR_AUTO_IX private member of CTxLockRequest class

* make AUTO_IX_MEMPOOL_THRESHOLD private member of CInstantSend class

* remove locktransaction RPC call

* tests for automatic IS locks

* fix mempool threshod calculation

* bump mocktime in activate_autoix_bip9

* set node times

* no need to spam the node with gettransaction rpc requests that often

* use `spork active` instead of leaking spork logic into tests

* codestyle fixes

* add test description in comments

* fix typo

* sync test nodes more often during BIP9 activation

* Use 4th bit in BIP9 activation

* Fix comments according codestyle guide

* Call AcceptLockRequest and Vote at the first node creating autoix lock

* fix mempool used memory calculation

* rallback not necessary change in CWallet::CreateTransaction

* test for stopping autolocks for full mempool

* Inject "simple autolockable" txes into txlockrequest logic
2018-09-26 17:17:47 +03:00
Alexander Block
d20100ecd4 DIP0003 deployment 2018-08-29 11:36:14 +02:00
Alexander Block
2d4e18537c Some useful commits from the DIP3 PR in regard to integration tests (#2218)
* Allow changing budget parameters for regtest

* Lift some limitations for local addresses for masternodes in regtest

Needed to make masternodes works in regtest mode

* Add "masternode check" RPC to force invocation of CheckAndRemove

Useful in integration tests where MN lists must be predictable
2018-08-11 01:36:17 +03:00
Nathan Marley
dac090964f remove dashpay.io dns seed entry (#2181) 2018-07-13 13:00:55 +03:00
gladcow
6da2837bdd InstantSend Integration tests (#2141)
* adjust `AddLocal` method only in regtest mode

* Create Masternodes in regtest

* sentinelping call for masternodes

* set externalip option for masternodes in regtest

* fix MNB relay during masternodes creation

* fix node_count naming

* instantsend doublespend

* decrease node restarts

* prevent spending masternode collaterals

* move long test to the test list start

* remove InstantSend spork sending

* remove spork-specific code

* fix checking double spend rejection
2018-07-12 12:04:42 +03:00
Alexander Block
2c303cdb11 A few devnet related fixes (#2168)
* Remove testnet seeds from devnet

* Lift multiple ports restriction on devnet when considering new nodes

Allow to connect to multiple nodes behind the same IP

* Don't skip addresses with non-default port if it matches -port

If the user specified -port, he very likely intends to connect to nodes
with the same port.

* Don't pass false to CAddrMan constructor as it is already the default

* Make if statements easier to read
2018-07-08 00:19:33 +03:00
UdjinM6
97b9b4fedc
Bump nMinimumChainWork, defaultAssumeValid and checkpoints (#2130) 2018-06-19 02:40:10 +03:00
UdjinM6
ff93dd6131
Check devnet genesis block (#2057)
* Fix off-by-one in BIPXX activation heights for devnet

* Fail on invalid devnet genesis block
2018-05-13 23:56:51 +03:00
Alexander Block
1dbf5a0f63 Fix transaction/block versions for devnet genesis blocks (#2056)
* Fix transaction/block versions for devnet genesis blocks

56ff71fcec mistakenly increased the coinbase transaction version instead
of the block version. This fixes it.

* Use v1 for coinbase transaction
2018-05-13 23:56:21 +03:00
Alexander Block
7719b7ec25 Update BIP147 deployment times, nMinimumChainWork and defaultAssumeValid (#2030)
* Update BIP147 deployment times

* Update nMinimumChainWork and defaultAssumeValid of mainnet
2018-04-20 13:54:49 +03:00
UdjinM6
a648d6efff
Drop delayed headers logic and fix duplicate initial headers sync by handling block inv correctly (#2032)
* Drop custom logic for delaying GETHEADERS

Reverts "Fix duplicate headers download in initial sync (#1589)" and all following fixes

This reverts commit 169afafd50.

* Fix duplicate initial headers sync
2018-04-20 13:53:05 +03:00
Nathan Marley
99085c5b68 swap devnet magic bytes around (#2028)
Prevents testnet and devnet messages from being confused and helps
differentiate which network messages should refer to.
2018-04-20 13:52:31 +03:00
UdjinM6
8b09e779b6
Bump testnet checkpoint and nMinimumChainWork/defaultAssumeValid params (#2026)
* bump testnet minchainwork/assumevalid

* add testnet checkpoint at block 100000

blockhash: 0000000003aa53e24b6e60ef97642e4193611f2bcb75ea1fa8105f0b5ffd5242
2018-04-11 14:07:37 +03:00
UdjinM6
9e98c856f2
A pack of small fixes (#1992)
* Make sure gobject collateral was mined

`CGovernanceObject::IsCollateralValid()` would still fail for non-mined collateral later trying to check confirmations

* Fix powLimit for mainnet/testnet

That's a legacy thing, slightly rising it to match the actual bit-shifted value has no effect because real values are already lower.
Also clarify values for all networks in comments.

* Check for script addresses in CSuperblock::ParsePaymentSchedule()

Sentinel should already be downvoting such triggers if they would exist, no need to store/relay them.

* Do not process already known valid vote twice in CGovernanceObject::ProcessVote()

This should be handled by `CGovernanceManager::ProcessVote()` but imo it's better to have this at the `CGovernanceObject::ProcessVote()` level as well.

* Make sure CGovernanceObjectVoteFile::AddVote() never adds/updates already known votes

The way `CGovernanceObjectVoteFile::AddVote()` is used (i.e. wrapped in `CGovernanceObjectVoteFile::HasVote()` condition) it's already the case. Hoever nothing would guarantee consistency if it would be used elsewhere without such wrapper, so it's better to have similar check inside.

* Do not even try mnb recovery when -connect is set

`CConnman::ThreadOpenMasternodeConnections()` thread won't even start when `-connect` is set, so no need to ask for recovery, there is nothing that is going to be able to process such request.

* No need for SIGHASH_ANYONECANPAY in PS collateral signature

Collateral is just a normal tx created and signed by each participant individually, there is no need for special sig types.

* Release semMasternodeOutbound in CConnman::Interrupt()

Re-align Dash code with Bitcoin.
2018-03-19 16:08:32 +03:00
UdjinM6
7d5223b5e4
Network-specific thresholds for required confirmations (IS) (#1962) 2018-03-10 15:35:09 +03:00
UdjinM6
4ffa7bac02
Introduce DIP0001Height (#1973)
Block height at which DIP0001 becomes active

Also drop fDIP0001WasLockedIn
2018-03-08 15:18:24 +03:00
UdjinM6
9ef38c6d73
Switch CNetFulfilledRequestManager and CMasternodeMan maps/funcs to CService (#1967)
* Switch CNetFulfilledRequestManager and CMasternodeMan maps/funcs to CService

This is to make them work correctly on regtest.
We make sure that behaviour on other networks is not affected though.

* Add fAllowMultiplePorts to chainparams

Tweak either we should allow nodes with the same address and multiple ports or not for this specific chain
2018-03-08 15:16:52 +03:00
Alexander Block
611879aa6d Use spork addresses instead of raw keys and allow changing them on startup (#1969)
* Support passing CKeyID to CMessageSigner/CHashSigner

* Use Dash addresses instead of raw public keys for sporks

The spork addresses are identical to the previously used public keys.

Also use CKeyID/CKey directly inside CSporkManager instead of parsing the
addresses/keys over and over. The default spork key (from chainparams) is
initialized with InitDefaultSporkAddress(). SetPrivKey parses the private
key now and stores it in sporkPrivKey instead of parsing it in
CSporkMessage::Sign().

* Allow setting of spork address via command line

* Remove unused strMasternodePaymentsPubKey chainparam

Traces from the past...

* Review fixes

1. Remove the need for InitDefaultSporkAddress
2. Remove bogus checks for hex private keys
3. Alphabetical order for new include
4. Add . to help string

* Add regtest spork key

As this key is not meant to be private, the private key is also added in
the form of a comment (for later use in regtests)

* Review fixes
2018-03-02 16:15:04 +03:00
Alexander Block
9876207ce2 Multiple devnet fixes (#1960)
* Add missing help string for -devnet

* Remove testnet seeds from devnet

* Activate BIP34/65/66 at height 2 instead of 1

Height 1 is the genesis block and not the devnet genesis block. The genesis
block is still at version 1, resulting in re-indexing to fail.
2018-03-02 16:12:31 +03:00
Alexander Block
e37b6c7dab Fix BIP147 deployment threshold parameter (#1955)
It should be 50 and not 59
2018-02-27 16:39:34 +03:00
UdjinM6
5b1c4d8a11
Few (mostly trivial) cleanups and fixes (#1940)
* Drop nBudgetProposalEstablishingTime

* Refactor: replace `== COutPoint()` with `.IsNull()`

* Refactor: add `operator bool()` to CMasternodePing

* Refactor: actually use `operator bool()` for CPendingDsaRequest

* Refactor: fixing code style in TrafficGraphData

* Fix some comments and whitespaces

* Drop CGovernanceVote::GetTypeHash()

* Drop legacy X11 code

No longer used... if it ever was used at all.

* Move `<boost/foreach.hpp>` out of coins.h

* Simplify CMasternodeBlockPayees::GetRequiredPaymentsString()

Also less of boost::lexical_cast

* Drop CTxDSIn::nSentTimes

* Fix few warnings

* fix warning (timer)

* fix nit
2018-02-21 19:32:08 +03:00
UdjinM6
ed712eb819
Fix nDelayGetHeadersTime (int64_t max == never delay) (#1916)
* Fix nDelayGetHeadersTime (int64_t max == never delay)

* Rewrite conditions in a more natural way i.e. (now - last_best > threshold)
2018-02-12 21:34:53 +03:00
Suhas Daftuar
2c810d2c3f Allow changing BIP9 parameters on regtest 2018-02-08 10:40:51 +01:00
Alexander Block
99b2789a73 Fix DeserializeAndCheckBlockTest benchmark and store hashDevnetGenesisBlock in consensus (#1888)
* Use Dash block for DeserializeAndCheckBlockTest

Replaced Bitcoin block with the largest Dash block I could find on mainnet.

* Store hashDevnetGenesisBlock in Consensus::Params

Remove the need for chainparams to be available when the devnetGenesis hash
is needed. Fixes a crash in CheckBlockHeader() when called from benchmarking
code, which does not initialize the Params() function.
2018-02-01 20:05:35 +03:00
UdjinM6
8a387ee09c
Drop SPORK_13_OLD_SUPERBLOCK_FLAG and check superblock start hash (#1872) 2018-02-01 15:42:21 +03:00