Commit Graph

10 Commits

Author SHA1 Message Date
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
PastaPastaPasta
ee6a5a33b7 Gov cleanup + copyright bump (#2324)
* governance.* formatting and copyright bump

* manual changes gov.cpp

* clang and copyright bump

* gov-exc.h clang and copyright bump

* gov-obj.* clang and copyright bump

* gov-val.* clang and copyright bump

* gov-vote.* clang and copyright bump

* gov-votedb.* clang and copyright bump

* fix some weirdness

* Modernize ConvertVoteOutcome, ConvertSignalToString and  ConvertOutcomeToString

* add braces

* move breaks

* add braces instead of inlining

* Revert "Modernize ConvertVoteOutcome, ConvertSignalToString and  ConvertOutcomeToString"

This reverts commit 41bc3d3d86.

* drop unused function
2018-09-28 10:56:17 +03:00
UdjinM6
a3bcc4307d
Refactor governance (#1993)
* Refactor CGovernanceObject::IsValidLocally()

* Refactor CGovernanceObject::ProcessVote()

* Refactor CGovernanceObject::CountMatchingVotes()

* Refactor CGovernanceObjectVoteFile::HasVote()

* Refactor CGovernance* (more consts and refs)

* Refactor CGovernanceManager::HaveVoteForHash()

* Refactor CGovernanceManager::SerializeVoteForHash()

* Refactor CGovernanceManager::SyncSingleObjAndItsVotes()
2018-03-20 14:04:59 +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
e71cb3861d
Store CGovernanceVote hash in memory instead of recalculating it via GetHash() every time (#1946)
* Store CGovernanceVote hash in memory instead of recalculating it via GetHash() every time

* Rename GetVoteDataStream to SerializeVoteToStream
2018-02-21 19:35:37 +03:00
UdjinM6
05da4557d0 Refactor masternode management (#1611)
* Store masternodes in a map instead of a vector, drop unused functions in CMasternodeMan

* CTxIn vin -> COutPoint outpoint

* do not use CMasternodeMan::Find outside of the class

* update GetMasternodeInfo

* safe version of GetNextMasternodeInQueueForPayment

* fix ProcessMasternodeConnections

* bump CMasternodeMan::SERIALIZATION_VERSION_STRING
2017-09-11 17:13:48 +03:00
Tim Flynn
d7fbaf907f V0.12.1.x multiple vote fix (#1425)
* Avoid adding the same vote multiple times to the vote file

* Cleanup multiple votes in vote file
2017-04-03 23:06:33 +03:00
Tim Flynn
348c001445 Fix governance-votedb index bug (#1278) 2017-01-21 09:26:35 +04:00
Holger Schinzel
e1702cd4ec bump copyright notice to 2017 (#1207) 2016-12-20 17:26:45 +04:00
Tim Flynn
c31ba8ba4c New vote tallying implementation (#1135) 2016-11-13 21:52:34 +04:00