Followup for the recent winner_block PR (#1028) and name confusion discovered during code review.
"Mostly" because also:
- CMasternodeBlockPayees::GetPayee -> CMasternodeBlockPayees::GetBestPayee which describes what this function is actually doing a bit better imo;
- fixing constructor CMasternodePaymentVote empty constructor
* store vote hashes in CMasternodePayee and use them in CMasternodePayments::Sync
* Request low data payment blocks in batches directly from some node instead of/after preliminary Sync.
* remove nVotes
* Fixes to rpcgovernance.cpp
- Replaced use of non-unique public key with vin in vote-conf, vote-alias and vote-many
- Replaced use of non-threadsafe CmasternodeMan::Find function with Get
- Added LOCK(cs_main) to getgovernanceinfo
* Fixed rpcgovernance.cpp voting error messages
* Implemented several governance changes
- Limit strData size to avoid propagation of very large messages
- Remove unused CGovernanceObject::SetData method
- Remove CGovernanceObject::strName field to avoid data redundancy
* Fixed parameter count bug in gobject prepare
* deprecate start-many
* remove outdated "enforce" rpc and enforceMasternodePaymentsTime
* "count" should lock cs_main and call GetNextMasternodeInQueueForPayment only when needed
* "masternodelist" fixes:
- rename "pubkey" -> payee", fix description
- fix "filter" description
- change "full" format: add lastpaidblock, move IP to the end of string to make it more table-ish
- fix "status" description
- fix "addr" filter, wasn't working
- trivial refactoring
* fix "start-alias" and "create-alias" error message - should be a bit more descriptive now
* rpcmasternode trivial cleanup
- add "spork" debug category
- move "seen" and "unknown" to new "spork" debug category to reduce log spam
- new/updated/seen messages should not overlap
* refactor CMasternodePaymentWinner::CheckSignature
* refactor CMasternodePaymentWinner::Sign - can only be signed by active masternode
* hold cs_mapMasternodeBlocks till the end of CMasternodePayments::AddWinningMasternode
* refactor CMasternodePaymentWinner::ToString
* use GetStorageLimit() in CMasternodePayments::CheckAndRemove
* refactor CMasternodePaymentWinner
* refactor CMasternodePayments::ProcessBlock
* trivial cleanup, adjusted few log messages
* fix error message returned by CMasternodePaymentWinner::IsValid to include actual bounds that were violated
* Remove unnecessary call to IsCollateralValid and hence allow superblocks
to propagate
* Added CMasternodeMan::Get overload for masternode vin
* Use vin as masternode identifier instead of public key
* Fixed missing member in copy constructor, improved logging
* Added logging for MasternodeRateCheck failures
* Removed pubkeyMasternode field from CGovernanceObject
* Impose MN trigger creation rate limit only when MN info is synced
* Improve rpcgovernance error handling
- Prevent attempts to prepare trigger objects (and waste the collateral)
- Improve clarity of gobject submit error messages
* trivial governance cleanup:
- spaces
- names
- no "using namespace std;"
- few log and rpc messages adjusted
- remove unused
- use defined types
- move few members to private
* fixing after code review
* consistent JSON return value for failed vote
* make JSON output for voting results consistent
* result should be either 'success' or 'failed'
* error message belongs in 'errorMessage' field
* Wallet passphrase lock fixes:
- wallet should not allow cli commands to bypass lock validation
- wallet should lock again in mixing mode if it was unlocked for mixing and next unlock (e.g. for sending funds) happened
- removed AnonymizeOnlyUnlocked status, it's never going to be reached anymore
- "For anonymization only" checkbox:
- should be available only when user click "Start Mixing"
- should be set on by default when available
- adjusted title
- adjust error messages in walletpassphrase for unlocked wallets
* Add comment about IsLocked() usage
* Final safety check for locked wallet in WalletModel::prepareTransaction
* Added more specific error message about attempts to submit superblocks by
non-masternodes
* Fixed governance object validation bug
* Fixed logic bug in governance object submission
* Decouple min mnw versions from version.h, drop MIN_MNW_PEER_PROTO_VERSION in fav of GetMinMasternodePaymentsProto()
* Split min protocol validation for new and old winners in IsValid