Commit Graph

13030 Commits

Author SHA1 Message Date
UdjinM6
8d80a71ffe change logic in IsBlockValueValid and IsBlockPayeeValid to allow superblocks only when spork9 is on 2016-09-20 19:24:18 +03:00
UdjinM6
1e2d61ad0d Implement a way to sync only needed winners (#1028)
* 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
2016-09-19 02:23:52 +04:00
UdjinM6
d93836c0ed fix "masternode status" (#1031) 2016-09-19 01:13:23 +04:00
Tim Flynn
ce28ad4206 Fixes to rpcgovernance.cpp (#1030)
* 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
2016-09-19 01:11:03 +04:00
Tim Flynn
fcb985a93f Governance changes (#1029)
* 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
2016-09-17 23:37:48 +04:00
UdjinM6
a29a5345a1 remove deprecated keysLoaded, fSucessfullyLoaded, strBudgetMode (#1027) 2016-09-16 21:16:22 +04:00
UdjinM6
49fb3df3e3 simplify CGovernanceObject::GetAbsolute*Count (#1026) 2016-09-16 19:30:33 +04:00
UdjinM6
19ae48a02e Various masternode rpc changes/fixes (#1024)
* 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
2016-09-16 19:22:57 +04:00
Tim Flynn
4e6bb6a375 Fixed incorrect rpcgovernance error/usage message (#1023) 2016-09-16 11:43:15 +04:00
UdjinM6
6e9d1779b9 (mostly trivial) Refactor CMasternode/Ping/Broadcast (#1022)
* Refactor CMasternode/Ping/Broadcast
Most noticable:
- pubkey -> pubKeyCollateralAddress
- pubkey2 -> pubKeyMasternode
- VerifySignature -> CheckSignature
- removed PoSe related stuff (deprecated)

Other variable name changes are trivial. Also adjusted debug log output.

* fix constructors
2016-09-16 02:00:06 +04:00
UdjinM6
9bf1e00f09 rename NetMsgType::IX -> NetMsgType::TXLOCKREQUEST, NetMsgType::IXLOCKVOTE -> NetMsgType::TXLOCKVOTE (#1021) 2016-09-16 00:07:01 +04:00
UdjinM6
4ccc32615d Linearize and simplify few CMasternode* functions (#1020)
* linearize CMasternodePing::CheckAndUpdate

* simplify CMasternodeMan::CheckAndRemove

* linearize CMasternodeMan::ProcessMessage, DSEG part

* fail fast in CMasternode::Check on spent vin, slightly improve readability
2016-09-15 17:30:51 +04:00
UdjinM6
a3ffedba7c masternode score related fixes (#1019)
* refactor CalculateScore (remove mod, remove extra cs_main lock)

* remove GetCurrentMasternode, use GetNextMasternodeInQueueForPayment instead

* fix masternode rpc "current" (calculate node to pay next block), add rpc "winner" (calculate node to vote for)

* remove "calcscore" rpc
2016-09-15 10:50:41 +04:00
UdjinM6
8b13d45b5c more determinism for CompareScore* (#1017) 2016-09-15 10:50:28 +04:00
UdjinM6
7f687fd696 spork debug log: (#1016)
- add "spork" debug category
- move "seen" and "unknown" to new "spork" debug category to reduce log spam
- new/updated/seen messages should not overlap
2016-09-15 10:50:16 +04:00
UdjinM6
d843596304 Masternode payments refactoring/cleanup (#1015)
* 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
2016-09-15 10:50:01 +04:00
Tim Flynn
906c62e01c Fixes for a number of issues with governance object validation and propagation (#1018)
* 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
2016-09-15 10:49:24 +04:00
Evan Duffield
f0140dab01 Merge pull request #966 from UdjinM6/mergebtc12
Merge 'bitcoin/0.12', fix/dashify
2016-09-13 08:57:55 -07:00
Evan Duffield
c81f0a3202 Merge pull request #1013 from UdjinM6/refMasBlockPayees
Refactor CMasternodeBlockPayees
2016-09-13 08:46:00 -07:00
Evan Duffield
cefc13fc79 Merge pull request #1012 from UdjinM6/masPayLastVote
Use outpoint instead of hash to track last mn vote for winner
2016-09-13 08:42:27 -07:00
Evan Duffield
6f84dc15c0 Merge pull request #1009 from UdjinM6/lastPaid
Improve mn winners detection
2016-09-13 08:35:59 -07:00
Evan Duffield
7d1dd5f63c Merge pull request #1008 from UdjinM6/makeTestnetMixingHarder
Make testnet mixing as hard as on mainnet
2016-09-13 08:16:41 -07:00
Evan Duffield
658109255d Merge pull request #1006 from UdjinM6/removeDeprecatedSyncMembers
Remove deprecated masternode sync members
2016-09-13 08:15:48 -07:00
UdjinM6
640c594dc4 make sort deterministic in cases when 2 mns are counted as paid in the same block for some reason (e.g. previous fork) 2016-09-13 13:58:33 +03:00
UdjinM6
3d9d91ea96 replace magic number with const (MASTERNODES_LAST_PAID_SCAN_BLOCKS) 2016-09-13 02:21:59 +03:00
UdjinM6
0534632d2b add cs_main lock to GetCollateralAge 2016-09-12 21:06:59 +03:00
UdjinM6
d239a13ee3 Refactor CMasternodeBlockPayees 2016-09-12 20:57:53 +03:00
UdjinM6
56aae1632d refactor CMasternodeBlockPayees::IsTransactionValid 2016-09-12 20:53:06 +03:00
UdjinM6
8641ae189b Assign base58Prefixes[EXT_COIN_TYPE] properly (#1007) 2016-09-12 21:40:46 +04:00
Evan Duffield
c269018016 Merge pull request #1005 from tgflynn/v0.12.1.x-sb-cycle-pr
Set mainnet superblock cycle to monthly
2016-09-12 10:39:22 -07:00
UdjinM6
ea99764baa Remove wallet unlock from masternode cli commands, require walletpassphrase (which locks wallet back after specified timeout) (#1004) 2016-09-12 21:38:52 +04:00
UdjinM6
c80a24c99c Use outpoint instead of hash to track last mn vote for winner 2016-09-12 17:59:56 +03:00
Tim Flynn
e61b783e0e Remove -DDEBUG_LOCKORDER from debug configuration (#1010)
* Remove -DDEBUG_LOCKORDER from debug configuration

* Updated documentation to reflect removal of -DDEBUG_LOCKORDER from debug configuration
2016-09-12 11:40:23 +04:00
UdjinM6
f5738c001f (trivial) governance cleanup (#1011)
* 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
2016-09-12 11:40:00 +04:00
Nathan Marley
1043252d43 consistent JSON return value for failed vote (#1001)
* 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
2016-09-12 05:17:41 +04:00
UdjinM6
57eb2e1842 Update and store collateral block height and block height at which MN was last paid (scan blockchain to find out who actually was paid). Use storage limit instead of mn count to fetch enough data. Calculate new winner using info about block height at which MNs were paid instead of time. 2016-09-12 02:03:59 +03:00
UdjinM6
9ae4d51bc7 Make testnet mixing harder.
Require 3 participants (same as on mainnet)
2016-09-11 21:34:26 +03:00
Tim Flynn
a31e0cadec Set mainnet superblock cycle to monthly 2016-09-11 14:01:26 -04:00
UdjinM6
08f8300985 Remove deprecated masternode sync members 2016-09-11 21:00:45 +03:00
Nathan Marley
b31ee8441a restore vote-many (#1003) 2016-09-11 21:58:17 +04:00
UdjinM6
84ac8de59d Wallet passphrase lock fixes (#987)
* 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
2016-09-11 13:02:54 +04:00
Tim Flynn
d81e729b0a Governance bug fix (#998)
* 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
2016-09-09 19:52:10 +04:00
Tim Flynn
740d1e0b1e Push out mainnet superblock start, in case people run 12.1 on mainnet (#999) 2016-09-09 19:51:46 +04:00
UdjinM6
b7e81cb2bd Decouple mn payments from version.h, drop MIN_MNW_PEER_PROTO_VERSION (#960)
* 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
2016-09-08 16:04:45 +04:00
Tim Flynn
f76f6fbb8e Governance Fixes/Refactoring Pack (#995)
* Improved exception handling
 - Removed attempts to catch exceptions in intermediate helper function calls
 - Made helper functions for JSON parsing private

* Governance voting fixes
 - Converted voting defines to enums for better type safety
 - Enabled gobject voteraw rpc command
 - Removed unused parameter from gobject getvotes rpc command

* Fixed help message for gobject get

* Improved encapsulation of CGovernanceVote objects
 - CGovernanceVote data members are now private
 - Necessary to ensure that enum values are used for signals and outcomes since data members remain int's for compatibility with serialiation code

* Removed unused cs_budget mutex (has been replaced with governance.cs)

* Fix code review issues
 - Restored early return in ConvertVoteSignal
 - Removed special case for "none" string to make clear that NONE is
   for invalid strings
 - Removed commented defines (informational comments preserved)

* Fixed code review issues
 - Fixed error messages for vote-conf, vote-alias and voteraw
 - Removed voteraw from gobject command list and help messages because
   it is actually a top-level command
 - Fixed parameter indices for voteraw
2016-09-08 15:40:19 +04:00
Holger Schinzel
9738a238fa Merge #997: update testnet checkpoint
696d8f4 update testnet checkpoint
2016-09-08 13:33:29 +02:00
crowning-
a6a0f75614 Merge #982: [RPC] new command 'getsuperblockheight'
1080018 [RPC] new command 'getsuperblockheight' to return the last/next superblock height
2436067 [RPC] new command 'getsuperblockheight' [update 1]
753e00d [RPC] new command 'getsuperblockheight' [update 2]
1ec9289 [RPC] new command 'getsuperblockheight' [update 2]
dbac6e6 [RPC] new command 'getsuperblockheight' [update 3]
e1b7b15 [RPC] new command 'getsuperblockheight' [obsolete include removed]
ee85293 Code review results changes
2016-09-08 13:33:25 +02:00
Tim Flynn
5e564e17d3 Bug fixes for the governance rpc interface (#993)
* Bug fixes for the governance rpc interface
 - Allow use of the gobject getvotes command
 - Fix order of arguments to CGovernanceVote constructor

* Added getvotes to gobject help message and fixed parameter name in the
error/usage message.
2016-09-07 16:02:24 +04:00
UdjinM6
36c4b6dc2e Trivial refactoring/cleanup (#990) 2016-09-05 20:09:25 +04:00
Tim Flynn
8c09a459b1 V0.12.1.x governance fees pr (#988)
* Implemented different fees for different types of governance objects

* Added fee amounts to object returned by getgovernanceinfo

* Implement new requireents for Superblock creation
 - Superblocks creation requires a valid masternode signature
 - Superblock creation no longer requires a collateral fee
 - Superblock creation rate is limited to roughly 1 per masternode per cycle

* Fixed getgovernanceinfo help message

* Removed old governance fee constant

* Fixed bug in IsSignatureValid and added debugging code

* Fixed parent hash variable index and added debugging code

* Modified GetBudgetSystemCollateralTX to take fee amount parameter

* Changes due to code review comments
 - Naming changes
 - Removed confusing comment
2016-09-05 03:44:10 +04:00