Commit Graph

71 Commits

Author SHA1 Message Date
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
Tim Flynn
de7b2b6c51 Merge #944: V0.12.1.x governance pr - part 1 - base functionality
068c178 Added DBG macro in util.h to facilitate debugging

    - This macro allows debugging statements (typically printf's or cout's) to
      be activated or deactivated with a single comment.  Uncomment the line:
      //#define ENABLE_DASH_DEBUG
      in util.h to enable debugging statements.

    - When commented any code wrapped with the DBG() macro will simply be removed
      by the preprocessor.  When not commented all such wrapped statements will
      be present.

    - For maximum effectiveness it is best that util.h be the first effective include
      in all source files.  It is also possible to enable the macro for a single file
      by temporarily adding #define ENABLE_DASH_DEBUG to the top of the file.

    - Code committed to non-development branches should always have the define
      commented.

d125d9b V0.12.1.x -- merging trigger/generic object/superblock changes for testnet phase II

    - This commit contains the core governance system changes for 0.12.1.  Any unrelated
      changes have either been removed or moved to separate commits.

120724c File mode fixes

    - Changed mode 0755->0644 on several source files.

c7f9e11 Updated todo reminders

    - Added reminder to revert temporary reduction of number of votes
      required to trigger superblock to 1 for testing

92adc98 Made CSuperblockManager::IsValidSuperblockHeight an inline function

    - This is for efficiency since this function is called often and is
      only 1 line of code.

c050ed7 Added comment explaining rationale for no LOCK(cs) in CSuperblock::IsValid

dc933fe Removed unused CSuperblockManager::IsBlockValid function

decec88 Moved calls to SuperblockManager::IsValidSuperblockHeight into IsSuperblockTriggered.

    - Since calls to the later function are always protected by the former there's
      no reason to keep these separate and this simplifies the code in
      masternode-payments.cpp.

8672885 Reestablished expected value check for non-superblocks in IsBlockValueValid

b01cbe0 Changes to IsBlockValueValid to fix rpc test failure

a937c76 Changed include order to allow per file activation of the DBG macro

d116aa5 Fixed IsValidSuperblockHeight logic

    - Note this has an effect on testing because we can now only create
      1 superblock per day.  Devs may need to temporarily change testnet params
      for easier testing.

2d0c2de Convert superblock payments to CAmount

    - We assume that payment values in JSON are in units of DASH
      for consistency with other RPC functions, such as
      createrawtransaction.

376b833 Revert temporary testing value for nAbsVoteReq

    - Also ensure that number of votes required is never smaller than 1

8c89f4b Cleaned up CSuperblock error handling

    - Exceptions are now thrown consistently rather than using a mix of
      exceptions and return code checking.  Exceptions are now caught only
      in AddNewTrigger when the CSuperblock constructor is called.  Unnecessary object
      status members have been removed.

d7c8a6b Removed utilstrencodings header

    - This appears to help with travis tests, for unknown reasons.

c4dfc7a Fixed some minor code review issues

63c3580 Reverted locking change in miner.

    - This should have been done in the original PR but was overlooked.

4ab72de Fixed variable name to match common practice and bracket formatting

886a678 Improvements to vote conversion code

    - Replaced redundantly defined function with inclusion of governance-vote.h

    - Replaced magic numbers with their corresponding constant symbols

0a37966 Reordered governance message handling
2016-08-17 09:08:25 +02:00
UdjinM6
a73c31f3f0 Fix GetBlockHash - Currently it's doing the job already done by chainActive and it's off by 1 block 2016-08-07 01:04:15 +03:00
UdjinM6
b4cb1e2610 Merge #911: Fix sync process: (#911)
- mn hash compatibility with 70103
- ignore some requests while syncing
- fix locking/initializing in sync
- do not ban for old mnw
- split budget/governance messages/invs
2016-08-05 18:25:03 +02:00
UdjinM6
8f9544c46e Merge #917: Move broadcast creation to CMasternodeBroadcast
8ee7b8a Move broadcast creation to CMasternodeBroadcast
2016-07-29 07:32:08 +02:00
UdjinM6
3d2bc6a4ca Merge #861: More compatibility for old ipv6 format + refactor
- try old format ipv6 if new format failed to verify
- sanitize log strings
- remove redundant ability to sign CMasternodeBroadcast in `protocolVersion < 70201` way
- verify CMasternodeBroadcast immediately on Sign
- move all CMasternodeBroadcast sig verification from CheckAndUpdate to VerifySignature
- initialize nDos at the beginning of functions so that we don't accidentally ban or reject legit MN if caller function forgot to reinitialize it
2016-06-03 06:59:19 +02:00
Evan Duffield
d8453bb92b Use chainparams instead of standalone func for mn confirms
- Use function instead of chainparams directly
2016-05-19 13:54:23 -07:00
Evan Duffield
2ca8c85820 fixed voting errors 2016-05-19 11:34:43 -07:00
UdjinM6
be9e2f1d4f Fix GetHash() for CMasternodeBroadcast 2016-03-18 03:38:00 +03:00
UdjinM6
eaf57b3fb7 Implemented masternodebroadcast
This set of rpc commands provide an ability to create masternode broadcast messages offline
and relay them from online node later (messages expire in ~1 hour).

