Commit Graph

72 Commits

Author SHA1 Message Date
UdjinM6
1e0cc1254c
Use single-threaded scheduler for IS, CL and Governance notifications (#3954)
* Use single-threaded scheduler for IS, CL and Governance notifications

* Pass shared_ptr-s instead of objects themselves for CL, IS and Governance notifiers in CMainSignals/CValidatibnInterface

* llmq: Create shared_ptr for clsig at the root of its lifetime

* llmq: Create shared_ptr for islock clsig at the root of its lifetime

* llmq: Create shared_ptr for recSig at the root of its lifetime

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-01-21 23:32:15 -05:00
UdjinM6
a7e0957c82
Create one PS manager per wallet 2020-07-20 10:10:43 -05:00
UdjinM6
167e0f402c
Split mixing options out of mixing manager 2020-07-20 10:10:14 -05:00
PastaPastaPasta
b463e5780e
Change litemode to disablegovernance (#3577)
* Change litemode to disablegovernance, this makes it more clear what that flag actually does.

Signed-off-by: pasta <pasta@dashboost.org>

* more fLiteMode to fDisableGovernance

Signed-off-by: pasta <pasta@dashboost.org>

* handle -litemode being set

Signed-off-by: pasta <pasta@dashboost.org>
2020-06-29 00:00:00 +03:00
PastaPastaPasta
5ea76e8649
Change litemode from disabling all Dash specific features to disabling governance validation (#3488)
* enable privatesend by default in litemode

Signed-off-by: Pasta <pasta@dashboost.org>

* remove useless litemode check in CPrivateSendServer::ProcessMessage, must be MN, so must have litemode off already

Signed-off-by: Pasta <pasta@dashboost.org>

* change litemode to mean, doesn't validate governance, but has all other dash features

Signed-off-by: Pasta <pasta@dashboost.org>

* litemode must be off for MNs cont

Signed-off-by: Pasta <pasta@dashboost.org>

* change litemode help text

Signed-off-by: Pasta <pasta@dashboost.org>

* don't skip MN sync in litemode

Signed-off-by: Pasta <pasta@dashboost.org>

* drop fLiteMode in bitcoingui.cpp

Signed-off-by: Pasta <pasta@dashboost.org>

* skip governance sync in litemode

Signed-off-by: pasta <pasta@dashboost.org>

* remove fLiteMode in walletview.cpp

Signed-off-by: pasta <pasta@dashboost.org>

* add back

Signed-off-by: pasta <pasta@dashboost.org>

* fix comments

* fix cache loading

* fix scheduled tasks

* Fix help text for some rpcs (revert what's left of 3478)

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-06-13 21:18:31 +03:00
Alexander Block
0fa2e14065
Fix issues introduced with asynchronous signal handling (#3369)
* Introduce SynchronousUpdatedBlockTip signal

This version of UpdatedBlockTip mirrors the asynchronous behavior that we
had before the introduction of asynchronous signal handling.

* Fix tab spacing in validationinterface.cpp

* Invoke CDeterministicMNManager::UpdatedBlockTip from validation thread

It must be invoked synchronously as otherwise things become inconsistent.

* Call CActiveMasternodeManager::Init with block index

pindexNew in UpdatedBlockTip is not necessarily the current tip, so we
shouldn't rely on it in Init(). This is due to the async nature of the
UpdatedBlockTip invocation.
2020-03-20 19:11:54 +03:00
PastaPastaPasta
8a1ec935a0
Backport 11651 (#3358)
* scripted-diff: Replace #include "" with #include <> (ryanofsky)

-BEGIN VERIFY SCRIPT-
for f in \
  src/*.cpp \
  src/*.h \
  src/bench/*.cpp \
  src/bench/*.h \
  src/compat/*.cpp \
  src/compat/*.h \
  src/consensus/*.cpp \
  src/consensus/*.h \
  src/crypto/*.cpp \
  src/crypto/*.h \
  src/crypto/ctaes/*.h \
  src/policy/*.cpp \
  src/policy/*.h \
  src/primitives/*.cpp \
  src/primitives/*.h \
  src/qt/*.cpp \
  src/qt/*.h \
  src/qt/test/*.cpp \
  src/qt/test/*.h \
  src/rpc/*.cpp \
  src/rpc/*.h \
  src/script/*.cpp \
  src/script/*.h \
  src/support/*.cpp \
  src/support/*.h \
  src/support/allocators/*.h \
  src/test/*.cpp \
  src/test/*.h \
  src/wallet/*.cpp \
  src/wallet/*.h \
  src/wallet/test/*.cpp \
  src/wallet/test/*.h \
  src/zmq/*.cpp \
  src/zmq/*.h
do
  base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f
done
-END VERIFY SCRIPT-

Signed-off-by: Pasta <pasta@dashboost.org>

* scripted-diff: Replace #include "" with #include <> (Dash Specific)

-BEGIN VERIFY SCRIPT-
for f in \
  src/bls/*.cpp \
  src/bls/*.h \
  src/evo/*.cpp \
  src/evo/*.h \
  src/governance/*.cpp \
  src/governance/*.h \
  src/llmq/*.cpp \
  src/llmq/*.h \
  src/masternode/*.cpp \
  src/masternode/*.h \
  src/privatesend/*.cpp \
  src/privatesend/*.h
do
  base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f
done
-END VERIFY SCRIPT-

Signed-off-by: Pasta <pasta@dashboost.org>

* build: Remove -I for everything but project root

Remove -I from build system for everything but the project root,
and built-in dependencies.

Signed-off-by: Pasta <pasta@dashboost.org>

# Conflicts:
#	src/Makefile.test.include

* qt: refactor: Use absolute include paths in .ui files

* qt: refactor: Changes to make include paths absolute

This makes all include paths in the GUI absolute.

Many changes are involved as every single source file in
src/qt/ assumes to be able to use relative includes.

Signed-off-by: Pasta <pasta@dashboost.org>

# Conflicts:
#	src/qt/dash.cpp
#	src/qt/optionsmodel.cpp
#	src/qt/test/rpcnestedtests.cpp

* test: refactor: Use absolute include paths for test data files

* Recommend #include<> syntax in developer notes

* refactor: Include obj/build.h instead of build.h

* END BACKPORT #11651 Remove trailing whitespace causing travis failure

* fix backport 11651

Signed-off-by: Pasta <pasta@dashboost.org>

* More of 11651

* fix blockchain.cpp

Signed-off-by: pasta <pasta@dashboost.org>

* Add missing "qt/" in includes

* Add missing "test/" in includes

* Fix trailing whitespaces

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
Co-authored-by: MeshCollider <dobsonsa68@gmail.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-03-20 01:46:56 +03:00
UdjinM6
b57901dfaa
Various fixes for DSTX-es (#3295)
* Check MNs up to 24 blocks deep when verifying `dstx`

* Handle DSTX-es more like regular txes and not like "other" invs

* Try asking for a DSTX too when trying to find missing tx parents

* Check DSTX-es when chainlock arrives

`HasChainLock` was always `false` in `IsExpired` because tip is updated before the corresponding chainlock is received

* Apply `Handle DSTX-es more like regular txes` idea to `AlreadyHave()`

* Alternative handling of DSTX+recentRejects

Co-authored-by: Alexander Block <ablock84@gmail.com>
2020-01-22 13:35:31 +03:00
UdjinM6
91a996e325
Make sure mempool txes are properly processed by CChainLocksHandler despite node restarts (#3226)
* Pass nAcceptTime via TransactionAddedToMempool and use it for ChainLocks

Otherwise the "first seen" time is way off after node restart

* Don't skip TransactionAddedToMempool for chainlocks while blockchain is not synced yet

Otherwise txes from mempool.dat won't be processed there
2019-12-07 13:56:17 +03:00
Pasta
1a0d52814e
#10483 scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL
-BEGIN VERIFY SCRIPT-
sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h
sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp
sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp
sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp
sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp
sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp
-END VERIFY SCRIPT-

Signed-off-by: Pasta <pasta@dashboost.org>
2019-08-12 09:07:03 -05:00
Alexander Block
2f21e55514 Remove legacy InstantSend code (#3020)
* Remove ppszTypeName from protocol.cpp and reimplement GetCommand

This removes the need to carefully maintain ppszTypeName, which required
correct order and also did not allow to permanently remove old message
types.

To get the command name for an INV type, GetCommandInternal uses a switch
which needs to be maintained from now on.

The way this is implemented also resembles the way it is implemented in
Bitcoin today, but it's not identical. The original PR that introduced the
switch case in Bitcoin was part of the Segwit changes and thus never got
backported. I decided to implement it in a slightly different way that
avoids throwing exceptions when an unknown INV type is encountered.

IsKnownType will now also leverage GetCommandInternal() to figure out if
the INV type is known locally. This has the side effect of old/legacy
message types to return false from now on. We will depend on this side
effect in later commits when we remove legacy InstantSend code.

* Stop handling/relaying legacy IX messages

When we receive an IX message, we simply treat it as a regular TX and relay
it as such.

We'll however still request IX messages when they are announced to us. We
can't simply revert to requesting TX messages in this case as it might
result in the other peer not answering due to the TX not being in mapRelay
yet. We should at some point in the future completely drop handling of IX
messages instead.

* Remove IsNewInstantSendEnabled() and only use IsInstantSendEnabled()

* Remove legacy InstantSend from GUI

* Remove InstantSend from Bitcoin/Dash URIs

* Remove legacy InstantSend from RPC commands

* Remove legacy InstantSend from wallet

* Remove legacy instantsend.h include

* Remove legacy InstantSend from validation code

* Completely remove remaining legacy InstantSend code

* Remove now unused spork

* Fix InstantSend related test failures

* Remove now obsolete auto IS tests

* Make spork2 and spork3 disabled by default

This should have no influence on mainnet as these sporks are actually set
there. This will however affect regtest, which shouldn't have LLMQ based
InstantSend enabled by default.

* Remove instantsend tests from dip3-deterministicmns.py

These were only testing legacy InstantSend

* Fix .QCheckBox#checkUsePrivateSend styling a bit

* s/TXLEGACYLOCKREQUEST/LEGACYTXLOCKREQUEST/

* Revert "verified via InstantSend" back to "verified via LLMQ based InstantSend"

* Use cmd == nullptr instead of !cmd

* Remove last parameter from AvailableCoins call

This was for fUseInstantSend which is not present anymore since rebase
2019-07-09 17:50:08 +03:00
UdjinM6
b75e1cebd3
Decouple lite mode and client-side PrivateSend (#2893)
* Decouple lite mode and client-side PrivateSend

`-enableprivatesend`:
1. off by default in lite mode but can be overridden
2. does not start mixing, use `-privatesendautostart` (default is off) or `privatesend` rpc instead

* Disable PS when there is no wallet, do not auto-start mixing when wallet is locked

* Check for `!fEnablePrivateSend` and `!fPrivateSendRunning` instead of `!pwalletMain` in ps client code

* Add meaningful `privatesend` rpc error messages for various cases when mmixing is disabled
2019-06-27 23:24:43 +03:00
UdjinM6
d28d318aad
Remove logic for handling objects and votes orphaned by not-yet-known MNs (#2954)
This should no longer happen now that we use deterministic masternode list.
2019-05-29 21:19:53 +03:00
UdjinM6
60a8a93578 Drop CDSNotificationInterface::SyncTransaction() 2019-05-28 11:59:55 +02:00
Alexander Block
8675a5064d Add TODO comment about need to remove compatibility code 2019-05-27 16:40:05 +02:00
Alexander Block
8df25bbfe4 Call and implemente new signals in CPrivateSend
Instead of relying on CDSNotificationInterface running compatibility code.
This also removes locking of cs_main, as this seemed to be not needed.
2019-05-27 16:40:05 +02:00
Alexander Block
d4e75abbfd Call new signals in CChainLocksHandler 2019-05-27 16:40:05 +02:00
Alexander Block
b36f0a324f Call new signals instead of SyncTransaction on CInstantSendManager
This commit moves all logic of SyncTransaction into ProcessNewTransaction
and then calls it from TransactionAddedToMempool and BlockConnected.

This won't compile/work at first, but the next commits will fix this.
2019-05-27 16:40:05 +02:00
Alexander Block
6afa605f6f Pass disconnected/deleted pindex instead of pprev into BlockDisconnected
CDSNotificationInterface::BlockDisconnected still calls SyncTransaction
with pprev to keep compatibility.
2019-05-27 16:40:05 +02:00
UdjinM6
250195185f
Adjust CDSNotificationInterface to align with CValidationInterface changes 2019-05-27 09:03:19 -05:00
UdjinM6
428f304506
Implement rawchainlocksig and rawtxlocksig (#2930)
* Pass is-lock into `CInstantSendManager::UpdateWalletTransaction()`

* Implement `rawtxlocksig` which pushes tx+islock

* Implement `rawchainlocksig` which pushes block+clsig

* fix log category
2019-05-23 12:13:58 +03:00
PastaPastaPasta
32aa229c7f Reorganize Dash Specific code into folders (#2753)
* rename instantx.* file to instantsend.*

* Reorganize Dash Specific code into folders

add to privatesend folder the header files

Signed-off-by: Pasta <Pasta@dash.org>

add "masternode" to imports

Signed-off-by: Pasta <Pasta@dash.org>

add "masternode" to imports

Signed-off-by: Pasta <Pasta@dash.org>

add "masternode" to imports pt 2

Signed-off-by: Pasta <Pasta@dash.org>
2019-05-21 15:26:15 +02:00
UdjinM6
8ffdcbf999
A bunch of mostly trivial tweaks/fixes (#2889)
* Trivial: vout->txout

* Re-use SetHexStr in few more places

* Tweak log output

* fix v13 release notes links

* Drop no longer used stuff

* Few more trivial fixes

* Adjust few rpc help strings

* Apply review suggestions
2019-04-30 15:48:21 +03:00
UdjinM6
03021fa53c
Harden DIP3 activation (#2881)
* Harden DIP3 activation height

Also drop all related but no longer used parts.

* Pass current block index to GetCommitmentsFromBlock

* Allow to change dip3 activation height for tests

And fix them.
2019-04-25 18:39:04 +03:00
Alexander Block
db781b32dc Pass oldList and diff instead of newList into NotifyMasternodeListChanged 2019-04-09 13:28:40 +02:00
UdjinM6
208406df71 Re-introduce nInstantSendKeepLock check for LLMQ-based IS when spork19 is OFF (#2829) 2019-04-05 05:55:30 +02:00
Alexander Block
b18f8cb77c
Implement MNAUTH and allow unlimited inbound MN connections (#2790)
* Sort evo/* source files in Makefile.am

* Keep track of proRegTxHash in CConnman::masternodeQuorumNodes map

We will later need the proRegTxHash

* Fix serialization of std::tuple with const rvalue elements

Having serialization and deserialization in the same specialized template
results in compilation failures due to the "if(for_read)" branch.

* Implement MNAUTH message

This allows masternodes to authenticate themself.

* Protect fresh incoming connections for a second from eviction

Give fresh connections some time to do the VERSION/VERACK handshake and
an optional MNAUTH when it's a masternode. When an MNAUTH happened, the
incoming connection is then forever protected against eviction.

If a timeout of 1 second occurs or the first message after VERACK is not
MNAUTH, the node is not protected anymore and becomes eligable for
eviction.

* Avoid connecting to masternodes if an incoming connection is from the same one

Now that incoming connections from MNs authenticate them self, we can avoid
connecting to the same MNs through intra-quorum connections.

* Apply review suggestions
2019-03-22 11:52:37 +01:00
Alexander Block
c3602372cc Implement retroactive IS locking of transactions first seen in blocks instead of mempool (#2770)
* Don't rely on UTXO set in CheckCanLock

The UTXO set only works for TXs in the mempool and won't work when we try
to retroactively lock unlocked TXs from blocks.

This is safe as ProcessTx is only called when a TX was accepted into the
mempool or connected in a block, which means that all input checks were
good.

* Rename RetryLockMempoolTxs to RetryLockTxs and let it retry connected TXs

* Instead of manually calling ProcessTx, let SyncTransaction handle all cases

SyncTransaction is called from AcceptToMemoryPool and when transactions got
connected in a block. So this is the time we want to run TXs through
ProcessTx. This also enables retroactive signing of TXs that were unknown
before a new block appeared.

* Test retroactive signing and safe TXs in LLMQ ChainLocks tests

* Also test for retroactive signing of chained TXs

* Honor lockedParentTx when looking for TXs to retry signing

* Stop scanning for TXs to retry after a depth of 6

* Generate 6 block to avoid retroactive signing overloading Travis

* Avoid retroactive signing

* Don't rely on NewPoWValidBlock and use SyncTransaction to build blockTxs

NewPoWValidBlock is not guaranteed to be called when blocks come in fast.
When a block is accepted in AcceptBlock, NewPoWValidBlock is only called
when the new block is a successor of the currently active tip. This is not
the case when after the first block a second block is accepted immediately
as the first block is not connected yet.

This might be a bug actually in the handling of NewPoWValidBlock, so we
might need to check/fix this later, but currently I prefer to not touch
that part.

Instead, we now use SyncTransaction to gather TXs for blockTxs. This works
because SyncTransaction is called for all transactions in a freshly
connected block in one go. The call also happens before UpdatedBlockTip is
called, so it's fine with the existing logic.

* Use tx.IsCoinBase() instead of checking index 0

Also check for empty vin.
2019-03-19 13:55:51 +03:00
Alexander Block
bd7edc8ae9 Track txids of new blocks and first-seen time of TXs in CChainLocksHandler 2019-03-07 21:15:09 +01:00
Alexander Block
83dbcc483f Implement CInstantSendManager and related P2P messages 2019-03-07 21:14:31 +01:00
Alexander Block
f6828b19b6
Merge pull request #2643 from codablock/pr_llmq_chainlocks
Implement LLMQ based ChainLocks
2019-01-29 15:59:05 +01:00
PastaPastaPasta
f123248f1c update copyright (#2648)
* update copyright

* Update copyright in configure.ac and COPYING
2019-01-29 15:53:14 +01:00
Alexander Block
29532ba196 Implement and enforce ChainLocks 2019-01-28 12:24:15 +01:00
Alexander Block
15c34ccbd8 Implement CQuorum and CQuorumManager 2019-01-15 15:47:24 +01:00
Alexander Block
6836f8c38b Implement LLMQ DKG 2019-01-09 12:16:12 +01:00
Alexander Block
0df3871d14 Remove dummy DKG 2019-01-09 12:16:11 +01:00
Alexander Block
d1910eaff4 Refactor remains of CMasternode/-Man into CMasternodeMeta/-Man (#2606)
* Split up remaining logic from CMasternodeMan into CMasternodeMetaMan and CMasternodeUtils

Also get rid of CMastermode and store remaining meta info
in CMasternodeMetaInfo

* Also allow non-const T in Serialize/Unserialize for shared_ptr

* Rename CActiveDeterministicMasternodeManager to CActiveMasternodeManager

* Fix nowallet compile in masternode-utils.cpp
2019-01-03 23:08:34 +03:00
Alexander Block
f95aae2b30 Remove all legacy/compatibility MN code (#2600)
* Remove CActiveLegacyMasternodeManager

* Remove sentinelping RPC

* Remove unused P2P messages and inv types

There are still places where these are used in the code. The next commits
will clean these up.

* Remove MNB/MNP/MNVERIFY related code from masternode(man).h/cpp

* Remove all legacy code regarding block MN payee voting

* Remove MASTERNODE_SYNC_LIST and MASTERNODE_SYNC_MNW states

Also replace all uses of IsMasternodeListSynced and IsWinnersListSynced
with IsBlockchainSynced.

* Remove unsupported masternode RPCs

* Remove UpdateLastPaid methods

* Remove duplicate deterministicmns.h include

* Remove masternode.conf support

* Remove legacy MN lists support from masternode list GUI

* Remove unnecessary AskForMN call

* Remove compatibility code in CPrivateSendQueue::GetSignatureHash

* Don't add locally calculated MN payee in case GetBlockTxOuts failed

This is not valid in DIP3 mode

* Remove check for IsDeterministicMNsSporkActive in "masternode status"

* Move CMasternode::IsValidNetAddr to CActiveDeterministicMasternodeManager

* Remove use of CMasternode::CheckCollateral in governance code

* Remove uses of MASTERNODE_SENTINEL_PING_MAX_SECONDS/MASTERNODE_SENTINEL_PING_MAX_SECONDS

* Remove support for "-masternodeprivkey"

* Remove pre-DIP3 vote cleanup

* Remove compatibility code for quorumModifierHash/masternodeProTxHash

* Remove check for invalid nBlockHeight in CMasternodePayments::GetBlockTxOuts

...and let it crash instead. We expect this method to be called with the
correct height now (after DIP3 was fully deployed).

* Remove ECDSA based Sign/CheckSignature from CGovernanceObject

Only masternodes sign governance objects, so there is no need for ECDSA
support here anymore.

* Always add superblock and MN reward payments into new block

* Always check block payees (except if fLiteMode==true)

* Always allow superblock and MN payees in same block

* Remove/Fix a few references to masternode.conf and related stuff

Also delete guide-startmany.md and masternode_conf.md

* Implement NotifyMasternodeListChanged signal and call governance maintenance

* Remove non-DIP3 code path from CMasternodeMan::Find

* Remove remaining unused code from CMasternode/CMasternodeMan

* Always load governance.dat on startup

* Mine an empty block instead of incrementing nHeight from chain tip in miner tests

This test is crashing otherwise in GetBlockTxOuts as it tries to access a
previous block that is not existing.

* Skip MN payments verification on historical blocks (pre-DIP3 blocks)

Even though DIP3 was active on BIP9 level, the spork was not active yet at
that point meaning that payments were not enforced at that time.

* Remove unused state and CollateralStatus enums

* Unconditionally return false from IsBlockPayeeValid when IsTransactionValid returns false

IsTransactionValid already handles the case where IsDIP3Active() returns
false, making it return true.

* Add override keyword to CDSNotificationInterface::NotifyMasternodeListChanged

* Fix help for masternodelist status (POSE_BANNED and no OUTPOINT_SPENT)
2019-01-03 12:17:43 +03:00
Alexander Block
a4f5ba38b6
Implement CDummyDKG and CDummyCommitment until we have the real DKG merged (#2492)
* Add SPORK_17_QUORUM_DKG_ENABLED spork

* Implement CDummyDKG and CDummyCommitment until we have the real DKG merged

This is only used on testnet/devnet/regtest and will NEVER be used on
mainnet. It is NOT SECURE AT ALL!

See comment in quorums_dummydkg.h for more details.

* Test simple PoSe in DIP3 tests

* Generate 2 instead of 4 blocks per iteration in PoSe tests

4 was based on old chainparams where I used larger phases.

* Only sleep when necessary in PoSe tests

* Fix typo in comment

* Give PoSe tests more time and sync after fast-forward
2018-11-26 16:53:20 +01:00
Alexander Block
28a6007a40 Prepare DIP3 for testnet and reuse DIP3 deployment for autoix deployment (#2389)
* Add BIP9 parameters for DIP3 deployment on testnet

* Remove autoix BIP9 deployment and reuse DIP3 deployment

* Add BIP9CheckMasternodesUpgraded to chain params

This controls if miners should check for upgraded masternodes first before
adding BIP9 bits to the block version. This only makes sense in network
where masternodes are up and running before BIP9 activation, which is not
necessarely the case in regtest and devnet.

Also refactor ComputeBlockVersion to use fCheckMasternodesUpgraded instead
of the inverse fAssumeMasternodeIsUpgraded. It is set to false by default
and only set to true in CreateNewBlock.

* Check for upgraded masternodes for DIP3 activation (only mainnet and testnet)

* Bump PROTOCOL_VERSION and DMN_PROTO_VERSION

We probably have nodes with 70211 already running on testnet.
2018-10-26 19:42:52 +03:00
Alexander Block
733cd95123
Remove global fDIP0003ActiveAtTip and fix wrong use of VersionBitsState in auto IX (#2380)
* Remove global fDIP0003ActiveAtTip flag and always use VersionBitsState

fDIP0003ActiveAtTip was used much more often when introduced but turned out
to be not very useful in most places. Always use VersionBitsState now.

* Fix wrong use of VersionBitsState auto IX

* Make sure isAutoLockBip9Active flag is reset in case of chain reorgs
2018-10-26 07:03:33 +02:00
Alexander Block
3c9237aa40
Use VersionBitsState instead of VersionBitsTipState to avoid cs_main lock (#2370)
It wasn't even locked, which causes AssertLockHeld to fail.
2018-10-24 13:31:22 +02:00
gladcow
5454bea377 Automatic InstantSend locks for "simple" transactions (#2140)
* add locktransaction rpc call

* Remove special instantsend fee for simple transactions

* Function to check if trx is simple enough to be autolocked

* Automatic lock for all received from peers simple trxes

If we get a new transaction with CInv message and it is "simple" and
is accepted in mempool, we initiate its lock. We don't lock orphan trxes
that accepted in mempool after this trx because they are locked by other
peers.

* Automatically lock simple trxes in wallet

* protocol bump for InstantSend without special fee

* Add function to detect used mempool share

* Mempool threshold for auto IX locks

* Add SPORK_16_INSTANTSEND_AUTOLOCKS spork

* Make autolocks active only when spork SPORK_16_INSTANTSEND_AUTOLOCKS is active

* BIP9 autolocks activation

* revert increasing min peer protocol version for mn rank

* move IsTrxSimple check to CTxLockRequest class

* make MAX_INPUTS_FOR_AUTO_IX private member of CTxLockRequest class

* make AUTO_IX_MEMPOOL_THRESHOLD private member of CInstantSend class

* remove locktransaction RPC call

* tests for automatic IS locks

* fix mempool threshod calculation

* bump mocktime in activate_autoix_bip9

* set node times

* no need to spam the node with gettransaction rpc requests that often

* use `spork active` instead of leaking spork logic into tests

* codestyle fixes

* add test description in comments

* fix typo

* sync test nodes more often during BIP9 activation

* Use 4th bit in BIP9 activation

* Fix comments according codestyle guide

* Call AcceptLockRequest and Vote at the first node creating autoix lock

* fix mempool used memory calculation

* rallback not necessary change in CWallet::CreateTransaction

* test for stopping autolocks for full mempool

* Inject "simple autolockable" txes into txlockrequest logic
2018-09-26 17:17:47 +03:00
Alexander Block
9e8a867149 Implementation of deterministic MNs list 2018-08-30 19:47:48 +02:00
Alexander Block
d20100ecd4 DIP0003 deployment 2018-08-29 11:36:14 +02:00
UdjinM6
72a225b9bf
Few fixes for lite mode (#2014)
* Allow disabling txindex in lite mode

* Do not load/store Dash-specific cache in lite mode

* Do not create/show masternode tab in lite mode

* Do not connect PS actions in lite mode

* Fix sync/ignore block updates in Dash submodules in lite mode
2018-03-29 18:08:00 +03:00
UdjinM6
4ffa7bac02
Introduce DIP0001Height (#1973)
Block height at which DIP0001 becomes active

Also drop fDIP0001WasLockedIn
2018-03-08 15:18:24 +03:00
Alexander Block
e3da73ebf8 Update Dash related code to use new SyncTransaction notifications interface 2018-01-08 18:41:06 +01:00
Wladimir J. van der Laan
8874b2e0fd Merge #6480: include the chaintip blockindex in the SyncTransaction signal, add signal UpdateTip()
7d0bf0b include the chaintip *blockIndex in the SyncTransaction signal (Jonas Schnelli)
2017-12-11 08:30:26 +01:00
UdjinM6
3028af19f1
post-DIP0001 cleanup (#1763)
* post-DIP0001 cleanup

also fixes tests

* bump nMinimumChainWork and defaultAssumeValid
2017-12-07 12:43:23 +03:00