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
* 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>
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.
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.
* 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>
* 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>
* 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>
* 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>
* 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
* 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
* 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
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
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.
* 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
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
* 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
* 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
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
* 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
* 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)
* 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
* Hold cs_main/cs_wallet in main MakeCollateralAmounts
Otherwise smth else can alter wallet state and we might end up creating conflicting txes.
* AssertLockHeld