Arguments:
1. command        (string or set of strings, required) The command to execute
2. passphrase     (string, optional) The wallet passphrase
Available commands:
  create-alias  - Create single remote masternode broadcast message by assigned alias configured in masternode.conf
  create-all    - Create remote masternode broadcast messages for all masternodes configured in masternode.conf
  decode        - Decode masternode broadcast message
  relay         - Relay masternode broadcast message to the network

Closes #741
2016-03-17 08:29:53 +01:00
UdjinM6
38f386ae1c Few small changes: - Better log output (a bit more granular for mnb, fixing "\n"s and few other small issues) - Unify variable/class members naming a bit
Closes #733
2016-03-16 07:48:37 +01:00
UdjinM6
67cd10c87d Add some locks to protect chainActive.Tip() and mapBlockIndex
(fixing only few of them here, see next commit for further changes)
2016-03-04 12:10:37 +03:00
UdjinM6
a5ac60b868 Merge remote-tracking branch 'bitcoin/0.12' into HEAD
+ merge fixes
+ keepass on evhttp
2016-02-06 16:48:04 +03:00
evan82
ddf71c0764 Merge pull request #561 from UdjinM6/v0.12.1.x_pre_enabled
V0.12.1.x pre-enabled status from masternodes
2015-09-22 07:14:10 -07:00
UdjinM6
f68a5d8102 remove depreciated dsee/dseep code
Closes #606
2015-09-12 16:35:37 +02:00
UdjinM6
30ab984920 treat MN as pre-enabled while there is no legit ping that differ from initial one (from mnb) 2015-08-22 19:00:12 +03:00
UdjinM6
001b8cf709 more fixes - dsee updated entry 2015-08-14 08:11:57 +03:00
UdjinM6
f0790ed32c fix dseep flood / log output 2015-08-14 04:14:08 +03:00
Evan Duffield
8c805923f9 Only relay dsee updates that are new 2015-08-11 18:39:22 -07:00
Evan Duffield
5e1a6afe7f Send nLastDsq with MasternodeBroadcast 2015-08-11 15:43:19 -07:00
UdjinM6
c1aa277286 set a cooldown for MN check 2015-08-08 13:36:30 +03:00
Evan Duffield
145c845d1f Changed vote restrition model
- Masternodes can only vote once per hour now, instead of 100 times a day total
- UI reports back errors now
2015-07-26 07:01:49 -07:00
Evan Duffield
b04faf6e2d Update lastPing in mapSeen obj, remove ping from CMasternode hash 2015-07-25 21:13:17 -07:00
UdjinM6
5a6e474ec6 include lastPing in mnb hash calculation 2015-07-25 09:22:58 +03:00
evan82
aa996b2615 Merge pull request #446 from UdjinM6/v0.12.0.x_fix_mnb_ping_acceptance
V0.12.0.x fix mnb ping acceptance
2015-07-20 11:21:15 -07:00
UdjinM6
cc26cff893 do not require active MN on ping check from UpdateFromNewBroadcast 2015-07-20 20:46:22 +03:00
Evan Duffield
77af4fb6ad MNP ping changes
- Ping every 5 minutes
- Nodes will propagate pings every 10 minutes
2015-07-20 10:44:27 -07:00
Evan Duffield
9c34930680 Disable nDos on early ping / sync regtest changes 2015-07-19 08:49:46 -07:00
UdjinM6
33ee068d6a Slightly refactor masternode statuses:
- better names (MASTERNODE_INITIAL was defined twice before that)
- move to proper header
2015-07-17 20:01:54 +03:00
UdjinM6
26fed43603 Major masternode broadcast/ping changes (incompatible with prev version, proto bump required):
- Do not rely on local lastTimeSeen and requested fRequested anymore. Use last know (signed) ping instead and base all logic on that. Should reduce mn list difference between
 nodes.
