Commit Graph

9608 Commits

Author SHA1 Message Date
UdjinM6
636e48b2a8 fix off-by-1 bug in DisconnectBlocks (#1313) 2017-02-04 04:41:32 +04:00
UdjinM6
cedd269cb0 shift CSV deployment window on mainnet to "Feb 5th, 2017 - Feb 5th, 2018" (#1314) 2017-02-04 04:41:18 +04:00
Tim Flynn
0ecc7c61eb Adjust start of 12.1 superblocks (#1311) 2017-02-03 21:41:22 +04:00
Tim Flynn
3840d97027 Fix division by zero (#1310)
* Fix division by zero

* Fixes based on code review comments

* Fix nProjectedVotes value

* Set nProjectedVotes to 2000
2017-02-03 13:17:47 +04:00
UdjinM6
1486acfb99 remove IS number of inputs limit, add warning instead (#1308) 2017-02-03 02:38:33 +04:00
UdjinM6
f729d8227b bump gov cache version to start from scratch (#1306) 2017-02-02 17:43:40 +04:00
UdjinM6
c5210a3e5b Adjust gov sync (#1305)
* Adjust gov sync:
- simulate mainnet gov obj sync conditions on testnet
- add redundancy: ask up to 3 peers for the same obj

* stop loop if max number of peers per obj was asked
2017-02-02 17:04:45 +04:00
Tim Flynn
1f7b46c2c0 Restore 5 Dash fee for proposal creation (#1302) 2017-02-02 12:51:02 +04:00
Tim Flynn
399330d42d Improve governance syncing efficiency with bloom filter (#1299)
* Use bloom filter for governance vote syncing

Modify masternode-sync to send bloom filters

Correctly initialize bloom filter

Set fUseFilter argument

Increase bloom filter size to account for multiple signals

Set bloom filter parameters

Use constants for bloom filter parameters

Added filter size check

Added filter size check in masternode-sync

Update bloom filter

Changed bloom parameters

* Bump protocol version

* Update sync time for inv's

* Changes based on code review comments

* Make bloom filter size network dependent

* Fix network dependent filter parameters

* Remove unneeded constant definition

* Move constant definition

* Add blank line
2017-02-02 12:50:44 +04:00
UdjinM6
cfc8954b42 Shift PS denoms (#1292)
* Shift PS denoms

* fix ui PS restrictions
2017-02-02 12:50:21 +04:00
Tim Flynn
a73185d939 Increment node refcount before adding to vector (#1304) 2017-02-02 12:22:47 +04:00
Tim Flynn
944420deb0 Fix deadlock in governance on cs_main (#1303) 2017-02-02 03:07:24 +04:00
UdjinM6
3bfa5392fa fix flag/ref order + cs_vNodes in ConnectNode (#1300)
* fix flag/ref order

* hold cs_vNodes in ConnectNode a little bit longer

* fix
2017-02-01 21:24:00 +04:00
UdjinM6
c8466cfb04 fix lock order in ThreadMnbRequestConnections (#1298) 2017-01-31 21:11:21 +04:00
UdjinM6
572c554681 Multiple mnb recovery (#1297)
* ask for multiple mnb hashes for recovery

* address comments, lock cs_vNodes and add/relese ref

* add parentheses
2017-01-31 19:29:27 +04:00
UdjinM6
e2eaf1d0d7 Fix few block processing bugs (#1291)
* protect mapRejectedBlocks by cs_main

* few block reprocessing fixes:
- DisconnectBlock should fail on DisconnectTip failure
- ResolveConflicts should fail on DisconnectBlock failure
- ReprocessBlocks cleanup

* don't ban on IsBlockValueValid/IsBlockPayeeValid failure
2017-01-30 10:01:08 +04:00
Tim Flynn
04ed5db62c Fix Vote iteration bug (#1290)
* Fix Vote iteration bug

* Fix order of statements
2017-01-29 23:09:21 +04:00
UdjinM6
60409df822 InstantSend overhaul (#1288)
* Multi-quorum InstantSend, complete refactoring
+ cleanup for IS and partial protobump

* more changes:
- allow InstantSend tx to have 10 inputs max
- store many unique tx hashes in mapVotedOutpoints
- more checks in AcceptToMemoryPoolWorker (moved from ProcessMessage + CTxLockRequest(tx).IsValid() )

* More changes:
- let multiple lock candidates compete for votes
- fail to vote on the same outpoint twice early

* More changes:
- notify CInstantSend on UpdatedBlockTip -> remove cs_main from CheckAndRemove()
- notify CInstantSend on SyncTransaction -> count expiration block starting from the block corresponding tx was confirmed instead of the block lock candidate/vote was created
- fixed few locks

* add comments about nConfirmedHeight

* Fix "Block vs Lock" edge case

* Fix "Block vs Lock" edge case, p2

* Fix issues:
- fix logic for locking inputs and notifying - see UpdateLockedTransaction, TryToFinalizeLockCandidate
- add missing hash inserting in ProcessTxLockVote
- add nMaxBlocks param to ResolveConflicts to limit max depth allowed to disconnect blocks recursively
- fix false positive mempool conflict
- add missing mutex locks
- fix fRequireUnspent logic in CTxLockRequest::IsValid
2017-01-29 12:22:14 +04:00
Tim Flynn
9c5db04953 Fix datadir initialization in dash-qt (#1287) 2017-01-27 18:07:13 +04:00
TheLazieR Yip
534effaf85 Set width=18 to support NEW_START_REQUIRED status in masternodelist full (#1281) 2017-01-25 15:37:45 +04:00
UdjinM6
d8797023c8 move mnb verification requests to their own thread (#1274)
* move mnb verification requests to their own thread, should remove related ui/rpc freezes

* vector -> list
2017-01-21 23:03:55 +04:00
Tim Flynn
348c001445 Fix governance-votedb index bug (#1278) 2017-01-21 09:26:35 +04:00
TheLazieR Yip
2a43d23f95 Enable sendrawtransaction to send IS (#1271)
* Enable sendrawtransaction to send IS

* InstantSend as optional for sendrawtransaction
2017-01-20 03:00:47 +04:00
UdjinM6
a7d172fafd update list of mn states in masternodelist rpc help (#1272)
fix #1266
2017-01-19 23:06:56 +04:00
Tim Flynn
70b2f3e083 Limit number of warning messages logged by CNode's (#1273) 2017-01-19 23:06:32 +04:00
Tim Flynn
0233d87739 Do not call CloseSocketDisconnect from non-socket handler threads (#1276) 2017-01-19 23:02:57 +04:00
Tim Flynn
4b7bd6be8f Governance masternode notification bug fixes (#1270)
* Flag governance items when MN's are removed

* Remove old broken update mechanism

* Do not flag MN state changes which are irrelevant to validity

* Call AddGovernanceVote
2017-01-18 19:24:19 +04:00
Tim Flynn
5254255a0a Voting related syncing changes (#1269)
* Remove vote count check from IsValidLocally

* Do not check voted validity flag when syncing

* Do not send objects marked for deletion during syncing

* Remove node penalty for unrequested objects.
2017-01-18 19:24:04 +04:00
Tim Flynn
2ea9c69985 Logging improvements (#1268)
* Add default log messages when beginning asset sync

* Added default log message for AskFor buffer full condition

* Improve log message based on code review comments
2017-01-18 19:23:49 +04:00
UdjinM6
b5239b790e Merge #1267: Fix IS locking/crashes 2017-01-18 07:38:13 +01:00
UdjinM6
f81ea67a08 Remove hashes from setAskFor (#1264)
We should remove hash from setAskFor when the message corresponding to previous inv arrives, otherwise it's stays there forever and setAskFor overflows (i.e. AskFor returns immediately without processing).
2017-01-18 00:02:59 +04:00
UdjinM6
f1ee9d9c71 Change governance sync process (#1265)
* On gov sync first sync objs, then ask for votes on per-obj basis from different peers.

This should help to sync obj list initially and split the load among many peers. Also adds ability to catch up votes later after the sync.

* ask for all objects, do this in cycles

* Fix Sync() code, better readability

* ask multiple nodes at once when possible, perf boost for large numper of objs

* Addressed comments: pass reference, more peer version check
2017-01-18 00:02:38 +04:00
UdjinM6
f995a264e2 Do not try to check or verify mns until synced to some stage (#1261)
Verification creates new conections, which we also use to sync but then we disconnect on ProcessMasternodeConnections every minute which at least could lead to excessive node load (for our peers). But could also interfere with sync process itself and we'd better keep them separate.
2017-01-15 02:29:08 +04:00
UdjinM6
e8479675a8 show local time in Masternodes tab (#1244) 2017-01-13 18:03:28 +04:00
UdjinM6
053e374e42 Merge bug fixes (#1260)
* Fix for incorrect locking in GetPubKey() (keystore.cpp)

* Fix Cmd-Q / Menu Quit shutdown on OSX

* Addition of ImmatureCreditCached to MarkDirty()

To protect against possible invalidation and to bring conformity to the code.
2017-01-13 18:02:33 +04:00
UdjinM6
5cb6486616 Assuming that we synced blockchain already if we have at least MASTERNODE_SYNC_ENOUGH_PEERS (6 currently) peers at the same height as we are (#1257) 2017-01-11 03:33:14 +04:00
UdjinM6
621f9ebeca remove GetEstimatedMasternodes and GetTotalCoinEstimate (#1258) 2017-01-11 03:33:01 +04:00
TheLazieR Yip
a42b375a05 Update to listunspent cli command (#1254)
* Add missing description for listunspent help message.

* Add ps_round (PrivateSend Round) in listunspent result

* s/round/rounds/
2017-01-11 03:06:17 +04:00
UdjinM6
9114ef7930 Changes in potential_deadlock_detected behavior: (#1259)
1. print to stdout too
2. only print when it's critical (i.e. going to crash on assert)
2017-01-11 03:00:34 +04:00
UdjinM6
26419596ce bump nMinBlocksToStore 4000->5000 (#1256) 2017-01-11 03:00:22 +04:00
UdjinM6
a930363366 RequestLowDataPaymentBlocks should request unknown payment blocks too (#1255) 2017-01-11 03:00:06 +04:00
Tim Flynn
3b9a748d5e Fix locking order (#1252)
* Add cs_main locks prior to governance locks to ensure correct locking order
2017-01-09 19:09:42 +04:00
UdjinM6
0c2304e24f Backport btc pr7907 (#1253)
Fixing this https://bitslog.wordpress.com/2017/01/08/a-bitcoin-transaction-that-takes-5-hours-to-verify/

* Unit test for CScript::FindAndDelete

* Replace memcmp with std::equal in CScript::FindAndDelete

Function is stl; std::equal just makes more sense.

* Replace c-style cast with c++ style static_cast.

* Improve worst-case behavior of CScript::FindAndDelete

Thanks to Sergio Lerner for identifying this issue and suggesting this kind of solution.
2017-01-09 18:51:04 +04:00
UdjinM6
7e9ad0e26c Migration fixes (#1247)
* clean some network specific qt settings on migration

* ask user to choose datadir if default dir is not the one we expected
2017-01-04 21:47:50 +04:00
snogcel
a9e1361fc2 update voteraw rpc parameters (#1249) 2017-01-04 21:47:16 +04:00
UdjinM6
ba8d8ae027 remove unused pindex from IsValidLocally, fix cs_main in rpc (#1243) 2017-01-03 22:32:52 +04:00
Tim Flynn
8d7866cf6b Update rate check buffer for locally created objects (#1245) 2017-01-03 18:17:29 +04:00
UdjinM6
457c20092f Select peers on initial sync more carefully (#1238)
* Select peers on initial sync more carefully

* allow a small error margin of 1 block

* fix comment/log message
2017-01-01 22:30:40 +04:00
UdjinM6
e4a290693b Recovery from MASTERNODE_NEW_START_REQUIRED state (#1232)
Implement masternode recovery from MASTERNODE_NEW_START_REQUIRED state via mn quorums
2017-01-01 21:48:53 +04:00
TheLazieR Yip
f6ca563ab2 typo in masternodeaddr error message (#1242) 2017-01-01 19:32:08 +04:00
TheLazieR Yip
471365bf6c Masternode Sync should be finished before mining processing (#1240)
* Reject getblocktemplate request until masternode sync is finished

* Pending internal miner until masternode sync is finished
2017-01-01 14:18:33 +04:00
TheLazieR Yip
89d14c5274 Fix Hot Masternode Starting (#1239) 2017-01-01 14:18:21 +04:00
TheLazieR Yip
7815f6e32e Provide correct warning in CheckForkWarningConditions for large worked invalid chain. (#1234) 2017-01-01 14:18:05 +04:00
UdjinM6
7544a70e1b display chainwork for every tip in getchaintips (#1237) 2016-12-30 20:38:53 +04:00
Holger Schinzel
96dda2790c added testnet checkpoint (#1235) 2016-12-30 08:05:29 +01:00
UdjinM6
32d5f4b013 Ignore payments and governance cache when mncache is empty (#1227) 2016-12-26 19:33:28 +04:00
UdjinM6
cda28d3c72 fix mnb renewal (#1226) 2016-12-26 10:44:48 +04:00
UdjinM6
34fd8daf5a Fix sync issues (#1225)
* Store time we saw mnb last time, bump sync timeout
if we received seen mnb but we are too close to MASTERNODE_NEW_START_REQUIRED_SECONDS

* Reset blockchain sync status if new blocks were accepted during sync

* Add some debug log output

* wait for at least one new block to be accepted

* bump CGovernanceManager-Version
2016-12-26 10:44:36 +04:00
UdjinM6
70b374062b [WIP] Few mn list sync changes (#1223)
* Few mn list sync changes:
- add more mn states
- only remove spent
- send mn ping in addition to mn announce on sync
- manage mn announces more carefully
- expire mns created from broadcasts with invalid ping
- old fWaitForPing logic for old nodes, should be helpful during migration period

This also adjusts active mn auto-start logic accordingly.
2016-12-24 06:49:13 +04:00
Tim Flynn
c438e74563 Improve governance debugging information (#1221)
* Add missing MN vin to error message for missing masternodes

* Added creation time and masternode vin to gobject output
2016-12-22 07:20:05 +04:00
UdjinM6
1c6c0d8b7e fix AskForMN (#1217)
Should also store/check node we asked for mn list entry, not outpoint only. This should help to get mn list in sync when some nodes refuse to answer thus blocking such requests for the same outpoint for the next 3h and increasing mn list inconsistency.
2016-12-21 03:55:55 +04:00
UdjinM6
a0c93ebaa5 cleanup/fix includes: (#1214)
- some were not used, some were included twice, some were in the wrong place, some were missing (but it compiled because some were in the wrong place)
- organized a bit better, grouped dash specific includes in original bitcoin files, should save some time solving conflicts when/if merging patches later
2016-12-20 17:27:59 +04:00
Holger Schinzel
e1702cd4ec bump copyright notice to 2017 (#1207) 2016-12-20 17:26:45 +04:00
Tim Flynn
8c16880b15 Fix governance hash (#1208)
* Add vinMasternode to governance object hash and bump protocols

* Add collateral hash to governance object hash

* Added signature to object hash

* Revert "Add collateral hash to governance object hash"

This reverts commit 2f60c280f3.
2016-12-20 07:25:20 +04:00
UdjinM6
fa301ecb49 local nLastDsq (#1211)
* Revert behaviour introduced in 5e1a6afe7f, make nLastDsq local variable instead of being network-wide one. Should fix mixing for new clients and for those who was offline for too long.

* fix docs
2016-12-20 03:09:38 +04:00
UdjinM6
ff12698ed5 Clean up rpcgovernance (#1213) 2016-12-20 03:06:06 +04:00
UdjinM6
b04f67546d GetBudgetSystemCollateralTX should use "this" wallet, not "main" (#1212) 2016-12-20 03:05:24 +04:00
UdjinM6
88ee7a372e better local address discovery for active mn (#1203)
* Make local address discovery more robust in CActiveMasternode

* parameter interaction: -masternode=1 -> setting -listen=1

*  slightly postpone first run to give net thread a chance to connect to some peers

* make sure local address detected in CActiveMasternode::ManageStateInitial is valid

* Simplified address detection logic
2016-12-15 20:27:24 +04:00
Tim Flynn
84c242fc8c Restore relaying and fix rate threshold (#1206)
* Restore object relaying during orphan processing

* Relay votes during orphan processing

* Allow relaying of objects and votes during syncing

* Double rate check threshold
2016-12-15 20:27:09 +04:00
Tim Flynn
8fc8e6c8c2 Implement rate check using buffer (#1202)
* Implemented buffer for masternode rate checks

* Change upper limit on object timestamp to 1 hour in the future
2016-12-14 19:28:55 +04:00
Tim Flynn
711a5fbf20 Deletion time fix (#1205)
* Fix deletion time bug
* Only set deletion time if it has not already been set
2016-12-14 19:27:46 +04:00
UdjinM6
072b0fd708 fix annoying compiler warnings (#1204) 2016-12-14 17:33:46 +04:00
UdjinM6
30da3f56a7 gobject rpc changes: (#1201)
- added description for 'deserialize'
- added 'type' filter to 'list'
- added 'count' command (changed CGovernanceManager::ToString to output a bit more detailed info)
2016-12-12 05:44:46 +04:00
UdjinM6
8f20c3ba46 fix future time bug (#1200) 2016-12-11 15:08:10 +04:00
UdjinM6
e9125835b7 Don't increase PoSe ban score when can't connect (#1197) 2016-12-11 10:18:52 +04:00
Tim Flynn
df5abf1468 Convert masternode rate checks to use object timestamp (#1198)
* Change rate check logic to avoid DoS attacks

* Convert rate check to use object timestamp instead of arrival time

* Update cached variables before checking for superblocks

* Ensure that last times are monotonically non-decreasing

* Bump governance manager serialization format

* Improved rate check error reporting
2016-12-11 10:17:38 +04:00
UdjinM6
a11bd2c5ba small ix fixes: (#1193)
- make script verification a part of IsInstantSendTxValid()
- relax nLockTime for IS txes since we don't have compatibility with 12.0 IS txes anyway now (fee is lower in 12.1)
2016-12-09 00:03:57 +04:00
UdjinM6
cf57c5ca93 adjust variable names and log messages in IsBlockValueValid (#1192) 2016-12-09 00:03:46 +04:00
Tim Flynn
15bb93d5e8 Rate check fixes (#1196)
* Fix rate checks for governance objects

* Do not update last vote time when rate checks are disabled

* Bump governance serialization version
2016-12-09 00:00:49 +04:00
Tim Flynn
4dac0025a7 Governance relaying fixes (#1195)
* Vote relaying changes
 - Remove vote relaying from ProcessVote
 - Remove vote relaying from orphan vote processing
 - Relay vote in ProcessMessages (only)

* Do not relay governance objects during orphan processing

* Restore relaying of local votes

* Changed overloaded function name: ProcessVote->ProcessVoteAndRelay
2016-12-07 08:16:34 +04:00
UdjinM6
32ab9f2624 changes in CMasternode::Check (#1194)
* add log output when mn state changes (debug mode only)

* trigger FlagGovernanceItemsAsDirty only when mn state actually changes
2016-12-06 23:50:54 +04:00
TheLazieR Yip
3914f4a1c4 Update superblock valid checking to allow block creation by p2pool (#1190)
* Update superblock valid checking to allow block creation by p2pool

* Comment correction for superblock payment not found.

* Comment correction
2016-12-06 21:26:44 +04:00
UdjinM6
6a3550b94f Fix some gov sync issues (#1191)
* Don't relay objects and votes until synced

* fix sync timeout for govobjs

* count objs and votes separately

* reuse GetHash() value, adjust log messages
2016-12-06 20:40:37 +04:00
UdjinM6
0e28de7e10 Merge #1189: release nodes after loop in CMasternodeSync::ProcessTick() 2016-12-05 11:06:51 +01:00
Tim Flynn
9f2d79d920 Fix masternode rate checks (#1187)
* Added logging to PushInventory

* Fix LogPrint format

* Log errors found during governance syncing

* Turn off rate checks during syncing

* Turn off rate check during maintenance
2016-12-05 00:33:39 +04:00
UdjinM6
3ebcb78e12 do not conect trayIconActivated on mac (#1184) 2016-12-05 00:33:23 +04:00
UdjinM6
80444ea8e4 optimize PS (#1180)
* move HasCollateralInputs out of the loop

* optimize HasCollateralInputs
2016-12-05 00:33:11 +04:00
Tim Flynn
786f17e1f2 Merge #1186: Added logging of sent inv messages 2016-12-03 22:33:30 +01:00
Tim Flynn
8126e92441 Merge #1185: Trigger removel changes
- Do not expire superblock triggers on execution
  - Expire trigger objects about 1 day (576 blocks) after their event height is past
2016-12-03 20:46:08 +01:00
UdjinM6
bc3b349cc1 expired masternodes should not be auto-re-enabled on start, should keep expired state (#1182) 2016-12-02 21:42:45 +04:00
UdjinM6
d9b1e7734a Few mn payments fixes: (#1183)
- avoid processing same vote multiple times
- do not relay votes until synced
- do not ban for wrong signature of old votes
- do not check masternode ranks for old votes on regular (non-MN) nodes
2016-12-02 21:15:37 +04:00
UdjinM6
b847642428 bug: int -> int64_t (#1179) 2016-12-02 16:53:28 +04:00
Tim Flynn
8c12ab2b47 Don't penalize nodes during orphan processing (#1181) 2016-12-02 16:53:18 +04:00
UdjinM6
c3e5757c25 fix relay bug (#1178) 2016-12-02 14:32:28 +04:00
UdjinM6
d9fb724943 Refactor IsBlockValueValid (#1177)
* refactor IsBlockValueValid to return actual error string, use it in error message for bad-cb-amount

* make error messages in IsBlockValueValid even more verbose
2016-12-02 01:58:55 +04:00
Tim Flynn
d88249b787 Merged #1176: Added log message to print block height when IsBlockValueValid returns false 2016-12-01 14:58:17 +01:00
UdjinM6
6d9e414c6a Split CheckAndUpdate: (#1175)
- SimpleCheck - to verify only future time and unknown blockhash
- CheckAndUpdate - to verify everything
2016-11-30 23:32:36 +04:00
UdjinM6
15cf414967 Slightly improve/cleanup log output (#1174) 2016-11-30 05:33:47 +04:00
UdjinM6
17cebbed15 fix excessive banning, remove some redundant logic (#1172)
* Since we send all mnb's now regardless of mn state, ping check for sigTime being too old is obsolete (and wrong).
Also removing fRequireEnabled, this logic is deprecated too it seems.

* remove (pre-)enabled check in CMasternodeMan::Add
2016-11-30 05:33:37 +04:00
UdjinM6
6cd6722c08 fix deadlocks for MNVERIFY processing (#1173) 2016-11-30 04:48:05 +04:00
Tim Flynn
e3e5b81a8d Removed CGovernanceManager::ClearSeen() (#1171) 2016-11-29 17:32:41 +04:00
Tim Flynn
286f6ad87e Add watchdog expiration map to governance cache (#1170)
* Fix misspelled logging category

* Added mapWatchdogObjects to governance cache and bumped format version
2016-11-29 04:01:03 +04:00
UdjinM6
0600a6ce1a Fix (dead)locks (#1169)
* locks in PS

* lock in governance

* locks in IS

* lock in ProcessGetData

* locks in CMasternodeSync

* centralize mnodeman.Check call

* locks order in mnpayments

* use current block chainTip when possible (less locks)

* add missing lock in CountInputsWithAmount

* fix deadlock RequestLowDataPaymentBlocks/IsTransactionValid

* LOCK2 in CheckMnbAndUpdateMasternodeList, CheckAndUpdate, SendVerifyRequest

* LOCK(cs) is not needed here

* Decouple governance init actions from serialization
Should fix this:
```
Assertion failed: lock governance.cs not held in governance-classes.cpp:117; locks held:
cs_Shutdown  init.cpp:200 (TRY)
cs  ./governance.h:195
cs  governance.cpp:835
Abort trap: 6
```
2016-11-28 18:21:50 +04:00
Tim Flynn
ecdc160119 Governance object deletion changes (#1167)
* Increase quorum for object deletion to 2/3 of MN network

* Implement expiration of watchdog objects

* Remove objects from the watchdog map itself

* Message fix for invalid objects
2016-11-25 18:08:48 +04:00
Tim Flynn
1b90d66ab6 Implement orphan object and vote timeouts (#1166) 2016-11-24 22:12:05 +04:00
Tim Flynn
3e8c0062a0 Implement SPORK_14_REQUIRE_SENTINEL (#1163) 2016-11-23 19:30:36 +04:00
Nathan Marley
ec59862506 Implement getcurrentvotes JSONRPC call (#1164) 2016-11-22 23:26:36 +04:00
UdjinM6
9c4e019c36 bump proto (#1162)
70202 -> 70203
2016-11-22 19:14:28 +04:00
UdjinM6
470239bbc5 Fix IS: (#1161)
- TXLOCKREQUEST should be processed as normal tx plus some custom logic, should not "fake" inventory
- should not create "fake" local lock, should instead keep track of orphan votes and reprocess them when corresponding TXLOCKREQUEST arrives
- orphan vote time map should be indexed by full outpoint, not by txid of mn collateral

bump MIN_INSTANTSEND_PROTO_VERSION
2016-11-22 18:54:26 +04:00
UdjinM6
e84f393571 more info in getpoolinfo rpc, privatesend rpc should only do actions (#1154) 2016-11-22 00:40:56 +04:00
UdjinM6
785adad57e Slightly refactor/fix IS (#1153)
* slightly refactor IS:
- the only place where logic is changed: `ProcessTxLockVote()` - it should first try to find mn and fail if none was found and only then try to call `GetMasternodeRank()` (which is heavy)
- fixed few `cs_main`
- slightly optimized number of `tx.GetHash()` calls
- lots of `const` (fixed few related functions in main.cpp)
- few smaller fixes: iterators, log output, comments, etc
- use thread safe methods of mnodeman
- safety check in GetAverageUnknownVoteTime
2016-11-22 00:40:32 +04:00
UdjinM6
9162c56419 Refactor HelpMessageDialog to reuse it for PS help info, add PS info to help menu (#1144) 2016-11-20 10:54:33 +04:00
UdjinM6
c2ec99ba8e thread safe rand (#1157)
* thread safe InsecureRand class

* remove GetInsecureRand, use GetRandInt for performance non-critical parts
2016-11-20 10:52:45 +04:00
UdjinM6
e121829e40 few trivial fixes in init.cpp (#1155)
* few trivial fixes in init.cpp

* DEFAULT_PRIVATESEND_LIQUIDITY

* fix InitParameterInteraction
2016-11-20 10:52:23 +04:00
Tim Flynn
e59bee8114 Masternode syncing changes (#1149)
* Modified DSEG to send mnb regardless of state

* Removed unused function

* Deactivate rate check when processing masternode orphan objects
2016-11-18 18:17:22 +04:00
Tim Flynn
90bd7cb62b Implemented delay for governance object deletion (#1151) 2016-11-18 18:17:00 +04:00
Spencer Lievens
efa36242a3 Remove duplicated include of governance.h (#1152) 2016-11-18 18:16:30 +04:00
Spencer Lievens
73568be5a3 Remove Duplicated Include for darksend.h (#1150) 2016-11-18 00:39:08 +04:00
UdjinM6
ce88ab3144 Refactor IS - rename only (+related log messages) (#1146) 2016-11-17 04:31:35 +04:00
UdjinM6
7a005a911e Merge pull request #1142 from crowning-/patch-1
[UI] TrayIcon + TrayIconMenu for OSX
2016-11-17 02:52:20 +04:00
UdjinM6
79af6fddea Merge pull request #1145 from tgflynn/v0.12.1.x-mn-startup-fix
Exit if cache files can't be read
2016-11-17 02:49:19 +04:00
Tim Flynn
112986edab Fix CheckMasternodeOrphanObjects so that iterator is incremented once per passage through the loop block 2016-11-16 17:28:10 -05:00
crowning-
9071136c9b [UI] TrayIcon + TrayIconMenu for OSX (review changes) 2016-11-16 22:04:33 +01:00
crowning-
12691e15d4 [UI] TrayIcon + TrayIconMenu for OSX (review changes) 2016-11-16 22:04:26 +01:00
Tim Flynn
47d09ac2db Exit if cache files can't be read 2016-11-16 10:37:40 -05:00
UdjinM6
5128085240 Merge pull request #1134 from UdjinM6/PSFixes
Yet another PrivateSend refactoring/optimization - core part
2016-11-16 13:07:06 +04:00
UdjinM6
a7dae03bfb Merge pull request #1143 from tgflynn/v0.12.1.x-mnodeman-cleanup
CMasternodeMan cleanup
2016-11-16 12:28:57 +04:00
Tim Flynn
ad0e3514c2 Added indexMasternodes to CMasternodeMan::Clear() 2016-11-15 21:31:14 -05:00
Tim Flynn
087d3d22df Remove unused CMasternodeMan method and argument 2016-11-15 21:09:37 -05:00
crowning-
544d220819 [UI] TrayIcon + TrayIconMenu for OSX 2016-11-15 23:38:04 +01:00
Tim Flynn
c00fdb524a Added peer id to CGovernanceManager::Sync log message 2016-11-15 08:23:49 -05:00
Tim Flynn
c4c4f1dad7 Ensure governance objects are still valid before relaying 2016-11-14 21:27:05 -05:00
Tim Flynn
6deb3a65a3 Implemented missing masternode handling 2016-11-14 21:13:42 -05:00
Tim Flynn
35a45097ed Added IsValidLocallyMethod overload which returns masternode status flag 2016-11-14 21:13:08 -05:00
Tim Flynn
a3277ea422 Set error string for unparseable objects 2016-11-14 21:12:55 -05:00
Tim Flynn
aaf96c9a00 Fix function name in log messages 2016-11-14 15:28:46 -05:00
Tim Flynn
31370decd7 Changed log message handling due to code review suggestion 2016-11-14 15:26:53 -05:00
Tim Flynn
d167772643 Only process orphan votes once 2016-11-14 13:22:50 -05:00
Tim Flynn
08e977efe5 Change signature of Insert method to return indication of whether insertion succeeded 2016-11-14 13:17:42 -05:00
Tim Flynn
fd1327031b Moved vote relaying into ProcessVote so that local votes are relayed 2016-11-14 13:07:11 -05:00
Tim Flynn
c31ba8ba4c New vote tallying implementation (#1135) 2016-11-13 21:52:34 +04:00
Tim Flynn
82ca5fdbb8 CGovernanceManager initialization fix (#1138)
* Fix CGovernanceManager initialization problem

* Added logging messages for cases where CGovernanceManager receives a message while not synced

* Prevent potential NULL pointer dereference
2016-11-12 15:14:50 +04:00
UdjinM6
4b4921d8ce reset pSubmittedToMasternode in SetNull() 2016-11-11 11:29:13 +03:00
UdjinM6
643798b5a9 rename UpdatePoolStateOnClient to CheckPoolStateUpdate 2016-11-11 11:28:35 +03:00
UdjinM6
d2f1fd253c Fix exit codes (#1127)
* Fix exit codes:
- `--help`, `--version` etc should exit with `0` i.e. no error ("not enough args" case should still trigger an error)
- error reading config file should exit with error
- slightly refactor AppInitRPC/AppInitRawTx to return standard exit codes (EXIT_FAILURE/EXIT_SUCCESS) or CONTINUE_EXECUTION (-1)
- every main()/exit() should return/use one of EXIT_ codes instead of magic numbers
2016-11-11 09:16:39 +04:00
UdjinM6
6695a43b4a rename nLastTimeChanged to nTimeLastSuccessfulStep, set state before updating nTimeLastSuccessfulStep 2016-11-10 01:49:57 +03:00
UdjinM6
9908ca7c05 PS changes:
Refactoring:
- IsDenomCompatibleWithSession, split in 3 - CreateNewSession, AddUserToExistingSession and IsAcceptableDenomAndCollateral
- CheckTimeout:
    - should not rely on CDarkSendEntry nTimeAdded to clear entries, instead should rely on time of the last successful step i.e. nLastTimeChanged
    - nLastTimeChanged should only be set when mixing moved forward in some way

State related:
- local pool should be in POOL_STATE_IDLE initially
- local pool should switch to POOL_STATE_QUEUE when connected to mn
- local pool should set session id only when in POOL_STATE_QUEUE
- SetState should set state local only, no relaying
- mixing wallets should rely on local logic and expected set of state switches rather then updates from masternodes
- deprecate STATUS_SET_STATE, POOL_STATE_UNKNOWN, POOL_STATE_TRANSMISSION, POOL_STATE_FINALIZE_TRANSACTION

Session related:
- deprecate fSessionFoundMasternode, use nSessionID instead
- deprecate nSessionUsers, use vecSessionCollaterals.size() instead

Other:
- deprecate IsNull()
- move few things to private
- remove deprecated
- bump min ps peer proto
2016-11-09 01:56:27 +03:00
UdjinM6
fef8752cd0 remove excessive bool arg in dscomplete (#1124) 2016-11-07 03:27:51 +04:00
UdjinM6
f2d2b25130 dsq fixes: (#1128)
- make sure dsq is not too much in the future
- do not process seen dsq
- do not alter nTime for dsq localy, use memory only fTried instead
2016-11-07 03:27:26 +04:00
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 8aa722609d (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
UdjinM6
8641ae189b Assign base58Prefixes[EXT_COIN_TYPE] properly (#1007) 2016-09-12 21:40:46 +04:00