Commit Graph

15438 Commits

Author SHA1 Message Date
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
UdjinM6
07309f0ec3 Allow up to MASTERNODE_MAX_MIXING_TXES (5) DSTXes per MN in a row (#2552) 2018-12-13 09:13:02 +01:00
UdjinM6
3e97b0cbdb Make sure that we can get inputType and fUseInstantSend regardless of the way recipients are sorted (#2550)
* Make sure that we can get inputType and fUseInstantSend regardless of the way recipients are sorted

* Move "for" loops outside of "if"s
2018-12-13 09:12:45 +01:00
UdjinM6
1a7c29b97c Revert "Sort recipients in SendCoins dialog via BIP69 rule (#2546)" (#2549)
This reverts commit 18cd5965cc.
2018-12-13 09:12:22 +01:00
UdjinM6
ca0aec2a32 Match recipients with txouts by scriptPubKey in reassignAmounts() (#2548)
* Match recipients with txouts by scriptPubKey in reassignAmounts()

* Drop no longer used nChangePosRet from reassignAmounts() params
2018-12-13 09:12:07 +01:00
UdjinM6
378dadd0f7 Ensure EvoDB consistency for quorum commitments by storing the best block hash (#2537)
* Ensure EvoDB consistency by storing the best block hash

This approach is similar to the one used for chainstate currently.
Ensures that:
- nodes that upgraded after DIP3 has all the data processed correctly (they will crash and require reindex);
- evodb/ is removed when blocks/ is removed (otherwise sync will fail due to duplicate records).

* Implement CEvoDB::VerifyBestBlock/WriteBestBlock and call them from ConnectBlock/DisconnectBlock

* Fix walletbackup.py
2018-12-13 09:11:50 +01:00
UdjinM6
2127a426b8 Further refactoring of CQuorumBlockProcessor (#2545)
* Switch GetQuorumBlockHash from CBlockIndex* to nHeight

* `pindexPrev -> pindex` for ProcessCommitment

* Switch IsCommitmentRequired from CBlockIndex* to block height

* Switch GetMinableCommitment/Tx from CBlockIndex* to block height

* Add `AssertLockHeld(cs_main);`

Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com>
2018-12-13 09:04:08 +01:00
Alexander Block
09730e1c59
Bail out from update methods in MasternodeList when shutdown is requested (#2551) 2018-12-13 07:55:42 +01:00
Alexander Block
1522656d6f
Correctly handle spent collaterals for MNs that were registered in the same block (#2553)
* Move spent collateral handling to the bottom of BuildNewListFromBlock

* Handle conflicts with spent collaterals in mempool
2018-12-13 07:49:50 +01:00
UdjinM6
18cd5965cc Sort recipients in SendCoins dialog via BIP69 rule (#2546) 2018-12-10 14:57:22 +01:00
Alexander Block
5830353373
Track operator key changes in mempool and handle conflicts (#2540)
* Track ProTx operator key changes in mempool

* Remove ProTx conflicts from mempool when ProUpRegTx or ProUpRevTx changed keys

* Only allow one operator key change per MN in in mempool
2018-12-10 09:14:19 +01:00
Alexander Block
88f7bf0d82
Don't delete/add values to the unique property map when it's null (#2538)
* Don't delete/add values to the unique property map when it's null

This happens when revoking operator keys, as the revoked MN will then have
the address and operator keys set to the null representation. We shouldn't
add the null value to the unique property map as otherwise future revokes
crash in an assert.

* Assert that no null values are passed to Add/DeleteUniqueProperty

* Check for null values before calling Add/DeleteUniqueProperty

* Apply suggestions from code review

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

* Add user generated default constructors to BLS primitives

Fixes build issues on Mac:

In file included from evo/deterministicmns.cpp:5:
./evo/deterministicmns.h:375:24: error: default initialization of an object of const type 'const CBLSPublicKey' without a user-provided default constructor
        static const T nullValue;
                       ^
2018-12-10 08:31:09 +01:00
UdjinM6
15414dac29 Refactor CQuorumBlockProcessor and CDeterministicMNManager (#2536)
* Refactor CDeterministicMNManager::ProcessBlock: pintexPrev -> pindex->pprev and/or adjust logic accordingly

* Refactor CQuorumBlockProcessor::ProcessBlock: pintexPrev -> pindex->pprev and/or adjust logic accordingly

* Drop unused
2018-12-10 06:05:29 +01:00
Alexander Block
63b58b1e92
Reintroduce BLSInit to correctly set secure alloctor callbacks (#2543)
https://github.com/dashpay/dash/pull/2409 removed the need to call the
Init method of the Chia BLS library, but we also accidently removed the
initialization of the secure allocator.
2018-12-10 06:04:48 +01:00
Alexander Block
d9b28fe1ad
Introduce dummy (ping-like) contributions for the dummy DKG (#2542)
* Implement creation and propagation of dummy contributions

These act as a ping which is broadcast a few blocks before the dummy
commitments are created. They are meant to determine online/offline members.

* Use information about received dummy contributions to determine validMembers

* Fix PoSe tests

* Fix dummy DKG phase progress in PoSe tests and give tests more time

Mine one block at a time until we reach the mining phase.
2018-12-10 06:04:33 +01:00
Alexander Block
df0d0cce77
Watch for changes in operator key and disable local MN (#2541) 2018-12-10 06:04:13 +01:00
Alexander Block
511dc3714c
Remove ProTxs from mempool that refer to a ProRegTx for which the collateral was spent (#2539)
* Track TXs in mempool which refer to an existing ProTx

* When a block is added, remove TXs that refer to ProTxs with spent collaterals

* Initalize evoDb and deterministicMNManager in BasicTestingSetup

instead of TestingSetup. Now that the mempool uses deterministicMNManager,
we need to initialize it for all tests that might use the mempool.
2018-12-10 06:03:57 +01:00
Solar Designer
cbd0303529 Serialize the block header in CBlockHeader::GetHash() (#2531)
* Serialize the block header in CBlockHeader::GetHash()

* Switch from CDataStream to CVectorWriter

Co-Authored-By: solardiz <solar@openwall.com>
2018-12-10 05:40:08 +01:00
Alexander Block
5185dd5b73
Use correct time field when removing pre-DIP3 votes (#2535)
nTime is not the timestamp from the vote object. nCreationTime is the
correct field to use.

This fixes continues deletion of votes.
2018-12-06 14:44:14 +01:00
Alexander Block
225c2135e2
Allow skipping of MN payments with zero duffs (#2534)
* Allow skipping of MN payments with zero duffs

In case a MNO uses an operator reward of 100%, the normal reward will be 0
duffs. It doesn't make sense to enforce these payments.

This will cause a fork when miners start to mine with the new version, but
only for nodes that didn't upgrade.

* Apply suggestions from code review

Co-Authored-By: codablock <ablock84@gmail.com>
2018-12-06 14:43:54 +01:00
Alexander Block
d94092b60b
Fix spork propagation while in IBD and fix spork integration tests (#2533)
* Fix spork syncing issue in sporks tests

https://github.com/dashpay/dash/pull/2522 caused an issue with sporks syncing
in tests. The introduced time check in CMasternodeSync::ProcessTick causes
masternode sync to never start when mocktime is enabled, so this commit
disables mocktime for sporks.py.

Disabling mocktime however leads to fInitialDownload never becoming false
in CMasternodeSync::UpdatedBlockTip, so mnsync is never started. To fix
this, the tests now create a block before connecting the last node.

This however doesn't work because node1 will ignore the "getheaders" request
from node2 as it has not finished mnsync yet...so we also have to force
finish mnsync for node1.

* Also respond with getdata for announced sporks while in IBD

There was never a good reason to ignore spork announcements while in IBD.
At the same time, this poses the risk of missing out on sporks while in IBD.
This also fixes an issue in sporks testing, as nodes did not request for
announced sporks.

* Use wait_to_sync instead of custom loop
2018-12-06 14:43:36 +01:00
UdjinM6
9100c69eb9 Allow filtering by proTxHash on DIP3 MN tab (#2532) 2018-12-06 11:32:42 +01:00
Alexander Block
2161199210
Fix wrong total MN count in UI and "masternode count" RPC (#2527)
* Use CountMasternodes() in ClientModel::getMasternodeCountString

* Use CountMasternodes() for total count in masternode_count

* Fix CountMasternodes() to give correct number of masternodes with spork15 enabled

Also change CountEnabled to not call CountMasternodes anymore but instead
have its own implementation which uses GetValidMNsCount instead of GetAllMNsCount

* Apply review suggestions
2018-12-06 11:32:15 +01:00
Alexander Block
8f8878a94f
Add dummy/hidden column to carry the proTxHash per MN list entry... (#2530)
...and use this in GetSelectedDIP3MN. This fixes copy/paste issues with MNs
that don't have a valid address (PoSe banned).
2018-12-06 08:09:23 +01:00
Alexander Block
7c75008642
Also stop asking other peers for a TX when ProcessTxLockRequest fails (#2529)
This is moving up the RemoveAskFor call above the ProcessTxLockRequest
call. If ProcessTxLockRequest fails, we should not re-request the same
TX/IX from other nodes as it will continue to fail.
2018-12-06 08:08:54 +01:00
Alexander Block
19a6f718d3
Don't respond with getdata for legacy inv types when spork15 is active (#2528)
Avoid unnecessary traffic from non-upgraded nodes.
2018-12-06 08:07:33 +01:00
Alexander Block
d2ca9eddee
Fix multiple issues with governance voting after spork15 activation (#2526)
* Check resulting signature for validity when signing with BLS operator keys

* Support specifying proTxHash when using "gobject vote-alias"

The "alias-name" is now interpreted as proTxHash when deterministic MN lists
are active.

The classical "alias" as found in masternode.conf has no meaning after
spork15 activation.

* Don't use masternode.conf list in gobject_vote_many when spork15 is active

Keys don't match anymore so we should only rely on the deterministic list
and the local wallet's keys.

* Check for pwalletMain not being null in gobject_vote_many

* Allow to use vote-conf for non-proposal votes when spork15 is active

This fixes sentinel not being able to create triggers on testnet.

* Fix error message

* Fix no-wallet compilation and check for pwalletMain at runtime
2018-12-06 08:07:10 +01:00
Alexander Block
60867978d6
Avoid printing DIP3/DIP4 related logs twice (#2525)
All logging that happens in BuildNewListFromBlock is currently printed twice.
This is because BuildNewListFromBlock is called while processing the block
and also while calculating the DIP4 MN list commitment.

This commit adds the debugLogs to this method to allow omitting logs while
called from the DIP4 code.
2018-12-06 08:06:37 +01:00
UdjinM6
08dc178711 Drop pre-DIP3 votes from current votes per MN per object (#2524) 2018-12-06 08:06:21 +01:00
Alexander Block
7037f7c999
Bail out from GetBlockTxOuts in case nBlockHeight is above tip+1 (#2523)
In the future, we should make sure that this method is only called for the
currently mined block or for old blocks, but never for non-existing blocks
further in the future.
2018-12-06 08:05:57 +01:00
UdjinM6
3a6bd8d235 Call ProcessTick every second, handle tick cooldown inside (#2522) 2018-12-06 08:05:36 +01:00
UdjinM6
973a7f6dd6 Fix GUI warnings in debug.log (#2521)
Specifically:

```
GUI: QMetaObject::connectSlotsByName: No matching signal for on_extraInfoDIP3_doubleClicked()
GUI: QMetaObject::connectSlotsByName: No matching signal for on_copyProTxHash_clicked()
GUI: QMetaObject::connectSlotsByName: No matching signal for on_copyCollateralOutpoint_clicked()
```
2018-12-06 08:05:05 +01:00
PastaPastaPasta
818f0f4647 Allow consuming specific UTXO in gobject prepare command (#2482)
* Implement optional CoinControl for gobject prepare

* Removes duplicate `);` from merge error

Co-Authored-By: PastaPastaPasta <pasta@dashboost.org>

* Fix equality check allowing more relevant help output

* Pass COutPoint as const reference

Co-Authored-By: PastaPastaPasta <pasta@dashboost.org>

* Remove unnecessary SetNull call

Co-Authored-By: PastaPastaPasta <pasta@dashboost.org>

* Specify proposal fee

Co-Authored-By: PastaPastaPasta <pasta@dashboost.org>
2018-12-03 21:00:09 +03:00
Salisbury
1270b71229 Use a verbosity instead of two verbose parameters (#2506) 2018-12-03 16:49:21 +01:00
Alexander Block
22dcec71a8
Punish nodes which keep requesting and then rejecting blocks (#2518)
* Move deserialization of REJECT message fields out of if(fDebug)

* Ban nodes which keep requesting and then rejecting blocks

* Don't read/deserialize reject hash twice

* Only use ban score of 1
2018-12-03 16:48:48 +01:00
Alexander Block
0224914200
Print the state object when ProcessSpecialTxsInBlock fails in ConnectBlock (#2516)
Currently, when any DIP2/3/6 validation fails, there is no error message
printed that shows what exactly went wrong.
2018-12-03 16:48:29 +01:00
Alexander Block
0c1b683a06 Clear votes which were created before spork15 activation and use operator key for non-funding votes (#2512)
* Clear votes which were created before spork15 activation

* Reject incoming votes which were created pre-DIP3

* Only use voting keys for VOTE_SIGNAL_FUNDING

The other vote signals are meant to be emitted by sentinel and must thus
be signed with the operator key.

* Simplify GetMinVoteTime

* Review suggestions/fixes

* Add missing mutex in CGovernanceObject::RemoveOldVotes
2018-11-29 21:51:53 +03:00
Alexander Block
f6f6d075dc Still support "protx list" and "protx diff" when wallet is disabled at compile time (#2511)
* Don't fully remove protx commands when ENABLE_WALLET is not set

* Check for wallet support at run-time for protx commands

* Only show subcommands that require the wallet when ENABLE_WALLET is set

* Add and use CheckWalletOwnsKey which is able to check wallet support at runtime

* Properly handle disabled wallets in "protx list"

This now also handles the case where ENABLE_WALLET is not defined.

* Drop comment that doesn't fully apply anymore
2018-11-29 21:51:31 +03:00
Alexander Block
5a3f64310b Deserialize CFinalCommitmentTxPayload instead of CFinalCommitment in TxToJSON (#2510)
* Deserialize CFinalCommitmentTxPayload instead of CFinalCommitment in TxToJSON

* Implement ToJson for CFinalCommitmentTxPayload and use it in TxToJSON

Otherwise the nVersion and nHeight members of it are not shown.
2018-11-29 21:51:04 +03:00
Alexander Block
5da4c97284 Use "registered" as default for "protx list" (#2513)
"wallet" was confusing too many users as it shows an empty list if the local
wallet does not own any keys for any MN.
2018-11-29 15:31:37 +03:00
Alexander Block
f96563462b
Fix check for nTemporaryTestnetForkDIP3Height (#2508)
This caused a crash when performing a full-sync.
2018-11-29 09:12:51 +01:00
Alexander Block
fc6d651c43
Fix crashes in "protx" RPCs when wallet is disabled (#2509) 2018-11-29 09:12:41 +01:00
Alexander Block
35550a3f93
Add quorumModifierHash to instant send lock vote (#2505)
* Let GetMasternodeRank also return the block hash at the given height

* Add outpointConfirmedBlock to CTxLockVote and verify it

* Match order of parameters with member order

* Rename outpointConfirmedBlock to quorumModifierHash

* Add overload of GetMasternodeRank that does not return the block hash
2018-11-28 11:43:28 +01:00
Alexander Block
812834dc5f
Put height into mined commitments and use it instead of the special handling of quorumVvecHash (#2501)
* Allow to skip sig verification for CFinalCommitment::Verify

* Add CFinalCommitmentTxPayload and CheckLLMQCommitment and use it

As described in https://github.com/dashpay/dips/pull/31 (see discussion).

* Properly ban nodes for invalid commitments
2018-11-27 08:04:08 +01:00
UdjinM6
ed53fce470 Revert "Apply similar logic to vecMasternodesUsed" (#2503)
This reverts commit ebb1200052.
2018-11-27 08:03:41 +01:00
thephez
ba49a4a160 Trivial: protx fund_register RPC help corrections (#2502) 2018-11-27 05:12:11 +01:00