- Rework CActiveMasternode accordingly along with states, errorMessages, rpc etc.
- Clean some related code, move parts from public to private
- drop c_str in LogPrintf that were related to this functionality (todo: drop it for LogPrintf everywhere else)
2015-07-14 08:50:30 +03:00
UdjinM6
d94967d958 small fixes 2015-07-07 15:47:22 +03:00
Evan Duffield
4596e7f336 Vastly improved proposal management implementation
-Syncing now happens in stages. Masternodes and Sporks, then Masternode winners, then proposals. Some of these require the masternode signatures, otherwise there are race conditions within the syncing process itself.
-Resigning - When a proposal is sent to the network initially it's signed by a masternode, if that masternode goes inactive the proposal becomes invalid. Resigning allows other masternodes to update proposal keep it valid with the coming and going of masternodes.
-Resigning compatibility - non masternodes will scan and flag proposals as invalid to accept updated owners.
-Invalid votes are now actively removed from the proposals when they go inactive
- Remove budgets with negative votes of more than 10% of network
- Only allow proposals into budget that have more than 10% of network support
- Faster removal of inactive masternodes
2015-07-06 10:46:58 -07:00
Evan Duffield
f1b868f098 Removed PoSe due to consensus issues
- With nodes coming and going on the network, the network could come to different opinions about who should get paid next in line due to some nodes being flagged as failing a PoSe check. This will have to be fixed by introducing a blockchain based PoSe system, but that's out of the scope of this release. To fix the issues in the interrim, I'm removing PoSe checks for the time being.
2015-06-23 16:44:31 -07:00
Evan Duffield
43e6976695 merged 2015-06-23 10:53:12 -07:00
Evan Duffield
c72355335c Coinbase Payee Cache Implementation
- Masternode nLastPaid is removed and a new caching system that keeps the last 30 days of coinbase payees replaces it
- To deal with some significant attack vectors, the masternode donation feature was removed. The donation feature was added to support developement anyway, so this will be replaced by the budgeting code.
-  This code should allow the network to come to consensus about who should be paid pretty effectively
2015-06-23 10:48:03 -07:00
UdjinM6
a6a04cb5c1 refactor: dsee -> mnb 2015-06-23 18:40:08 +03:00
UdjinM6
91c7f66562 remove nLastPaid from CMasternodeBroadcast 2015-06-18 00:18:24 +03:00
UdjinM6
795ee119ec SecondsSincePayment (fix buffer overflow / change logic / move impl to cpp) 2015-06-17 23:03:09 +03:00
evan82
07fbdfc525 Merge pull request #356 from UdjinM6/v0.12.0.x_mnping_blockhash
V0.12.0.x add recent (tip - 12) blockhash to mnping
2015-06-09 20:04:12 -06:00
adios
f9b77c4376 Masternode broadcast's and ping's GetHash method fix 2015-06-09 17:22:31 +04:00
UdjinM6
19d9a65f8a add recent (tip - 12) block hash to mnping 2015-06-09 14:37:36 +03:00
Evan Duffield
bd4a7f2fad Masternode payment consensus via quorums
- Payees are chosen by their last payment, if no payment it's based on their hash
- Fixed a few issues with counting quorum votes
2015-05-28 10:45:31 -07:00
Evan Duffield
40149c4e41 Budgeting Software / Reference Node Removal
- Added commands for using budgets "mnbudget" and "mnfinalbudget"
- Supports 100% decentralized budget control and view-only site with json meta data object
2015-05-14 18:01:15 -07:00
Evan Duffield
969826c249 Reference Node / Stubbed Out Budget System
- Removed of reference node and replaced with decentralized quorums that pick the masternodes who get paid each block.
- Made a budgeting system, where masternodes can vote on individual budgets and the data is stored perminently on each clients computer
2015-04-30 07:55:37 -07:00
Evan Duffield
1e69e57662 Masternode Overhaul
- Added new CMasterBroadcast/CmasternodePing objects, with all of the code required to check each new message. SHould be much easier to tell what's going on now.
2015-04-17 23:44:49 -07:00
Evan Duffield
d25cf1af22 Split masternode and payments code 2015-04-16 13:26:18 -07:00
Evan Duffield
88f6a598b9 Updated Reference-Node Implementation
- Added nLastPaid to masternode information for persistant storage of the masternode payment cycle
- Masternodes get flagged as just paid when they enter the masternode list and must wait a full cycle to be paid again
- Masternode RPC commands now show short vin string instead of ip address
2015-04-16 07:08:06 -07:00
UdjinM6
dd39898a6b Merge branch 'master' into HEAD
Resolved conflicts:
	configure.ac
	src/clientversion.h
	src/qt/locale/dash_bg.ts
	src/qt/locale/dash_cmn.ts
	src/qt/locale/dash_de.ts
	src/qt/locale/dash_es.ts
	src/qt/locale/dash_fi.ts
	src/qt/locale/dash_pt.ts
	src/qt/locale/dash_ru.ts
	src/qt/locale/dash_sv.ts
	src/qt/locale/dash_vi.ts
	src/qt/res/icons/toolbar.png
	src/qt/res/icons/toolbar_testnet.png
2015-04-04 19:45:02 +03:00
UdjinM6
64eebc3316 0.12 dirty merge'n'fix (bitcoin 0.10) 2015-04-04 19:24:37 +03:00
UdjinM6
89f8a68a97 Fixes for "masternode list"
- fix descriptions and filtering in masternode list rpc, sort modes
- rename "active" to "status"
- move MN status string compilation to masternode.h
- "full" mode will use Status instead of IsEnabled now
2015-03-31 04:14:44 +03:00