Commit Graph

9309 Commits

Author SHA1 Message Date
UdjinM6
eca1e8a4f1 few small fixes: (#1125)
- fail to process dsa when session is already ready
- fail to process dsvin if session is not ready yet
- fail to process any message on the wrong side (mn/client)
- fail in PrepareDenominate if pool already has entries
- fail if can't sign anything in final tx, also reset local pool in such case
- fix "number of entries" pushed on DSSTATUSUPDATE
2016-11-07 03:27:10 +04:00
UdjinM6
440fc21fbf fix dsq rate limit bug: should not use vecMasternodesUsed when connecting from queue, should check nLastDsq only (#1123) 2016-11-07 03:26:51 +04:00
Tim Flynn
bc96f288ed Governance fixes (#1131)
* Added net logging messages in main.cpp

* Added logging for trigger removal

* Improved log message for CGovernanceManager::UpdatedBlockTip

* Improved log messages in CGovernanceManager::UpdateCachesAndClean

* Added more logging to CGovernanceTriggerManager

* Check vote validity before pushing inventory during sync

* Add triggers to map after loading governance.dat file
2016-11-05 20:13:30 +04:00
crowning-
eb92933d52 [UI] In-wallet PrivateSend help (#1129) 2016-11-05 20:13:16 +04:00
UdjinM6
a4dfcae8f9 fix crash (#1126)
Fixes dash-qt --version (--help etc) crash (Segmentation fault: 11)
2016-11-02 22:43:20 +04:00
UdjinM6
9ed18fdcbe refactor Charge*Fees to have less steps, also switch it to mempool instead of wallet (#1122) 2016-11-02 22:05:30 +04:00
UdjinM6
ee60f6e76a refactoring PS, cleanup, more log output in debug mode (#1121)
* refactoring PS, cleanup, more log output in debug mode (part of #1120)

* fix dsq rate limit calculations on new dsq
2016-11-02 19:54:36 +04:00
Nathan Marley
4894345a58 patch from @udjinm6 -- extract hash calc from loop (#1119)
calculate hash once before entering loop, should make it around an order of magnitude faster
2016-10-31 22:20:49 +04:00
TheLazieR Yip
fb3b2f1853 Fix errors in DBG when compile with ENABLE_DASH_DEBUG defined. (#1111) 2016-10-31 13:11:57 +04:00
UdjinM6
afc74707f8 PoSe changes: (#1105)
* PoSe changes:
- use helpers to alter nPoSeBanScore within predefined range only
- use nPoSeBanHeight instead of timeout of inactivity to ban masternodes till some block in the future (currently should block for the whole payment cycle)
- add log output on pose score increase in CheckSameAddr
2016-10-31 00:56:47 +04:00
UdjinM6
d9d6d4f6eb fix deadlock on sync (#1104) 2016-10-30 23:40:30 +04:00
crowning-
81502761b6 [UI] Fix for empty Masternode list when mncache.dat exists (#1107)
* [UI] Fix for empty Masternode list when mncache.dat exists [review changes]

* [UI] Fix for empty Masternode list when mncache.dat exists [review changes]
2016-10-30 23:37:51 +04:00
TheLazieR Yip
740fcce6a4 Fix Governance Object's Expiration calculation. (#1109)
Use nSuperblockCycle instead of "blocks monthly" approximation
2016-10-30 23:36:52 +04:00
Tim Flynn
1a81c341bc Set initial masternode last watchdog time to mnb.sigTime (#1098)
Set last watchdog time to mnb.sigTime when masternodes are first added or updated from a broadcast
2016-10-27 20:00:06 +04:00
Tim Flynn
db3a4afddb Replaced LOCK with LOCK2 to prevent a deadlock (#1103) 2016-10-27 19:58:12 +04:00
UdjinM6
19569c1d66 Fix CActiveMasternode (#1102)
* add GetStateString and static CMasternode::StateToString helpers

* Fix CActiveMasternode:
- should run `ManageStateLocal` only when `eType == MASTERNODE_LOCAL`
- should set `nState = ACTIVE_MASTERNODE_NOT_CAPABLE` in `ManageStateInitial` to let `GetStatus` return proper message
- more/better log output
2016-10-27 01:21:39 +04:00
UdjinM6
77852d938e refactor and fix PS collateral creation (#1092) 2016-10-26 03:33:52 +04:00
Tim Flynn
e30f8bf6a0 Allow masternode broadcasts to update masternode information regardless of state (#1094)
* Allow MN broadcasts to update MN information regardless of state

* Add masternode public keys to log output for debugging

* Moved log message from start-alias to CMasternodeBroadcast::Create

* Fixed log message
2016-10-25 18:37:33 +04:00
Tim Flynn
0cc4997501 Lock coins in masternode.conf regardless of masternode state (#1096)
* Lock coins in masternode.conf regardless of masternode state of local node

* Prevent log masternode.conf messages when file is empty
2016-10-25 17:46:38 +04:00
UdjinM6
c0a830aa8e fix fCheckSigTimeOnly (renamed to fSimpleCheck) in CMasternodePing::CheckAndUpdate (#1093) 2016-10-25 17:46:21 +04:00
UdjinM6
01990272e5 fix dstx acceptance (#1091)
* fix dstx acceptance

* two more fixes:
- do not re-verify dstx once accepted
- fix dstx prioritization

* return early for dstx conditions, more log verbosity
2016-10-24 22:12:36 +04:00
Tim Flynn
4d95be602a Fix deadlock in masternode start commands (#1090) 2016-10-24 03:14:54 +04:00
UdjinM6
565fa31850 fix PS: (#1089)
* PS: should check for prevout to match inputs

* fix CDarkSendEntry constructor
2016-10-23 19:27:23 +04:00
UdjinM6
ed0a0d2393 fix1087 (#1088) 2016-10-23 01:01:30 +04:00
Tim Flynn
1b230f4ddc Deadlock fixes (#1087)
* Fix deadlocks by reducing scope of cs_main locks in rpcgovernance.cpp

* Remove unnecessary mutex lock in GetMasternodeVinAndKeys which can cause a deadlock
2016-10-22 20:52:36 +04:00
UdjinM6
2d55b70381 (log) tweaks and (general) cleanup (#1086)
* docs

* deprecated/unused/duplicate

* comments

* log cleanup/verbosity tuning

* names/ifs/whitespaces/std
2016-10-22 20:52:14 +04:00
UdjinM6
66c40e0687 always check for valid block hash in mnping (#1076) 2016-10-21 01:12:42 +04:00
UdjinM6
609aa7de2a Fix and refactor PS (#1084) 2016-10-21 01:11:57 +04:00
UdjinM6
342bda5fdc new PoSe - MNVERIFY (#1066) 2016-10-21 01:11:30 +04:00
Tim Flynn
cce7896d70 Allow last ping time to be updated for masternodes in the EXPIRED state (#1083) 2016-10-18 15:11:36 +04:00
CHAE-PIL LIM
9db6b97979 [ZMQ] append a message sequence number to every ZMQ notification (#1082)
* Zmq sequence (#1)

* Fixes ZMQ startup with bad arguments.

pr 7621

* [ZMQ] append a message sequence number to every ZMQ notification

- pr 7762
- contrib/zmq/zmq_sub.py to python 3 compatible

* typo in MSG_RAWTXLOCK

MMSG_RAWTXLOCK to MSG_RAWTXLOCK

* s/Bitcoind/dashd/
2016-10-18 00:09:21 +04:00
Nathan Marley
7a45c9308a bugfix: remove duplicate MN votes from getvotes (#1077) 2016-10-17 22:56:27 +04:00
Tim Flynn
94e38e3184 V0.12.1.x sentinel watchdog pr (#1079)
Squashed:

* Replaced unsafe mnodeman.Find function with Get in governance-vote.cpp

* Reject unparsable governance objects

* Implemented sentinel watchdog objects (separated out from locking changes)

* Added WATCHDOG support to rpcgovernance.cpp

* Implemented WATCHDOG_EXPIRED state for masternodes

* Added serialization of watchdog timestamps

* Masternode fixes
 - Added version check to CMasternodeMan deserialization
 - Added several missing locking calls in CMasternodeMan

* Fixed missing member initialization in CMasternode constructor and added more logging

* Added MASTERNODE_WATCHDOG_MAX_SECONDS to governanceinfo

* Added masternodewatchdogmaxseconds info to getgovernanceinfo help

* Make masternodes remain in WATCHDOG_EXPIRED state unless removed or collateral expires

* Allow watchdog object creation by WATCHDOG_EXPIRED MN

* Fixed MN validation logic for governance object creation

* Count total masternodes instead of enabled masternodes in masternode-sync

* Transition out of WATCHDOG_EXPIRED state if the watchdog is inactive

* Fixed IsWatchdogExpired bug

* Fixed rate check for watchdog objects and no longer check MN state when validating governance objects

* Applied PR #1061 patch

* Ported locking changes from other branch

* Require only 1 block between new watchdog objects

* Accept pings for WATCHDOG_EXPIRED masternodes

* Lock CmasternodeMan::cs in CmasternodeMan::ProcessMessage

* Several governance changes
 - Fixed uninitialized value in CGovernancePayment class
 - Return an error on submission if any superblock payment cannot be parsed
 - Added logging more statements

* Explicitly initialize all governance object members

* Fix deadlock

* Fixed non-threadsafe access to masternode in activemasternode.cpp

* Revert added wallet lock

* Changed CActiveMasternode so that watchdog expired nodes can still send pings

* Modified CActiveMasternode to run pinger regardless of state when MN is in list

* Added voter and time information to getvotes command

* Improved CActiveMasternode state management

* Implemented GetInfo functions for more efficient thread-safe access to masternode information

* Added CActiveMasternode debug logging messages

* Fixed initial type setting and error message for incorrect protocol version

* Changes based on code review comments

* Set active state for local mode
2016-10-17 22:54:28 +04:00
UdjinM6
a584a68634 Revert few parts of #1073 - too early for node version check (and it's not necessary to do so there anyway) (#1080) 2016-10-16 23:23:42 +04:00
UdjinM6
bdcc9ab47c Refactor PS code to deal with denoms in a more generic way (#1071) 2016-10-16 23:23:17 +04:00
TheLazieR Yip
27c445a891 Add more Private Send minimum protocol version checking (#1073) 2016-10-13 13:45:30 +04:00
UdjinM6
d5dcf2b668 Refactor CalculateScore, move GetBlockHash out of it (#1068) 2016-10-13 13:45:18 +04:00
Nathan Marley
d9d11f6765 bugfix: count MN votes only once 2016-10-12 10:02:15 -05:00
UdjinM6
2feb321c2e IsBlockchainSynced should not proceed until we are past the latest checkpoint (#1070) 2016-10-11 01:11:20 +04:00
TheLazieR Yip
9071933bf4 Fix Sync condition checking in PrivateSend (#1069) 2016-10-11 01:07:49 +04:00
UdjinM6
321fd64921 Masternodes should be allowed to annonce ipv4 addresses only from now (#1065) 2016-10-10 13:13:07 +04:00
crowning-
c86439a366 [UI] Change 'Send' warning (#1064) 2016-10-09 15:47:22 +04:00
crowning-
e32e28afb9 [PrivateSend] Performance tweak: faster shuffling of Masternodes vector (#1063) 2016-10-09 15:46:46 +04:00
CHAE-PIL LIM
6795de7f1a [cosmetic] set width 9 to 15 (#1062)
tested with PRE_ENABLED, should be ok with OUTPOINT_SPENT too
2016-10-07 20:16:27 +04:00
dkaidalov
d537610047 Governance: Fix governance object syncing in AddOrUpdateVote. (#1061)
There is a bug AddOrUpdateVote function in CGovernanceManager. If a new vote has been arrived it is checked if a corresponding parent object are present in the mapObjects. If it is not we need to sync the parent object and return false. But the syncing is never performed because the corresponding code is placed after return statement. So we need to sync and then return.
2016-10-07 20:15:39 +04:00
crowning-
81c3ccbdf8 [PrivateSend] vecMasternodesUsed: remove several nodes at once (#1060) 2016-10-07 20:15:03 +04:00
UdjinM6
1eb399cf34 bump proto 70202 (#1054) 2016-09-30 22:19:26 +04:00
UdjinM6
ae48630dfb Revert "[UI] Message change when Masternodes is started" (#1053) 2016-09-30 20:19:18 +04:00
Evan Duffield
0e9a57d6ad Merge pull request #1041 from crowning-/patch-1
[UI] Message change when Masternodes is started
2016-09-30 09:18:05 -07:00
Tim Flynn
0d324eafa8 rpcgovernance improvements (#1052)
* rpcgovernance improvements
 - Modified govject get to return full object data along with vote counts
 - Cleaned up vote count reporting code

* Added cached flags to gobject get output
2016-09-30 05:48:18 +04:00
Nathan Marley
1f98bdff06 fix spork setPrivKey (#1051) 2016-09-30 02:19:00 +04:00
Evan Duffield
bdf1a6d24d Merge pull request #1045 from UdjinM6/fixSync1
Various sync fixes
2016-09-29 14:21:47 -07:00
UdjinM6
a650165318 GetMinCollateralFee should not validate object type (#1050)
* GetMinCollateralFee should not validate object type, it should be IsValidLocally's job

* Explicitly set 0 fee for known free objects, set fee to MAX_MONEY for unknown one
2016-09-30 00:29:29 +04:00
UdjinM6
4316b4e277 CMasternodeConfig::read shouldn't spam into debug.log, instead AppInit2 should print current masternode.conf location. Processing masternode.conf to lock inputs should also be performed only when current node is not a masternode. (#1046) 2016-09-30 00:28:33 +04:00
UdjinM6
cc3b3a145e only bump nTimeLast* when valid new/updated message arrived, do not bump on invalid or 'seen' 2016-09-29 23:23:02 +03:00
UdjinM6
64ba0dc6d0 Always push tried masternode to vecMasternodesUsed regardless of result (#1047) 2016-09-29 03:47:31 +04:00
UdjinM6
231532d6d0 Align governance proto logic with logic for similar proto for other modules (#1049)
i.e MSG_GOVERNANCE_PEER_PROTO_VERSION -> MIN_GOVERNANCE_PEER_PROTO_VERSION (to check other peers) + PROTOCOL_VERSION (to announce own version)
2016-09-29 00:03:54 +04:00
UdjinM6
2b3478387c Deprecate masternodeaddr (#1048)
* Deprecate masternodeaddr (i.e. remove dash.conf-started remote masternode support)
2016-09-29 00:02:54 +04:00
UdjinM6
ac9ed3545b Save/load fulfilled requests info (#1044) 2016-09-27 23:37:54 +04:00
UdjinM6
cfeda84a3c Do not switch from MASTERNODE_SYNC_SPORKS to next asset until blockchain is synced 2016-09-27 12:02:57 +03:00
UdjinM6
174ee8f880 apply IBD-like logic in IsBlockchainSynced 2016-09-27 11:56:10 +03:00
UdjinM6
04d82025d8 backport 8aa722609d7e736b3a3763e15b552795b94f0e9b (IBD fix) 2016-09-27 11:54:43 +03:00
UdjinM6
b8557662d3 Rewrite fulfilled requests handling (#1040) 2016-09-27 11:50:04 +04:00
CHAE-PIL LIM
2f93a0d208 V0.12.1.x - reduce IS/PS fees 10x (#1039) 2016-09-27 11:49:45 +04:00
crowning-
93cd3693c2 [UI] Add Instantsend parameter to URI/QR-code (#1042) 2016-09-27 11:48:52 +04:00
crowning-
c368d3ba05 [UI] Changed message when Masternodes was started 2016-09-26 00:40:55 +02:00
Evan Duffield
b9bd11610d Merge pull request #1037 from UdjinM6/fixSpork9Payment
change logic in IsBlockValueValid and IsBlockPayeeValid to allow valid superblocks only when spork9 is on
2016-09-21 08:36:12 -07:00
UdjinM6
d6637c2e8e simplify CMasternodePayments::IsEnoughData (always using GetStorageLimit) (#1025)
* simplify CMasternodePayments::IsEnoughData (always using GetStorageLimit)
2016-09-21 19:32:42 +04:00
UdjinM6
ec239ffa36 Mostly winner -> payment vote (#1033)
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
2016-09-21 18:45:29 +04:00
UdjinM6
2245d25497 fix: CDarksendPool::IsSignatureValid has misleading name and suboptimal params (#1035) 2016-09-21 18:03:04 +04:00
UdjinM6
4c5e4cded5 reduce log spam 2016-09-20 23:26:28 +03:00
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
c1b292be39 use references instead of creating copies when trying to sort masternodes by rank/score (#1032) 2016-09-20 02:27:36 +04: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