Commit Graph

20 Commits

Author SHA1 Message Date
UdjinM6
52cd4d40d8 Fix bug: nCachedBlockHeight was not updated on start (#1673)
in submodules if no new blocks were received since previous shutdown.
This was breaking some sync logic e.g. for payment votes.
2017-10-09 21:25:24 +03:00
UdjinM6
d286198728 fix: The idea behind fDIP0001LockedInAtTip was to indicate that it WAS locked in, not that it IS locked in (#1666) 2017-10-04 22:35:09 +03:00
UdjinM6
d07ac4fbd3 fix: update DIP0001 related stuff even in IBD (#1652) 2017-09-22 04:54:14 +03:00
UdjinM6
7efa5e79d7 fix fallback fee (#1649) 2017-09-22 04:53:43 +03:00
UdjinM6
5f0da8aa71 fix sync (#1643) 2017-09-20 23:30:56 +03:00
Oleg Girko
753b1e486b Eliminate remaining uses of g_connman in Dash-specific code. (#1635)
This monstrous change eliminates all remaining uses of
g_connman global variable in Dash-specific code.

Unlike previous changes eliminating g_connman use
that were isolated to particular modules, this one covers
multiple modules simultaneously because they are so interdependent
that change in one module was quickly spreading to others.

This is mostly invariant change that was done by
* changing all functions using g_connman to use connman argument,
* changing all functions calling these functions to use connman argument,
* repeating previous step until there's nothing to change.

After multiple iterations, this process converged to final result,
producing code that is mostly equivalent to original one, but passing
CConnman instance through arguments instead of global variable.

The only exception to equivalence of resulting code is that I had to
create overload of CMasternodeMan::CheckAndRemove() method without arguments
that does nothing just for use in CFlatDB<CMasternodeMan>::Dump() and
CFlatDB<CMasternodeMan>::Load() methods.
Normal CMasternodeMan::CheckAndRemove() overload now has argument of
CConnman& type and is used everywhere else.

The normal overload has this code in the beginning:

    if(!masternodeSync.IsMasternodeListSynced()) return;

Masternode list is not synced yet when we load "mncache.dat" file,
and we save "mncache.dat" file on shutdown, so I presume that it's OK
to use overload that does nothing in both cases.

Signed-off-by: Oleg Girko <ol@infoserver.lv>
2017-09-19 17:51:38 +03:00
UdjinM6
8f850c60fa Lower tx fees 10x (#1632)
* Lower tx fees 10x

* add DEFAULT_DIP0001_*FEE constants
2017-09-17 19:00:44 +03:00
UdjinM6
e22453c902 fix fDIP0001* flags initialization (#1625) 2017-09-15 21:08:03 +03:00
UdjinM6
4f0618ae8a Fix sync issues (#1599)
- add `MASTERNODE_SYNC_WAITING` sync state/asset and initial timeout
- wait for block headers to be downloaded (new signal `AcceptedBlockHeader`)
- wait for blocks to reach best headers tip before switching to masternode list sync (new signal `NotifyHeaderTip`)
- switched sync from `UpdatedBlockTip` to a combination of `AcceptedBlockHeader` and `NotifyHeaderTip`
- all blockchain-related bumps should take place only while we are still syncing blockchain, should be no such bumps after that
2017-09-03 16:30:08 +03:00
UdjinM6
b5f7be6498 slightly refactor CDSNotificationInterface (#1581) 2017-08-29 02:51:33 +03:00
chaeplin
0fc13434b4 limit UpdatedBlockTip in IBD (#1570) 2017-08-11 21:51:24 +03:00
UdjinM6
105713c10a Sync overhaul (#1564)
* Change sync process:
- IsBlockchainSynced(): drop CheckNodeHeight() and all complicated code, use fInitialDownload in UpdatedBlockTip() to switch initial states
- ProcessTick(): detect sleep mode like it was in IsBlockchainSynced(), not by number of masternodes

* Changes for sync in governance:
- do not keep sync alive on ConfirmInventoryRequest()
- skip some governance actions until we are synced to some level

* do not run CMasternodeMan::UpdateLastPaid() until winners list is synced

* start syncing mn list on the same node right after requesting sporks

* replace nTimeLast<Asset> with the unified nTimeLastBumped, bump on UpdatedBlockTip

* fix comments and LogPrintf-s

* remove excessive MASTERNODE_SYNC_IBD

* a bit more descriptive BumpAssetLastTime in few cases
2017-08-09 19:07:03 +03:00
UdjinM6
87707c0127 fix CDSNotificationInterface::UpdatedBlockTip signature (#1562)
to match the one in CValidationInterface
2017-08-04 20:43:48 +03:00
UdjinM6
739ef9a681 Expire confirmed DSTXes after ~1h since confirmation (#1499)
* Expire confirmed DSTXes after ~1h since confirmation

* add missing cs_main lock
2017-07-10 17:42:09 +03:00
UdjinM6
7242e29228 Refactor PS (#1437)
* split CDarksendPool

* split DoAutomaticDenominating

* CMasternode* -> masternode_info_t

* move some globals into CPrivateSendClient

* addressed PR comments
2017-05-05 14:26:27 +03: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
Holger Schinzel
e1702cd4ec bump copyright notice to 2017 (#1207) 2016-12-20 17:26:45 +04:00
UdjinM6
342bda5fdc new PoSe - MNVERIFY (#1066) 2016-10-21 01:11:30 +04:00
Evan Duffield
6a68aea461 cleanup 2016-04-14 19:54:11 -07:00
UdjinM6
a611fc3b1b Introduce CDSNotificationInterface - validation interface to listen to tip updates and trigger updates in DS, payments and budgets. Should significantly reduce number of references to chainActive.Tip() i.e.we should have less cs_main in dash-darksend thread and potential deadlocks. 2016-03-04 12:10:37 +03:00