Commit Graph

10780 Commits

Author SHA1 Message Date
gladcow
f7ab6c469c M-of-N-like sporks (#2288)
* support set of keys to sign spork

* several addresses support in -sporkkey

* tests for multykey sporks

* command line option -minsporkkeys

* make spork active only after given number of signers

* use signature in spork hash calculation

* test for new and old spork messages interaction

* add multikeyspork.py to integration tests

* change test to have ability to distinguish default spork value

* require min spork keys number to be more than the half of the common spork keys number

* calc current spork value with majority of signers

* set test nodes time in integration test

* extract keyid from signed spork message directly

* change -sporkaddr option syntax to process several addresses

* codestyle fixes

* fix test comments

* codestyle fixes

* simplify CSporkManager::SporkValueIsActive

* Calc signature hash without signature field

* do not restore pubkey ids from cach

* Calc different keyids to check signature because not all sporks can be synced at moment

* codestyle fixes

* Fix CSporkManager::CheckAndRemove to use several keys

* codestyle fixes

* Correct processing of not actual spork6 value with GetSignerKeyID
2018-09-30 20:01:33 +03:00
Nathan Marley
a5aca049dd rename vars in mnsync to make more sense (#2308)
* rename vars in mnsync to make more sense

nRequestedMasternodeAssets -> nCurrentAsset
nRequestedMasternodeAttempt -> nPeerCount

* rename var to nTriedPeerCount
2018-09-30 14:02:52 +03:00
PastaPastaPasta
ee6a5a33b7 Gov cleanup + copyright bump (#2324)
* governance.* formatting and copyright bump

* manual changes gov.cpp

* clang and copyright bump

* gov-exc.h clang and copyright bump

* gov-obj.* clang and copyright bump

* gov-val.* clang and copyright bump

* gov-vote.* clang and copyright bump

* gov-votedb.* clang and copyright bump

* fix some weirdness

* Modernize ConvertVoteOutcome, ConvertSignalToString and  ConvertOutcomeToString

* add braces

* move breaks

* add braces instead of inlining

* Revert "Modernize ConvertVoteOutcome, ConvertSignalToString and  ConvertOutcomeToString"

This reverts commit 41bc3d3d86.

* drop unused function
2018-09-28 10:56:17 +03:00
UdjinM6
bd8c54d12e
A bit more verbosity for some critical errors (#2316) 2018-09-28 10:55:30 +03:00
UdjinM6
a4ff2a19a7
Fix some warnings and do a couple of other trivial cleanups (#2315)
* Fix various warnings

* A couple of trivial cleanups

* fix 2320
2018-09-28 10:55:11 +03: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
UdjinM6
547b81dd0d
log gobject prepare params (#2317) 2018-09-26 17:16:40 +03:00
UdjinM6
d932d2c4e1
Add instantlock field to getrawtransaction rpc output (#2314) 2018-09-26 17:16:22 +03:00
UdjinM6
c2958733e6
CSporkManager::Clear() should not alter sporkPubKeyID and sporkPrivKey (#2313) 2018-09-26 17:15:58 +03:00
UdjinM6
8c0dca2826
Add versioning to spork cache (#2312) 2018-09-26 17:15:02 +03:00
Nathan Marley
2c1a17909e cleanup: remove unused vars, includes, functions (#2306) 2018-09-20 15:41:16 +03:00
UdjinM6
85a958a360
Drop dummy copy constructors in CPrivateSend*Session (#2305)
* Switch vecSessions to deque and drop dummy copy constructors

* s/vec/deq/ for PS vecSessions/cs_vecsessions
2018-09-20 15:40:43 +03:00
PastaPastaPasta
3d48824b48 Update .clang-format to more accurately show the actual style (#2299)
* updated clang formatting

* add `BreakConstructorInitializers: AfterColon`

* revert column limit change

* AlignConsecutiveAssignments: true

* Revert "AlignConsecutiveAssignments: true"

This reverts commit fc4a4a54f7.
2018-09-20 15:40:00 +03:00
PastaPastaPasta
8ea40102c0 Remove leftover RBF code from BTC (#2297)
* Remove leftover RBF code from BTC

* remove rbf #include

* remove rbf in rpc-tests

* removes replace-by-fee.py

* remove help text related to rbf

* remove comment text relating to rbf

* remove "-mempoolreplacement" cli option

* Remove (effectively dead) RBF code which would never have been called anyway and some assosiated variables

* since `setConflicts` is always empty, this is dead code

* Since we don't have RBF, don't have to do this check. Also, since `setConflicts` is always empty this is dead code

* removes unneccesary if as it will always be true

* remove unused `set<uint256> setConflicts`

* Removes replacement of conflicting txs, as conflicting txs are never accepted

* removes RBF from `validForFeeEstimation`

* removes (probably) unnecessary lock

* remove replacing part of the AcceptToMemoryPool and AcceptToMemoryPoolWIthTime

* fixes err in ps.cpp, didn't remove arg

* RBF in net_processing.cpp

* remove arg in ps-server.cpp

* removes another arg in PS code

* removes rawtx.c AcceptToMemoryPool arg

* removes arg in txvalidationcache_tests.cpp

* remove extra args

* forgot an arg

* fix typo in 82898b0

* remove unused fEnableReplacement in validation.h

* remove the removal reason REPLACED in txmempool.h

* removed unused variable

* comment typo
2018-09-20 15:39:34 +03:00
UdjinM6
3cc4ac1376
Fix crash bug with duplicate inputs within a transaction (#2302)
* Fix crash bug with duplicate inputs within a transaction

Introduced by #9049

* Remove redundant parameter fCheckDuplicateInputs from CheckTransaction
2018-09-19 15:04:35 +03:00
UdjinM6
31759a44d6
Fix tx inv throughput (#2300)
Bumps 4x per 1MB due to 4x smaller block times and accounts for blocks >1MB as in https://reviews.bitcoinabc.org/rABC4ae37d54ba3db21609ef8b704ed7f4377b9cece7
2018-09-19 15:04:03 +03:00
UdjinM6
0471fa8847
Drop MAX_GOVERNANCE_OBJECT_DATA_SIZE (and maxgovobjdatasize in rpc) (#2298) 2018-09-19 15:03:30 +03:00
UdjinM6
76599aad3c
Drop (pre-)70208 compatibility code (#2295) 2018-09-15 13:19:31 +03:00
UdjinM6
c6a0c55417
A couple of small fixes for mixing collaterals (#2294)
* No reasons to create mixing collaterals if we can't create denoms to mix

* Include non-anonymizable inputs when trying to make mixing collaterals
2018-09-15 13:19:00 +03:00
UdjinM6
d192d642f6
Move heavy coin selection out of the loop in SubmitDenominate (#2274)
* extend CTxOut constructor

* Move heavy coin selection out of the loop in SubmitDenominate
2018-09-15 13:18:32 +03:00
Alexander Block
016681cd38 Add support for serialization of bitsets and tuples (#2293)
* Add serialization support for dynamic and fixed size bitsets

* Support serialization of std::tuple
2018-09-14 18:53:49 +03:00
Alexander Block
9d90b4fa47 Honor filterInventoryKnown for non-tx/non-block items (#2292) 2018-09-14 18:53:26 +03:00
Alexander Block
6adc236d0e Only use dataDir in CEvoDB when not in-memory (#2291) 2018-09-14 18:53:09 +03:00
Alexander Block
8a878bfcfd Call InitializeCurrentBlockTip and activeMasternodeManager->Init after importing has finished (#2286)
While importing, IsInitialBlockDownload always returns true, meaning that
the call to UpdatedBlockTip will also receive true as fInitialDownload.

UpdatedBlockTip is never called again unless a block is mined.
Mining of new blocks in regtest however only starts after mnsync has
finished, which will never happen as it waits for the next call to
UpdatedBlockTip.
2018-09-12 14:13:17 +03:00
Alexander Block
2a95dd30c5 Fix locking issues in DIP3 unit tests (#2285)
* Don't use GetTransaction in CheckProUpRegTx

GetTransaction locks mempool.cs internally. This brings messes up the locking
order of cs_main, mempool.cs and CCheckQueue::ControlMutex.

* Lock cs_main in TestChainSetup::CreateBlock when updating CbTx
2018-09-12 14:13:00 +03:00
PastaPastaPasta
1e74bcace9 [ZMQ] Notify when an IS double spend is attempted (#2262)
* Implement IS Double spend notifications in zmq

* copy/paste error

* typo

* Send both conflicting and conflicts against as ZMQ notifications

* CTransaction based not hash based

* @UdjinM6 requested changes
2018-09-12 14:12:44 +03:00
UdjinM6
28e0476f4c
Squash two logic branches in SubmitDenominate into one (#2270) 2018-09-11 21:33:06 +03:00
Alexander Block
6b3d650280 After DIP3 activation, allow voting with voting keys stored in your wallet (#2281)
* Implement temporary solution to allow voting with owner keys from your wallet

Will later be removed and properly reimplemented when cleaning up
legacy masternode code

* When MN keys from masternode.conf are used, only allow voting when they match with keyIDVoting
2018-09-11 17:33:07 +03:00
Alexander Block
47ca06ab33 DIP3 integration tests (#2280)
* Implement dip3 integration tests

This tests the full upgrade path from legacy MNs to deterministic MNs

* Invoke UpdatedBlockTip signal when invalidateblock RPC is called

Currently, UpdatedBlockTip would only be called if the invalidation resulted
in another chain becoming the longest one. This is inconsistent behavior
and was spotted when running dip3 integration tests.
2018-09-11 17:32:45 +03:00
UdjinM6
9b6eb4765f
Include inputs with max rounds in SelectCoinsDark/SelectCoinsByDenominations (#2277) 2018-09-11 17:32:18 +03:00
UdjinM6
55d7bb9009
Add an option to disable popups for PS mixing txes (#2272)
* Add an option to disable popups for PS mixing txes

* capital S
2018-09-11 17:31:46 +03:00
UdjinM6
38ccfef3be
Identify PS collateral payments in transaction list a bit more accurate (#2271)
This have to be updated due to new rules for PS collateral - we allow OP_RETURN outputs and "non-exact" inputs (1x<=X<2x) now.
2018-09-11 17:31:18 +03:00
UdjinM6
737353c84c
Fix IsBlockValueValid/IsOldBudgetBlockValueValid (#2276) 2018-09-10 17:12:32 +03:00
Alexander Block
c3d6b06518 Remove redundant check for unknown commands in masternode RPC (#2279) 2018-09-10 13:23:42 +03:00
Alexander Block
bc7924d418 Add unit tests for DIP3 and DIP4 2018-09-05 18:40:53 +02:00
Alexander Block
d653ace99e Update CbTx in TestChainSetup
We need to update the CbTx's merkle root for the masternode list here as
tests might add transactions into a block which cause the list to change.
2018-09-05 18:40:53 +02:00
Alexander Block
9674be8f96 Refactor TestChain100Setup to allow different test chain setups
Allows testing of features which depend on BIP9 deployments
2018-09-05 18:40:53 +02:00
UdjinM6
ad31dbbd73
Add more variance to coin selection in PS mixing (#2261)
* Lean towards "from high to low" branch but still mix via "from low to high" one someties

* Try to mix non-duplicate txids only

* Lean towards edges but still mix starting from the middle sometimes

If failed when started from the middle try mixing from the edges right away.

Note: liqudity providers always start from 0

* map -> set

* Refactor nRoundStart calculations
2018-09-05 19:35:33 +03:00
Alexander Block
cb37c39725 Bump PROTOCOL_VERSION to 70211, bump MIN_* protocols to 70210 (#2256)
Bump PROTOCOL_VERSION to 70211, bump MIN_* protocols to 70210
2018-09-05 19:34:56 +03:00
Alexander Block
d8247dfffa Use refactored payment logic when spork15 is active
Related to https://github.com/dashpay/dash/pull/2237
2018-09-05 14:06:50 +02:00
Alexander Block
60002b7ddb Payout and enforce operator reward payments 2018-09-05 14:06:50 +02:00
Alexander Block
2c481f0f86 Implement deterministic version of CMasternodePayments::IsScheduled
Needed for privatesend when choosing masternodes
2018-09-05 14:06:50 +02:00
Alexander Block
44706dc88a Implement projection of MN reward winners in "masternode winners" 2018-09-05 14:06:50 +02:00
Alexander Block
e6b699bc26 Enforce MN and superblock payments in same block
1. Enforce payment to masternodes in IsBlockPayeeValid even if superblocks
   are triggered. This new rule only gets activated when spork15 activates.

2. Always enforce masternode payments when spork15 is activated and ignore
   spork8 in that case. spork8 can be removed after spork15 activation
   and hardening of the spork15 height into consensus params.
2018-09-05 14:06:31 +02:00
Alexander Block
19fbf8ab76 Move cs_main lock from CMasternode::UpdateLastPaid to CMasternodeMan
Ensure correct locking order to fix deadlock.
2018-09-05 14:06:31 +02:00
Alexander Block
dc7292afa9 Implement new MN payments logic and add compatibility code 2018-09-05 14:06:31 +02:00
PastaPastaPasta
fded838c9d RPC folder: Cleaned up brackets on if, while, for, BOOST_FOREACH. Some whitespace fixes (#2257)
* Cleaned up brackets on if, while, for, BOOST_FOREACH. Some whitespace fixes

* gov, mn and mining cleanup

* Revert "Cleaned up brackets on if, while, for, BOOST_FOREACH. Some whitespace fixes"

This reverts commit 4a2a1b0645c5195025d0c7e6dad2e01a93efbfd6.

* Revert "gov, mn and mining cleanup"

This reverts commit 7cb91aabc67df0ab60db4ee84e3aaaf6cf6b7881.

* cleanup some dash specific

* "if(" -> "if ("     "for(" -> "for (" + corrected some else blocks
2018-09-05 15:04:24 +03:00
UdjinM6
8c9cb29092
Revert 2075 (#2259)
* Revert "Require all participants to submit equal number of inputs (#2075)"

This reverts commit 7ac4b972ab.

* Backward compatibility for nInputCount
2018-09-05 14:19:03 +03:00
UdjinM6
b164bcc7a5
Split PS into Manager and Session and allow running multiple mixing sessions in parallel (client side) (#2203)
* Split PS into Manager and Session

* Adjust log messages accordingly

* add -privatesendsessions cmd-line option

* address review comments

* bump MAX_OUTBOUND_MASTERNODE_CONNECTIONS to 30

+10 for parallel mixing

* protect vecSessions

* constructors

* Rewrite CMasternodeMan::ProcessMasternodeConnections() to use CPrivateSendClientManager::GetMixingMasternodesInfo().

This should solve potential deadlock cs_vecqueue vs cs_vNodes.

* Drop no longer used IsMixingMasternode()

* lock cs_wallet when mixing uses balance related functions
2018-09-04 13:54:59 +03:00
Alexander Block
d4530eb7d5 Put all masternodes in MASTERNODE_ENABLED state when spork15 is active 2018-09-03 13:31:40 +02:00