Commit Graph

12157 Commits

Author SHA1 Message Date
Wladimir J. van der Laan
e5e3572e9d Merge #13946: p2p: Clarify control flow in ProcessMessage
fa6c3dea420b6c50c164ccc34f4e9e8a7d9a8022 p2p: Clarify control flow in ProcessMessage() (MarcoFalke)

Pull request description:

  `ProcessMessage` is effectively a massive switch case construct. In the past there were attempts to clarify the control flow in `ProcessMessage()` by moving each case into a separate static function (see #9608). It was closed because it wasn't clear if moving each case into a function was the right approach.
  Though, we can quasi treat each case as a function by adding a return statement to each case. (Can be seen as a continuation of bugfix #13162)

  This patch does exactly that.

  Also note that this patch is a subset of previous approaches such as #9608 and #10145.

  Review suggestion: `git diff HEAD~ --function-context`

Tree-SHA512: 91f6106840de2f29bb4f10d27bae0616b03a91126e6c6013479e1dd79bee53f22a78902b631fe85517dd5dc0fa7239939b4fefc231851a13c819458559f6c201
2020-02-03 13:04:00 +03:00
UdjinM6
39d124ddb1 Fix CActiveMasternodeManager::GetLocalAddress to prefer IPv4 if multiple local addresses are known (#3304)
* Fix CActiveMasternodeManager::GetLocalAddress to prefer IPv4 if multiple local addresses are known

* Make sure LookupHost succeeded
2020-01-24 17:13:25 +03:00
UdjinM6
8b143ddee9 Drop unused invSet in CDKGSession (#3303) 2020-01-24 17:13:25 +03:00
UdjinM6
87e54c80fe Update translations 2020-01-23 (#3302)
100%: es, ko
97%+: ro, zh_TW
2020-01-24 17:13:25 +03:00
UdjinM6
a8213cadb9 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-23 00:22:50 +03:00
Alexander Block
1d9adbe639 Replace generic CScopedDBTransaction with specialized CEvoDBScopedCommitter (#3292)
This has the wanted side effect of proper locking of "cs" inside
CommitCurTransaction and RollbackCurTransaction, which was not easily
possible to implement in the generic version. This fixes some rare crashes.
2020-01-17 16:02:03 +01:00
UdjinM6
8fd486c6bc Translations 2020-01 (#3192)
* en

* ru

* 100%: bg, de, fi, fr, it, nl, pt, sk, vi, zh_CN

* 90%+: ar, es, ja, ko, pl, ro, th, tr, zh_TW

* drop sv

It looks like it was abandoned, dropped below 80% threshold (73.3% atm)
2020-01-17 16:01:41 +01:00
UdjinM6
3c54f65278 Bump copyright year to 2020 (#3290)
* Bump _COPYRIGHT_YEAR

* Run copyright update script

./contrib/devtools/copyright_header.py update .

* Update COPYING

* Bump copyright year in dash-cli/qt/tx and dashd map pages
2020-01-17 15:51:08 +01:00
UdjinM6
e875d4925a Define defaultTheme and darkThemePrefix as constants and use them instead of plain strings (#3288) 2020-01-17 15:42:03 +01:00
UdjinM6
1d203b422c Bump PROTOCOL_VERSION to 70216 (#3287)
We removed "alert" p2p message and changed "mempool" message behaviour a bit. It probably makes sense to bump PROTOCOL_VERSION now. This should also help to distinguish v0.15 nodes from late v0.14.0.x ones.
2020-01-17 15:41:43 +01:00
UdjinM6
b84482ac57 Let regtest have its own qt settings (#3286)
Also, avoid messing up testnet settings while playing in regtest
2020-01-17 15:41:25 +01:00
UdjinM6
1c885bbedf Only load valid themes, fallback to "Light" theme otherwise (#3285)
* Only load valid themes, fallback to "light" otherwise

* Refactor PR3285 a bit

* fix

Co-authored-by: Nathan Marley <nathan.marley@gmail.com>
2020-01-17 15:41:10 +01:00
Alexander Block
ce924278df Don't load caches when blocks/chainstate was deleted and also delete old caches (#3280)
* Don't load caches when blocks/chainstate was not present

* Delete old cache files when we decided to not load them

* Make sure cache files are of the exact format we expected them to be, flush empty objects into them instead of deleting files naively

* Streamline logic a bit, rename fIgnoreCacheFiles to fLoadCacheFiles

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-01-10 13:30:56 +03:00
Alexander Block
ebf529e8aa Drop new connection instead of old one when duplicate MNAUTH is received (#3272) 2020-01-10 13:30:47 +03:00
UdjinM6
817cd9a177 AppInitMain should quit early and return false if shutdown was requested at some point (#3267)
This fixes crashes e.g. when user decided to shutdown while rescanning the wallet
2020-01-10 13:30:37 +03:00
UdjinM6
42e104932d Tweak few more strings re mixing and balances (#3265)
* Tweak few more strings re mixing and balances

* "Fully mixed"/"mixed" -> "PrivateSend"

* Apply suggestions from code review

Co-Authored-By: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2020-01-10 13:30:18 +03:00
Alexander Block
6e50a7b2a1 Fix params.size() check in "protx list wallet" RPC (#3259)
This should have been "> 4" as otherwise it bails out when the height is
specified.
2020-01-10 13:29:41 +03:00
Alexander Block
31afa9c0fc Don't disconnect masternode connections when we have less then the desired amount of outbound nodes (#3255) 2020-01-10 13:29:11 +03:00
PastaPastaPasta
cecbbab3cd move privatesend rpc methods from rpc/masternode.cpp to new rpc/privatesend.cpp (#3253)
* move privatesend rpc methods from masternode.cpp to new privatesend.cpp

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

* add ifdef ENABLE_WALLET check for wallet.h import

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

* actually register privatesend rpc

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

* add dropped help text and change some weird spacing below

Signed-off-by: Pasta <pasta@dashboost.org>
2020-01-10 13:29:00 +03:00
UdjinM6
8e054f3742 Sync mempool from other nodes on start (#3251)
* Sync mempool from other nodes on start

* Add `-syncmempool` cmd-line option to be able to disable mempool sync if needed

* Only sync mempool with outbound peers

Co-authored-by: Alexander Block <ablock84@gmail.com>
2020-01-10 13:28:42 +03:00
UdjinM6
474f25b8dc Push islock invs when syncing mempool (#3250)
* Push islock invs when syncing mempool

* Send islock invs right away instead of stacking them for later
2020-01-10 13:28:32 +03:00
UdjinM6
3b0f8ff8b3 Skip mnsync restrictions for whitelisted and manually added nodes (#3249) 2020-01-10 13:28:22 +03:00
UdjinM6
fd94e9c38c Streamline, refactor and unify PS checks for mixing entries and final txes (#3246)
* Move PS mixing entry verification on masternodes into `AddEntry()`

Also streamline logic a bit and drop unused/excessive parts.

* Unify PS checks among masternodes and clients

* No need to re-check outputs over and over again

* No need to count, fail early if any output is missing

* No need to look any further once we found the input we expected

A tx with duplicate inputs would be considered invalid anyway and we also know there are no duplicates because we just verified the final tx above.

Also drop an unused variable.

* Unify LogPrint-s

* Drop human-readable strings for unused PoolMessage-s

* Apply suggestions from code review

Co-Authored-By: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

* Re-introduce zero-fee checks

* fix log

* Move all txin/txout verification logic shared by CPrivateSendClientSession::SignFinalTransaction() and CPrivateSendServer::AddEntry() into CPrivateSendBaseSession::IsValidInOuts()

* fix nit

* Add missing return

* Use CCoinsViewMemPool instead of doing it manually

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
Co-authored-by: Alexander Block <ablock84@gmail.com>
2020-01-10 13:28:12 +03:00
UdjinM6
c42b200973 Try to avoid being marked as a bad quorum member when we sleep for too long in SleepBeforePhase (#3245)
* Do not sleep at the last block of the phase, it's not safe

* Refactor it a bit to make it clearer what's going on here

* Stop sleeping if blocks came faster than we expected
2020-01-10 13:27:58 +03:00
UdjinM6
db6ea1de8e Fix log output in CDKGPendingMessages::PushPendingMessage (#3244) 2020-01-10 13:27:47 +03:00
UdjinM6
65206833e4 Fix menu bar text color in Dark theme (#3236) 2019-12-12 11:46:54 +01:00
UdjinM6
dad102669b Update static and dns seeds for mainnet and testnet (#3234)
* Drop (test.)dnsseed.masternode.io

* makeseeds.py

mainnet 1185193, testnet 225964

* generate-seeds.py

* Update tor.md with live onion nodes

All old nodes are down
2019-12-11 12:30:38 +01: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
Alexander Block
697d289ebc
Merge #12392: Fix ignoring tx data requests when fPauseSend is set on a peer (#3225)
c4af738 Fix ignoring tx data requests when fPauseSend is set on a peer (Matt Corallo)

Pull request description:

  This resolves a bug introduced in
  66aa1d58a1 where, if when responding
  to a series of transaction requests in a getdata we hit the send
  buffer limit and set fPauseSend, we will skip one transaction per
  call to ProcessGetData.

  Bug found by Cory Fields (@theuni).

  Probably worth slipping into 0.16 :/.

Tree-SHA512: a9313cef8ac6da31eb099c9925c8401a638220cf7bc9b7b7b83151ecae4b02630f2db45ef6668302b9bb0f38571afbd764993427f1ec9e4d74d9a3be6647d299
2019-12-06 12:30:17 +01:00
UdjinM6
2b587f0ebc
Slightly refactor CDKGSessionHandler::SleepBeforePhase (#3224)
This should make code a little bit cleaner, should be no changes in the actual behaviour: non-members do not sleep already due to `sleepTime` being negative for them and `phaseTime = 0` does the same on regtest but for everyone.
2019-12-06 12:10:01 +03:00
Alexander Block
fdb05860e2 Don't join thread in CQuorum::~CQuorum when called from within the thread (#3223) 2019-12-06 12:06:13 +03:00
Alexander Block
4c00d98ea6 Allow re-signing of IS locks when performing retroactive signing (#3219)
* Implement re-signing of InstantSend inputs when TXs come in via blocks

* Use GetAdjustedTime instead of GetTimeMillis in CSigSharesManager

This allows use of mocktime in tests.

* Expose verifiedProRegTxHash in getpeerinfo and implement wait_for_mnauth

* Allow to wait for IS and CL to NOT happen

* Bump timeout for wait_for_instantlock

* Implement tests for retroactive signing of IS and CLs

* Add wait_for_tx function to DashTestFramework

* Add -whitelist=127.0.0.1 to node0

* Use node3 for isolated block generation

* Don't test for non-receival of TXs on node4/node5
2019-12-06 12:05:58 +03:00
UdjinM6
dfe99c9507 Decouple cs_mnauth/cs_main (#3220) 2019-12-05 19:28:53 +01:00
UdjinM6
9dad60386c
Tweak "Send" popup and refactor related code a bit (#3218)
Few key points:

- highlight when not all recipients are displayed, move this info closer to the actual list
- clarify fee rounding text for PrivateSend, wasn't accurate
- show transactions size and actual fee rate explicitly
- show number of inputs PrivateSend tx is going to consume and warn if this number is 10 or higher
2019-11-27 13:53:42 +03:00
UdjinM6
ef55e48c1e
Merge pull request #3217 from codablock/pr_backport_hidpi_fix
Backport bitcoin#16254 and remove hires theme
2019-11-22 21:14:22 +03:00
UdjinM6
bb7a32d2e2
Add Dark theme (#3216)
* Copy light(-hires).css -> dark(-hires).css (with no changes yet)

* Add dark(-hires).css to makefile/qrc and show them in theme selector

* Dark theme (css part)

* Do not style unit selector in status bar via platform styles, use css instead

* No coloring via forms (*.ui)

* Implement and use helpers to style parts of rich text differently for light and dark themes

* Remove dark-hires due to #3217

* Revert changes to light-hires.css to avoid merge conflicts with #3217
2019-11-22 21:13:47 +03:00
UdjinM6
05ac4dbb45
Dashify few strings (#3214) 2019-11-22 21:13:19 +03:00
UdjinM6
482a549a2b
Add collateral, owner and voting addresses to masternode list table (#3207)
* Add collateral, owner and voting addresses to masternode list table

* Adjust column names in masternode list table

* Slightly refactor updateDIP3List()

* Lock cs_main in updateDIP3List early to avoid GUI frezes

* Update MN list in GUI 10 times less often while blockchain is still syncing

* Move GetUTXO calls outside of main update loop

* Fill coin cache for masternode UTXOs on start
2019-11-22 21:12:57 +03:00
Alexander Block
8c17c81631 Remove light-hires theme as it's not required anymore 2019-11-22 12:28:08 +01:00
MarcoFalke
d9741fc632 Merge #16254: qt: Set AA_EnableHighDpiScaling attribute early
099e4b9ad3 Set AA_EnableHighDpiScaling attribute early (Hennadii Stepanov)

Pull request description:

  Running `bitcoin-qt` compiled against Qt 5.12.4 causes a warning:
  ```
  hebasto@bionic-qt:~/bitcoin$ src/qt/bitcoin-qt
  Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created.
  ```

  This PR fixes this issue.

  From Qt docs:
  - [Qt::AA_EnableHighDpiScaling](https://doc.qt.io/qt-5/qt.html#ApplicationAttribute-enum):
  > Enables high-DPI scaling in Qt on supported platforms (see also High DPI Displays). _Supported platforms are X11, Windows and Android._ Enabling makes Qt scale the main (device independent) coordinate system according to display scale factors provided by the operating system. This corresponds to setting the `QT_AUTO_SCREEN​_SCALE_FACTOR` environment variable to 1. This attribute must be set before `QGuiApplication` is constructed. This value was added in Qt 5.6.

  - [QCoreApplication::setAttribute()](https://doc.qt.io/qt-5/qcoreapplication.html#setAttribute)

ACKs for commit 099e4b:
  MarcoFalke:
    ACK 099e4b9ad3d9967051d5c3d45c6315d1b30fea05
  jonasschnelli:
    utACK 099e4b9ad3d9967051d5c3d45c6315d1b30fea05
  fanquake:
    ACK 099e4b9ad3d9967051d5c3d45c6315d1b30fea05. Did some testing on `Bionic` and `Windows 10` (using VirtualBox). I couldn't see any obvious visual difference, but given Marco's screens above, this change is obviously better. I also checked that there wasn't any sort of regression on macOS.

Tree-SHA512: 1965a427ee14ffb3871bac317685032406cf02d1fa2b2dc11c8b643bfe4ba09195674d149d1e41752f14c0d000446b35e142f3ce60d987ba97082fd7ee39a094
2019-11-22 12:22:21 +01:00
UdjinM6
37f96f5a3a
Bump version to 0.15 and update few const-s/chainparams (#3204)
* Bump const-s

* Bump version to 0.15

* Run gen-manpages.sh
2019-11-21 23:52:35 +03:00
strophy
9de994988b Compliance changes to terminology (#3211)
Replace inaccurate user-facing descriptions of PS as anonymous to mixed or private, since Dash is a transparent blockchain.
2019-11-21 23:49:35 +03:00
UdjinM6
d475f17bc2
Fix styles for progress dialogs, shutdown window and text selection (#3212)
* Override text selection background color for all text widgets

Otherwie it might become unusable with some system themes

* Fix progress dialogs styling

* Fix shutdown window styling
2019-11-21 18:02:43 +03:00
UdjinM6
df372ec5f9
Fix off-by-one error for coinbase txes confirmation icons (#3206) 2019-11-21 12:55:56 +03:00
UdjinM6
1e94e3333c
Fix styling for disabled buttons (#3205) 2019-11-21 12:55:41 +03:00
UdjinM6
7677b55781
Actually apply CSS styling to RPC console (#3201) 2019-11-19 01:25:59 +03:00
UdjinM6
63cc22d5ea
More Qt tweaks (#3200)
* Fix combobox popup style

* Unify margins/paddings/height for lineedits/comboboxes/spinboxes

* Drop walletframe_background

* Add transparency to unchecked.png

* Alternative solution for comboboxes (no border for popups, add paddings in QListView)
2019-11-18 19:28:41 +03:00
UdjinM6
7aa9c43f89
Few Qt tweaks (#3199)
* Fix "out of sync" label

* Fix fallback fee warning label

It's too long in some languages (e.g. ru) and this breaks ui

* Drop sub-tabs on the Masternode tab
2019-11-15 13:46:45 +03:00
UdjinM6
fd50c1c715
Hold cs_main/cs_wallet in main MakeCollateralAmounts (#3197)
* Hold cs_main/cs_wallet in main MakeCollateralAmounts

Otherwise smth else can alter wallet state and we might end up creating conflicting txes.

* AssertLockHeld
2019-11-13 23:04:12 +03:00
UdjinM6
460e0f475a
Fix locking of funds for mixing (#3194)
* Fix locking of funds for mixing

Lock funds earlier and actually lock mixing collaterals

* Streamline the locking logic in PrepareDenominate
2019-11-13 23:03:52 +03:00