Commit Graph

14926 Commits

Author SHA1 Message Date
Alexander Block
19ea1a7918 Use operator[] instead of emplace in CMasternodePayments::AddPaymentVote (#1980)
Found this when running dip3 integration tests. Votes stopped being
propagated.

When NetMsgType::MASTERNODEPAYMENTVOTE is handled, the payment vote is
already added to mapMasternodePaymentVotes and then marked as not verified.

When AddPaymentVote is then called shortly after that, the emplace does not
update the already added vote.

The real problem here is actually something different. AddPaymentVote is
named badly (should be more like AddOrUpdatePaymentVote) which resulted in
the non-obvious error while refactoring this code (who could have known
that we rely on that side effect?). So I renamed that method as well now.
2018-03-10 15:35:27 +03:00
UdjinM6
7d5223b5e4
Network-specific thresholds for required confirmations (IS) (#1962) 2018-03-10 15:35:09 +03:00
UdjinM6
6536003528
Draw text on top of everything else in TrafficGraphWidget (#1944) 2018-03-10 15:34:50 +03:00
UdjinM6
ca3655f494
Fix some (potential dead)locks (#1977)
* Avoid locking cs_main in CMasternode/Ping/Broadcast

Deligate this to CMasternodeMan and use AssertLockHeld instead

* Ensure consistent locking order (cs_main, cs_wallet, mempool.cs, cs_instantsend) in CInstantSend while avoiding potential deadlocks at the same time

* Add missing locks in wallet

* Add missing locks in governance

* Fix cs_vPendingMasternodes vs cs_main potential deadlock

SendVerifyRequest no longer opens connection directly, so no cs_main is needed here
2018-03-09 17:15:48 +03:00
Alexander Block
2a7e6861d2 Include "clientversion.h" in rpc/masternode.cpp (#1979)
Otherwise it fails to compile when the wallet is disabled at compile time
2018-03-09 15:41:51 +03:00
Alexander Block
ef1a86c3e1 Add dummy CMakeLists.txt file to make development with CLion easier (#1978) 2018-03-09 15:41:28 +03:00
UdjinM6
d115efacb8
[RPC] Few additions to masternodelist (#1971)
* RPC: Add `masternodelist daemon`

* RPC: Add `masternodelist json` and make it default

* RPC: Add `masternodelist sentinel`
2018-03-08 15:22:13 +03:00
crowning-
a9d8e2c5dd [Init] Avoid segfault when called with -enableinstantsend=0 (#1976) 2018-03-08 15:19:25 +03:00
Alexander Block
3200eae9b1 Don't use short version of 'tinyformat/fmt' namespace in util.h (#1975)
* Don't use short version of 'tinyformat/fmt' namespace in util.h

Clion is not able to parse this correctly and messes up all the syntax
checks, marking large parts of C++ files as syntactically invalid, making
it hard to find real syntax errors without trying compilation.

* Also use full namespace name for strprintf in tinyformat.h
2018-03-08 15:18:51 +03:00
UdjinM6
97a07cbc4c
Refactor CMasternodePayment* (#1974)
* Refactor CMasternodePayment*: avoid using `count` and `[]`

Use iterators instead

* Refactor CMasternodePayment*: mark functions as const, pass references, adjust arg name

* Refactor/rename CMasternodePayments::CanVote()

* Refactor CMasternodePayment*: minor trivial changes

* Refactor CMasternodePayment*: reduce number of calls to GetHash()
2018-03-08 15:18:38 +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
UdjinM6
9451782a04
RPC: Add listaddressbalances (#1972) 2018-03-08 15:18:06 +03:00
crowning-
118eeded6d [GUI] Create QR-code for Masternode private key (#1970) 2018-03-08 15:17:34 +03:00
UdjinM6
9ef38c6d73
Switch CNetFulfilledRequestManager and CMasternodeMan maps/funcs to CService (#1967)
* Switch CNetFulfilledRequestManager and CMasternodeMan maps/funcs to CService

This is to make them work correctly on regtest.
We make sure that behaviour on other networks is not affected though.

* Add fAllowMultiplePorts to chainparams

Tweak either we should allow nodes with the same address and multiple ports or not for this specific chain
2018-03-08 15:16:52 +03:00
UdjinM6
929c1584ac
Rename CheckPreviousBlockVotes to CheckBlockVotes and adjust its log output a bit (#1965) 2018-03-05 15:27:05 +03:00
Alexander Block
611879aa6d Use spork addresses instead of raw keys and allow changing them on startup (#1969)
* Support passing CKeyID to CMessageSigner/CHashSigner

* Use Dash addresses instead of raw public keys for sporks

The spork addresses are identical to the previously used public keys.

Also use CKeyID/CKey directly inside CSporkManager instead of parsing the
addresses/keys over and over. The default spork key (from chainparams) is
initialized with InitDefaultSporkAddress(). SetPrivKey parses the private
key now and stores it in sporkPrivKey instead of parsing it in
CSporkMessage::Sign().

* Allow setting of spork address via command line

* Remove unused strMasternodePaymentsPubKey chainparam

Traces from the past...

* Review fixes

1. Remove the need for InitDefaultSporkAddress
2. Remove bogus checks for hex private keys
3. Alphabetical order for new include
4. Add . to help string

* Add regtest spork key

As this key is not meant to be private, the private key is also added in
the form of a comment (for later use in regtests)

* Review fixes
2018-03-02 16:15:04 +03:00
UdjinM6
d2c46a6a32
Update protocol-documentation.md (#1964)
* Update protocol-documentation.md

* typo
2018-03-02 16:13:47 +03:00
UdjinM6
bf0854e58e
Swap expired and sentinel_expired states in order (#1961)
State switching should correlate with spork14 and CMasternode::IsValidForPayment() a bit better now
2018-03-02 16:13:31 +03:00
Alexander Block
9876207ce2 Multiple devnet fixes (#1960)
* Add missing help string for -devnet

* Remove testnet seeds from devnet

* Activate BIP34/65/66 at height 2 instead of 1

Height 1 is the genesis block and not the devnet genesis block. The genesis
block is still at version 1, resulting in re-indexing to fail.
2018-03-02 16:12:31 +03:00
UdjinM6
bab543f3e6
Various RPC fixes (#1958)
* RPC: fix listunspent include_unsafe param usage

* RPC: Add two fields to indicate if some mempool entry is an InstantSend tx and if it was locked or not

* RPC: Add privatesend_balance to getwalletinfo rpc

* RPC: "BTC" -> CURRENCY_UNIT

* RPC: more EnsureWalletIsAvailable in Dash-specific code

* RPC: EnsureWalletIsUnlocked in `gobject prepare`

Also fixes missing cs_wallet lock

* RPC: disable `privatesend` rpc on masternodes completely

* RPC: refactor `spork` rpc

* RPC: Show correct port in HelpExampleRpc

* RPC: few trivial fixes

* fix
2018-03-01 16:18:46 +03:00
Nathan Marley
b0868093b0 simplify gobject JSON format, remove unused fields (#1902)
* simplify gobject JSON format, remove unused fields

This allows gobject format to change from (for example):

```
[
    [
        "proposal",
        {"object": "data-here"}
    ]
]
```

... to simply:

```
{"object": "data-here"}
```

The outer array isn't needed, and the first value in the 2-item tuple is
likewise discarded by DashCore. This change should allow either data
format to exist (we can deprecate/remove the older format later) and
remove the array of different type elements (string, object).

* validator test for legacy and new proposal formats
2018-02-28 02:20:16 +03:00
UdjinM6
1dda9fe6f2
CProposalValidator refactoring and follow up fixes (#1956)
* Refactor CProposalValidator

- fix names
- MAX_NAME_SIZE instead of magic value
- move most functions to private, test actual usage (constructor and Validate), not every single function
- do not store hex string (there is no reason to do so anymore)
- remove (now) unused functions

* Make sure payment_address has no whitespaces

* Fix governance_validators_tests

* Don't allow whitespaces, drop StripWhitespaces and add corresponding tests

* Show validator internal errors on check failure
2018-02-27 16:39:48 +03:00
Alexander Block
e37b6c7dab Fix BIP147 deployment threshold parameter (#1955)
It should be 50 and not 59
2018-02-27 16:39:34 +03:00
UdjinM6
106276a3e2
Adjust/fix log output (#1954)
* fix typo in debug message

* log: specify MN

* log: fix class::func

* log: format log2_work

* log: other minor adjustments
2018-02-26 14:10:20 +03:00
UdjinM6
2c04504f1c
Refactor IS votes processing (#1951)
Also make sure orphans are actually processed
2018-02-25 08:33:40 +03:00
UdjinM6
89380b4c92
Drop watchdogs, replace them with sentinel pings (#1949)
* Drop watchdogs, replace them with sentinel pings

* Address review comments

* revert `()`
2018-02-25 08:33:27 +03:00
UdjinM6
ef9a9f2d67
Fix unlocking error on "Start Mixing" (#1941)
* Fix unlocking error on "Start Mixing"

Instead warn that wallet is fully unlocked etc.

* Revert "Fix unlocking error on "Start Mixing""

This reverts commit 4951e58f66676afa02b3ed611bd8e9e6355f93f0.

* Drop mixingOnlyCheckBox and determine the correct unlock path automatically via provided mode
2018-02-22 12:00:50 +03:00
UdjinM6
0153c4c5e8
Merge pull request #1948 from UdjinM6/removeusingnamespacestd
Remove `using namespace std`
2018-02-22 10:41:52 +03:00
thephez
151152b98b rpc - Update getaddednodeinfo help to remove dummy argument (#1947) 2018-02-22 10:41:08 +03:00
UdjinM6
a4b313fd3d Fix std in DBG macro 2018-02-21 23:24:28 +03:00
UdjinM6
6a6e4cdc1b Remove remaining using namespace std 2018-02-21 22:32:13 +03:00
Wladimir J. van der Laan
08b5c69eff Merge #9643: [refactor] Remove using namespace <xxx> from wallet/ & util*
a57845c Refactor: Remove using namespace <xxx> from util* (Karl-Johan Alm)
8a52281 Refactor: Remove using namespace <xxx> from wallet/ (Karl-Johan Alm)

Tree-SHA512: cd06b569fee0ce25db753ade5ee694b582733a8883bfd62a27613020266d2a902af079ef23b58a5412f7af4afd7681e689af3c7780e5ea00c77b16d144d72db5
2018-02-21 22:32:13 +03:00
Wladimir J. van der Laan
ccca7af09e Merge #9476: [refactor] Remove using namespace <xxx> from rpc/ & script/ sources
8cbfc4e Refactor: Remove using namespace <xxx> from script/ (Karl-Johan Alm)
f3c264e Refactor: Remove using namespace <xxx> from rpc/ (Karl-Johan Alm)

Tree-SHA512: 407e80eeda0b8e1df22c5fcba33572e117542fde83c67357f6c2d98fa60bcc7b21bb88ad9a1ee59062fbec17fadaa4836b69e8e6d18188b4027b794357634467
2018-02-21 22:32:13 +03:00
UdjinM6
e71cb3861d
Store CGovernanceVote hash in memory instead of recalculating it via GetHash() every time (#1946)
* Store CGovernanceVote hash in memory instead of recalculating it via GetHash() every time

* Rename GetVoteDataStream to SerializeVoteToStream
2018-02-21 19:35:37 +03:00
Alexander Block
0abd1894ee Call CheckMnbAndUpdateMasternodeList when starting MN (#1945)
* Call CheckMnbAndUpdateMasternodeList when when starting MN

Otherwise the invoking node won't have nCollateralMinConfBlockHash
updated correctly, resulting in the MN showing up in the wrong position
when masternode ranks are calculated.

* Remove UpdateMasternodeList and remaining uses of it
2018-02-21 19:32:51 +03:00
UdjinM6
e23f61822d
Make TrafficGraphDataTests more general (#1943) 2018-02-21 19:32:35 +03:00
UdjinM6
43671a39df
Deprecate nMnCount in mnget (#1942) 2018-02-21 19:32:21 +03:00
UdjinM6
5b1c4d8a11
Few (mostly trivial) cleanups and fixes (#1940)
* Drop nBudgetProposalEstablishingTime

* Refactor: replace `== COutPoint()` with `.IsNull()`

* Refactor: add `operator bool()` to CMasternodePing

* Refactor: actually use `operator bool()` for CPendingDsaRequest

* Refactor: fixing code style in TrafficGraphData

* Fix some comments and whitespaces

* Drop CGovernanceVote::GetTypeHash()

* Drop legacy X11 code

No longer used... if it ever was used at all.

* Move `<boost/foreach.hpp>` out of coins.h

* Simplify CMasternodeBlockPayees::GetRequiredPaymentsString()

Also less of boost::lexical_cast

* Drop CTxDSIn::nSentTimes

* Fix few warnings

* fix warning (timer)

* fix nit
2018-02-21 19:32:08 +03:00
thephez
4db8483d4e [Docs] Doxyfile Project version update (#1938) 2018-02-21 19:31:47 +03:00
UdjinM6
99273f63aa
Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (#1937)
* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (gobject)

* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (gobjvote)

* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (mnw)

* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (txlvote)

* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (dsq)

* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (dstx)

* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (spork)

* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (mnb)

* Actually care about old signature format in mnp, otherwise we can start banning peers rather quickly

* Use SPORK_6_NEW_SIGS to switch from signing string messages to hashes (mnv)

* Unify sign/verify code a bit by using GetSignatureHash() (even when it matches GetHash())

* fix docs

* address review comments

* fix log output (copy/paste error)

* Replace custom GetSignatureHash/GetHash with serialization (where applicable)

* Convert from/to old format in SerializationOp only for p2p

* fix
2018-02-16 17:54:53 +03:00
UdjinM6
451f7f0710
Fix issues with mnp, mnw and dsq signatures via new spork (SPORK_6_NEW_SIGS) (#1936)
* Use new spork SPORK_6_NEW_SIGS to fix masternode payment vote signature format

* Use SPORK_6_NEW_SIGS to also fix masternode ping signature format

* Use SPORK_6_NEW_SIGS to also fix privatesend queue signature format

* adjust spork6 description in docs

* mnp hashing/signing changed - hash everything and use SignHash/VerifyHash directly instead of constructing a string to sign (both activate via SPORK_6_NEW_SIGS)

* fix

* cleanup
2018-02-15 17:44:22 +03:00
UdjinM6
0480626410
Force masternodes to have listen=1 and maxconnections to be at least DEFAULT_MAX_PEER_CONNECTIONS (#1935) 2018-02-15 17:43:32 +03:00
UdjinM6
aadec37354
Change format of gobject, store/transmit vchData instead of hex-encoded string of a string (#1934)
* Change format of gobject, store/transmit vchData instead of hex-encoded string

* fix (limited string for old format)
2018-02-15 17:43:17 +03:00
UdjinM6
c656133502
Switch masternode id in Dash data structures from CTxIn to COutPoint (#1933)
* Switch masternode id in Dash data structures from CTxIn to COutPoint (including p2p level)

* outpoint -> masternodeOutpoint in DSEG
2018-02-15 10:29:44 +03:00
UdjinM6
0bd8c8e43a
Refactor: vecTxIn -> vecOutPoints for CompactTallyItem (#1932) 2018-02-15 10:29:31 +03:00
gladcow
2ea6f7d82e Use override keyword for overriden class member functions (#1644)
* Use `override` keyword for all overriden functions

* more override
2018-02-15 10:29:15 +03:00
UdjinM6
580c4884c1
Fix trigger execution and expiration (#1920)
* Move trigger expiration logic into CSuperblock and handle executed/non-executed triggers differently

* Actually execute triggers
2018-02-12 21:35:10 +03:00
UdjinM6
ed712eb819
Fix nDelayGetHeadersTime (int64_t max == never delay) (#1916)
* Fix nDelayGetHeadersTime (int64_t max == never delay)

* Rewrite conditions in a more natural way i.e. (now - last_best > threshold)
2018-02-12 21:34:53 +03:00
UdjinM6
f35b5979a7
Refactor CGovernanceManager::Sync (split in two) (#1930) 2018-02-12 15:49:28 +03:00
UdjinM6
b5046d59c5
Dseg fixes (#1929)
* Do not filter non-upgraded mns in DSEG

Reverts #1373, we need non-upgraded MNs to verify their old govvotes

* Split mn list/single vin logic for DSEG

This should prevent looping till the end of the list if we were asked for a single mn and a) we have it but some following `if` has failed or b) we don't have it. It also should be a bit easier to follow the logic this way.
2018-02-12 15:49:15 +03:00