Commit Graph

15311 Commits

Author SHA1 Message Date
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
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
a18ca49a22
Disconnect peers with version < 70212 after DIP3 activation via BIP9 (#2497)
* Disconnect peers with version < 70212 after DIP3 activation via BIP9

* Send REJECT and log when diconnecting peers after DIP3 activation
2018-11-26 16:23:17 +01:00
Alexander Block
c248c48e4d
Try to fix a few sporadic instant send failures in DIP3 tests (#2500)
* Sleep in wait_for_instant_lock when TX is not known yet

We'll otherwise stress the CPU quite a lot, which might in turn result in
instant send timeouts.

* Wait for all nodes to have the instant send lock

Otherwise individual nodes might end up not being able to catch up,
especially when it's the last iteration and we generate 6 blocks after it.

* Use getrawtransaction in wait_for_instant_lock instead of gettransaction

gettransaction fails if the TX is not owned by the wallet

* Give instant send tests more time after DIP3 activation

Signature verification changes to BLS when DIP3 gets activated, which is
much more resource hungry. Give instant send tests more time after DIP3
activation until we do proper batched verification of instant send
signatures.
2018-11-26 16:22:54 +01:00
Alexander Block
7a709b81d8 Perform less instant send tests in DIP3 tests (#2499)
These take quite some time on Travis.
2018-11-26 16:23:46 +03:00
Alexander Block
80656038fa Bump nTemporaryTestnetForkHeight to 274000 (#2498) 2018-11-26 16:23:29 +03:00
UdjinM6
69bffed72f
Do not sort resulting vector in SelectCoinsGroupedByAddresses (#2493)
Apply specific sort in each case separately instead (when needed).
2018-11-26 16:22:39 +03:00
Alexander Block
245c3220e9
Sync blocks before creating TXs (#2496) 2018-11-26 13:40:36 +01:00
InhumanPerfection
bb11f1a638 Fix recent changes in DSA conditions (#2494)
* pr2487 bugfix

* push reject msg
2018-11-25 23:52:56 +03:00
UdjinM6
6480ad1d5f
Should check dsq queue regardless of the mixing state (#2491) 2018-11-25 16:35:52 +03:00
Alexander Block
66612cc4b5 Add 0 entry to vTxSigOps when adding quorum commitments (#2489)
This fixes a crash observed on Travis. The same crash is likely to happen
outside of Travis as well later.
2018-11-25 16:27:56 +03:00
UdjinM6
67483cd340
Fix dsq/dsa conditions (#2487)
* Apply new dsq rules in StartNewQueue and DSACCEPT

* Apply similar logic to vecMasternodesUsed

* Add extra check for DSACCEPT
2018-11-25 16:27:43 +03:00
UdjinM6
9d4df466b9
Fix CreateDenominated failure for addresses with huge amount of inputs (#2486)
* Allow specifing max number of outpoints to be returned per address in SelectCoinsGroupedByAddresses

Fixes CreateDenominated failure for addresses with huge amount of inputs

* Apply suggested fixes
2018-11-25 16:27:31 +03:00
Alexander Block
0123517b48 Implement PoSe based on information from LLMQ commitments (#2478)
Members which are not in the validMembers bitsets are now PoSe punished.
The maximum PoSe score is dynamic and mostly identical to the number of
registered MNs. Added PoSe scores for failures are then a percentage of
the maximum score, so that we can better control how often failures are
allowed per payment cycle. For LLMQ failures, this is 66% to allow
approximately 2 failures per payment cycle.
2018-11-25 16:27:18 +03:00
-k
a4ea816b20 use aqua gui theme (#2472) 2018-11-25 16:27:04 +03:00
PastaPastaPasta
45421b1a3a Add IS parameter for gobject prepare (#2452)
* Add IS parameter for gobject prepare

* Update if statement

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

* Update src/rpc/governance.cpp

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

* Update src/rpc/governance.cpp

Co-Authored-By: PastaPastaPasta <pasta@dashboost.org>
2018-11-25 16:26:50 +03:00
UdjinM6
65528e9e7b Bump masternodeman cache version (#2467) 2018-11-23 18:15:38 +01:00
Alexander Block
f5beeafa14
Also restart MNs which didn't have the collateral moved, but do it later (#2483) 2018-11-23 16:45:56 +01:00
Alexander Block
fa8f4a10cc
Include masternodeProTxHash in CTxLockVote (#2484)
* Introduce proTxHash to CActiveMasternodeInfo

* Include masternodeProTxHash in CTxLockVote
2018-11-23 16:33:45 +01:00
UdjinM6
aa495405b3 [GUI] Realign tx filter widgets (#2485)
Also hide watch-only filter when no watch-only addresses are used (corresponding column already has this kind of behaviour).
2018-11-23 16:23:15 +01:00
PastaPastaPasta
da4b5fb16e Remove an unused function from governance object collateral code (#2480) 2018-11-23 15:43:23 +01: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
UdjinM6
6c190d1bb3 Fix make deploy error on macos (#2475) 2018-11-23 15:41:39 +01:00