Commit Graph

9599 Commits

Author SHA1 Message Date
Tim Flynn
fc7eca597d Locking fix for UpdatePreferredDownload (#1389) 2017-03-09 02:36:50 +04:00
Tim Flynn
eb4e6a32dd Fix deadlocks on cs_vSend in RequestGovernanceObject (#1387) 2017-03-09 02:36:40 +04:00
Tim Flynn
c8b6199979 Periodicially request orphan objects (#1383)
* Implement RequestOrphanObjects

* Ensure governance objects are only requested from peers once per call

* Add gobject log messages

* Implemented CleanOrphanObjects

* Move governance maintenance functions from NewBlock to a time-based function

* Remove unused delcaration for mapAskedForGovernanceObject
2017-03-06 08:46:59 +01:00
Holger Schinzel
85d152bac0 bump to 0.12.1.4 (#1376) 2017-03-05 23:16:30 +04:00
Tim Flynn
9537062aff Implemented utility functions for copying/releasing vNodes vector (#1382)
* Implemented utility functions for copying/releasing vNodes vector

* Refactor code to use new utility functions CopyNodeVector/ReleaseNodeVector
2017-03-05 23:16:12 +04:00
UdjinM6
119fe83bb4 Do not send outdated MNs on sync (#1373) 2017-03-02 00:31:53 +04:00
UdjinM6
5598d640e6 Do not force disconnect for stalled nodes on sync (#1374)
They might be simply busy serving us another data
2017-03-02 00:31:41 +04:00
UdjinM6
1c63052c3e fix recently observed crash on IsValid (#1375)
* fix recently observed crash on IsValid

+some small cleanup

* txin.prevout.n should not exceed txOutpointCreated.vout.size()

* fix log output
2017-03-01 21:30:43 +01:00
Holger Schinzel
295e94d66a bump to 0.12.1.3 (#1371) 2017-03-02 00:30:21 +04:00
QuantumExplorer
8c64c0a7cf fixed protobuf 3.0 (byteswap) issue on macOS (#1370) 2017-02-28 13:00:02 +04:00
chaeplin
d26916ad5b make sendrawtransaction to accept 2nd optional (#1369) 2017-02-28 12:59:49 +04:00
Spencer Lievens
01eeb59af6 Splashscreen now displays correctly (Fully) (#1367)
* Splashscreen now displays correctly on retina devices

* Remove devicePixelRatio instances
2017-02-28 12:59:27 +04:00
UdjinM6
a1ef547918 only consider higher hashes if they don't exceed nExpirationDelay (#1361) 2017-02-23 21:23:30 +04:00
Tim Flynn
0bc6d92334 Define current votes by creation time instead of arrival time (#1360) 2017-02-23 16:29:00 +04:00
UdjinM6
636fb33e71 implement sentinel-like wd selection logic (#1359)
* Only accept wd's that are more recent or have a higher hash than the current best

* Fix whitespace typo

* Relay current watchdog when lower priority ones are received

* Fix nHashWatchdogCurrent reset conditions

* expire previous current wd when a new one is found in UpdateCurrentWatchdog

* fail to process votes for expired or deleted object
2017-02-22 22:29:30 +04:00
Holger Schinzel
17cf8dc6d1 bump to 0.12.1.2 (#1355) 2017-02-21 00:26:11 +04:00
UdjinM6
e9e5a24910 fixing strings and docs + instantsend.md (#1354) 2017-02-19 22:02:33 +01:00
crowning-
e3288a7e14 [RFC] add ObjectType to first-level JSON result (#1352) 2017-02-19 17:55:52 +01:00
UdjinM6
f59bd434ad fix gov list filtering bug (#1353) 2017-02-19 17:55:37 +01:00
UdjinM6
6d2cc99e35 Add "enough data" stop conditions for gov sync (#1350)
* Add "enough data" stop conditions for gov sync

* fix:
- make sure condition is checked only once per tick
- let condition be fully used on resync (reset nTimeNoObjectsLeft)
2017-02-18 00:08:41 +04:00
UdjinM6
91f7e57402 fix verification network behaviour: (#1348)
* fix verification network behaviour:
- use up to 10 connections only
- save state (do not ask same nodes after restart)
- initiate on time based intervals (every 5 minutes), based not on new blocks (should keep connections alive longer)

* revert mWeAskedForVerification serialization

* send verify requests using MAX_POSE_CONNECTIONS as a step
2017-02-18 00:08:29 +04:00
UdjinM6
31d8e03a2b Update sendcoinsentry.ui (#1343) (#1349)
Replacing 'bitcoins' in tooltip
2017-02-17 13:37:34 +04:00
UdjinM6
57fd9e9e2a fix watchdogs (#1346)
* fix watchdogs:
- do not accept if CreationTime is out of bounds (using CreationTime, not local time now)
- do not sync expired
- fix disk serialization

* drop watchdogs early, avoid adding//removing

* clean mapWatchdogObjects when object is deleted via votes
2017-02-17 04:48:42 +04:00
UdjinM6
f774daf47f a bit more granular sync checks for mnpayment (#1344) 2017-02-17 04:48:29 +04:00
TheLazieR Yip
e89b12d0c5 Gracefully not accept incoming connection (#1342) 2017-02-16 19:40:40 +04:00
UdjinM6
80b71d9746 Few networking fixes (#1341)
* Few networking fixes:
- skip "masternode"/inbound connections for sync related processes
- do not sync gov data to other nodes until fully synced ourselves
- do not accept incoming connections until fully synced

* inbound connections could be harmful only if our node is a masternode

* same for CGovernanceManager::Sync
2017-02-16 19:14:42 +04:00
crowning-
23fa1f5f13 [Trivial] maxconnections parameter help text modified (#1340) 2017-02-16 19:14:29 +04:00
Bob Feldbauer
af1177dd54 Update for OpenSSL 1.1 API. (#1336)
* Update for OpenSSL 1.1 API.

* Update qt/paymentrequestplus.cpp for OpenSSL 1.1 API.

* Fix missing # in if for qt/paymentrequestplus.cpp fix for OpenSSL 1.1 API change.

* Fix indentation in src/qt/paymentrequestplus.cpp.
2017-02-15 19:18:24 +04:00
UdjinM6
6483e6d06f send confirmation dialog box should display correct smallest denom (#1329) 2017-02-12 01:04:08 +04:00
UdjinM6
f08ae49904 Fix crash on initial mixing step: (#1331)
* Fix crash on initial mixing step:
- skip nodes marked to be disconnected
- add/release ref to make sure pnode is not deleted in the middle of the process

* - fix copy/paste mistake (nTries)
- let ConnectNode manage ref for non-mn pnodeFound
2017-02-11 03:57:09 +01:00
UdjinM6
817fd9c860 bump build to 0.12.1.1 (#1330) 2017-02-11 03:56:55 +01:00
Tim Flynn
0b54ab85c8 Fix locking issues in dash-qt masternodelist (#1328)
* Add last ping time to masternode_info_t

* Use thread safe functions to access mnodeman in masternodelist.cpp

* Fix masternodelist widget locking

* Protect access to widget data from StartAlias button
2017-02-10 04:56:52 +04:00
taw00
4fcc766a29 The denominations changed with 12.1 - Fixed how messaged in the help text. (#1327) 2017-02-10 04:52:01 +04:00
UdjinM6
b6be968c2f Fix rpc (#1325)
* no wallet passphrase in masternode(broadcast) and darksend rpc

* spork values are int64
2017-02-10 04:51:47 +04:00
Tim Flynn
fecb3e4fe6 Fix some uninitialized variables in dash-qt (#1324)
* Fix uninitialized variables in WalletModel

* Fix uninitialized variable on overviewpage startup
2017-02-09 09:29:00 +04:00
UdjinM6
56971f8da1 Fix CMasternodeConfig::read (#1322)
CService fails to initialize correctly on Windows for whatever reason,
replacing this functionality with SplitHostPort call.
2017-02-06 01:29:23 +04:00
Tim Flynn
8de792291a Add a mutex lock to protect CNode::nRefCount (#1321)
* Add a mutex lock to protect CNode::nRefCount

* Added logging statement for CNode removal
2017-02-05 20:45:36 +04:00
Tim Flynn
5520bf6895 Masternode index rebuild bug fix (#1318)
* Clear old masternode index after vote map rebuild

* Add masternode index size to CMasternodeMan::ToString
2017-02-05 13:24:34 +04:00
UdjinM6
1d45023f3e assert on Release (#1317) 2017-02-04 22:47:38 +04:00
UdjinM6
bd3978fd4b Fix IS vote expiration/cleanup: (#1316)
- vote should be removed when corresponding orphan vote expires
- fix CInstantSend::SyncTransaction: mapTxLockVotes is indexed by vote hash, not by tx hash (use votes from candidates and from orhpan vote map to avoid looping through the whole vote map)
2017-02-04 22:17:45 +04:00
UdjinM6
8c6f756362 put some reasonable limits on SPORK_12_RECONSIDER_BLOCKS (#1312)
* put some reasonable limits on SPORK_12_RECONSIDER_BLOCKS

* 6h -> 24h
2017-02-04 04:42:04 +04:00
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