Commit Graph

13557 Commits

Author SHA1 Message Date
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