Commit Graph

19046 Commits

Author SHA1 Message Date
PastaPastaPasta
5074e6df9e
Extensive include refactoring (#4095)
* Simple changes, mostly just includes

* Continued include changes combined with using pointers to avoid including more than necessary in headers

* remove dup include

* masternode-utils.cpp include net.h in all builds

* resolve linter -7 +11

* drop quorums.h from dkgsessionhandler.cpp

* Add `<utilstrencodings.h>`

* Initialize lastMNListForVotingKeys

* Refactor GetMinedCommitment to return sharedptr

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-04-15 23:41:16 -04:00
PastaPastaPasta
a2e4eb0019
bunch of trivial typos / english fixes (#4101) 2021-04-15 14:19:03 -04:00
PastaPastaPasta
9a5bd934d5
Minor bls refactoring (#4100)
* avoid deprecated C headers

* remove unused header

* typos

* unused include

* use static / const where possible

* make parameter const ref where possible

* Clang-Tidy: Parameter is passed by value and only copied once; consider moving it to avoid unnecessary copies

* Clang-Tidy: Passing result of std::move() as a const reference argument; no move will actually happen

* Clang-Tidy: Forwarding reference passed to std::move(), which may unexpectedly cause lvalues to be moved; use std::forward() instead

* access statically
2021-04-15 14:16:44 -04:00
PastaPastaPasta
646cf9aba3
Merge pull request #4097 from PastaPastaPasta/backport-0.17-pr27
Backport 0.17 pr27
2021-04-15 13:58:29 -04:00
PastaPastaPasta
91f4e71563
trivial: misc. trivial refactoring (#4104)
* minor statsd refactoring

* stacktrace refactoring

* spork typos + unused include

* need thread on windows builds
2021-04-15 13:58:04 -04:00
UdjinM6
01dd958429
rpc: Tweak getaddressbalance to also show spendable and immature balances (#4098)
* rpc: Tweak getaddressbalance to also show spendable and immature balances

* tests: Check `balance_immature` and `balance_spendable`
2021-04-15 19:30:14 +02:00
UdjinM6
99f8f91cc7
Add missing locks after 12694 2021-04-14 14:44:03 -04:00
xdustinface
af48ba0d53
qt: Drop a space 2021-04-14 11:37:42 -04:00
xdustinface
00c5083287
qt: Use themed red for the prune settings warning 2021-04-14 00:56:15 -04:00
xdustinface
4e05e6d152
qt: Move prune settings and its warning down 2021-04-14 00:56:04 -04:00
Wladimir J. van der Laan
1541e44d85
Merge #13043: [qt] OptionsDialog: add prune setting 2021-04-13 16:11:22 -04:00
Wladimir J. van der Laan
ee04176530
Merge #12694: Actually disable BnB when there are preset inputs
081bf54 Test that BnB is not used when there are preset inputs (Andrew Chow)
6ef9982 Actually disable BnB when there are preset inputs (Andrew Chow)

Pull request description:

  We don't want to use BnB when there are preset inputs because there
  is some weirdness with making that work with using the KnapsackSolver
  as the fallback. Currently we say that we haven't used bnb when
  there are preset inputs, but we don't actually disable BnB. This fixes
  that.

  I thought this was done originally. I guess it got lost in a rebase somewhere.

Tree-SHA512: 9792c0cdd0736866bddbed20f10b8050104955dc589fba49a0bd61a582ba491c921af2cdcc2269678b7b69275dad5fcf89c71b75c28733c7bacbe52e55891b9c
2021-04-13 13:08:32 -04:00
Pieter Wuille
032593d047
Merge #12737: Remove unnecessary NONNEGATIVE_SIGNED
34ca750320 Remove unnecessary NONNEGATIVE_SIGNED (Russell Yanofsky)

Pull request description:

  Switch to unsigned encoding, which is backwards compatible and avoids MSVC
  error reported https://github.com/bitcoin/bitcoin/issues/12732

Tree-SHA512: 9687842aa8cb745ba7cf7612bd2feea0cef14953aba9af26c72c6eb3c974d790152eb4d0e8654d4ae451fe80947cb2552a82f19b1f9e9658701aed8ce0ee5c23
2021-04-13 13:08:32 -04:00
UdjinM6
68caf300a9
qt: Do not use border-image (#4093)
Fixes weird image corruption on macos
2021-04-11 15:02:10 -04:00
UdjinM6
6d11d0b8fc
qt: Drop unused scrolbars.css (#4092)
It was removed from the build via #3571 and is no longer used in any way
2021-04-11 15:01:35 -04:00
UdjinM6
e28e449ed3
qt: Remove arrows from combobox dropdowns on linux (#4084) 2021-04-11 15:01:07 -04:00
UdjinM6
21372a238a
Bump CI test timeout (#4090)
Some of our tests are too heavy for slow gitlab shared runners
2021-04-10 16:37:29 -04:00
UdjinM6
a1d039a9d8
Update man pages (#4089)
Run `gen-manpages.sh`
2021-04-10 16:37:07 -04:00
UdjinM6
4110aabf71
Fix command line help strings (#4088)
* s/bitcoin-tx/dash-tx/

* Fix regtestLLMQ

* Make `-socketevents` help string OS-independent
2021-04-10 16:36:31 -04:00
UdjinM6
cc21461baf
Bump chainparams for mainnet and testnet (#4087)
* Bump nMinimumChainWork and defaultAssumeValid for mainnet and testnet

* Bump DEPLOYMENT_V17 start and timeout

* Bump chaintxdata

mainnet:
{
  "time": 1617874573,
  "txcount": 34709765,
  "window_final_block_hash": "000000000000000bd7dac80e97279c984a3266145c130ab76021f5bac6d80ff3",
  "window_block_count": 17280,
  "window_tx_count": 822851,
  "window_interval": 2723924,
  "txrate": 0.3020829509193355
}

testnet:
{
  "time": 1617874832,
  "txcount": 4926985,
  "window_final_block_hash": "000000b0940bec06e3245dc787743b3a7f039068878aa1c7c6d5b44c443770bf",
  "window_block_count": 17280,
  "window_tx_count": 26190,
  "window_interval": 2438451,
  "txrate": 0.01074042496650538
}
2021-04-10 16:34:26 -04:00
UdjinM6
a567170dd2
qt: Apply themes globally (#4086)
* qt: Apply themes globally

And do this early

* qt: Fix unexpected prompt icon in dash themes

This has been introduced by removing the `GUIUtil::loadStyleSheet(node,
autoCompleter->popup());` call which triggered a `QEvent::StyleChange`
to propery load the widgets before.

* qt: Move custom css timer out of loadStyleSheet

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-04-10 16:31:58 -04:00
UdjinM6
cab8b22040
qt: Fix theme loading (#4085)
* qt: Always use predefined css filenames instead of guessing them when using custom css dir

* qt: Safer getActiveTheme

* qt: Use correct default theme in dashThemeActive
2021-04-10 16:30:07 -04:00
UdjinM6
6ba3b2f3b8
Merge pull request #4081 from xdustinface/pr-fix-issue-3521
backport: Some wallet related PRs
2021-04-07 00:38:41 +03:00
dustinface
ff30f3fa22
depends: Use 1.0.1 of dashpay/bls-signatures in bls-dash.mk (#4083)
* depends: Use `1.0.1` of `dashpay/bls-signatures` in `bls-dash.mk`

* depends: Update relic to match the commit used in bls-signatures `1.0.1`
2021-04-06 17:43:58 +02:00
dustinface
ba2acda782
wallet: Don't throw in CreateWalletFile (#4079)
To make sure `RemoveWallet` gets called in `error` lambda.
2021-04-06 17:40:02 +02:00
dustinface
2d3ce525c1
llmq: Fix PoSe connection checks (#4058)
* llmq: Fix PoSe connection checks

* llmq: Print badConnection if not connected
2021-04-05 22:26:22 +03:00
MarcoFalke
773e39e1e5 Merge #13506: Qt: load wallet in UI after possible init aborts
3a03d2a33f Qt: load wallet in UI after possible init aborts (Jonas Schnelli)

Pull request description:

  Bug was introduced in #13063 (80b4910f7d87983f50047074c3c2397b0a5c4e92) where #13097 made possible to get "hit" by that bug. Reported by @ken2812221 (https://github.com/bitcoin/bitcoin/pull/13097#issuecomment-398445833).

  Dynamically loading a wallet informs the UI (and therefore makes the instance accessible) about the new wallet before all possible error cases where handled.

  Easy to reproduce by starting `bitcoin-qt --regtest --nowallet -usehd=0` then in the console enter `loadwallet wallet.dat`.

  This PR will make sure only correctly initialised (loaded) wallets will appear in the UI.

Tree-SHA512: 3139545e852d53b117182b579f45259c198d1c25c1a6fa4e0108f942d45f6fe2691e6bfcbbae2e18c33ad0174a520f379c17867b1eb87f950d830a5f519fec4f
2021-04-05 03:31:50 +02:00
Wladimir J. van der Laan
4666e2c20a Merge #13275: Qt: use [default wallet] as name for wallet with no name
2885c131b6b8ec1140e02ed8f2933c2ffbf41fd1 Qt: use [default wallet] as name for wallet with no name (Jonas Schnelli)

Pull request description:

  Loading a wallet from a state where only the default wallet was active results in using an empty string for the initial/default wallet name.

  This is a GUI only quick-fix that overrides wallet(s) with name "" to "[default wallet]". Does not affect `getwalletinfo` or `listwallets`.

  Also, unsure if it should be fixed at a deeper level and if – instead of [default wallet] – it should use `wallet.dat` (the filename of the default wallet).

Tree-SHA512: 1d50dbb200b23df5ac53ce15aeb6453af4da354d6e6e53fe33ff075b477493254d6028b6d3569a7804b1aa616cb9a988a53de818937e37cdcb19cb70a90e2a88
2021-04-05 03:31:50 +02:00
Wladimir J. van der Laan
5db88d27cb Merge #14552: wallet: detecting duplicate wallet by comparing the db filename.
591203149f1700f594f781862e88cbbfe83d8d37 wallet: Create IsDatabaseLoaded function (Chun Kuan Lee)
15c93f075a881deb3ad7b1dd8a4516a9b06e5e11 wallet: Add trailing wallet.dat when detecting duplicate wallet if it's a directory. (Chun Kuan Lee)
c456fbd8dfcc748e5ec9feaa57ec0f2900f99cde Refactor: Move m_db pointers into BerkeleyDatabase (Russell Yanofsky)

Pull request description:

  Fix #14538

  Fix crash attempting to load the same wallet with different path strings that resolve to the same absolute path. The primary check which prevents loading the same wallet twice is:

  6b8d0a2164/src/wallet/db.cpp (L44)

  But this check is skipped if both wallet paths resolve to the same absolute path, due to caching here:

  6b8d0a2164/src/wallet/db.cpp (L467)

  Meanwhile a secondary check for duplicate wallets is not reliable because it based on a literal comparison, instead of comparison using absolute paths:

  6b8d0a2164/src/wallet/wallet.cpp (L3853)

  This PR fixes the latter check to compare the absolute path of a new wallet being loaded to absolute paths of wallets already loaded, so there should no longer be any way to load the same wallet more than once.

Tree-SHA512: 2fa01811c160b57be3b76c6b4983556a04bbce71a3f8202429987ec020664a062e897deedcd9248bc04e9baaa2fc7b464e2595dcaeff2af0818387bf1fcdbf6f
2021-04-05 03:31:50 +02:00
Wladimir J. van der Laan
d4ac6d62a9 Merge #14350: Add WalletLocation class
65f3672f3b82a6fa30e5171f85bc8d8a29e0797e wallet: Refactor to use WalletLocation (João Barbosa)
01a4c095c87500650663341533f000c6b613e9da wallet: Add WalletLocation utility class (João Barbosa)

Pull request description:

  Advantages of this change:
   - avoid resolving wallet absolute path and name repetitively and in multiple places;
   - avoid calling `GetWalletDir` in multiple places;
   - extract these details from the actual wallet implementation.

  The `WalletLocation` class can be a way to represent a wallet not yet loaded that exists in the wallet directory.

Tree-SHA512: 71ec09786e038499710e7acafe92d66ab9883fc894964e267443ae9c10a6872a10995c3987a169c436a4e793dae96b28fb97bd7f78483c4b72ac930fa23f8686
2021-04-05 03:31:50 +02:00
Wladimir J. van der Laan
86357cc55f Merge #14320: [bugfix] wallet: Fix duplicate fileid detection
4ea77320c5f0b275876be41ff530bb328ba0cb87 tests: add test case for loading copied wallet twice (Chun Kuan Lee)
2d796faf62095e83f74337c26e7e1a8c3957cf3c wallet: Fix duplicate fileid (Chun Kuan Lee)

Pull request description:

  The implementation in current master can not detect if the file ID is duplicate with flushed `BerkeleyEnvironment`. This PR would store the file ID in a global variable `g_fileids` and release it when the `BerkeleyDatabase` close. So it won't have to rely on a `Db*`.

  Fix #14304

Tree-SHA512: 0632254b696bb4c671b5e2e5781e9012df54ba3c6ab0f919d9f6d31f374d3b0f8bd968b90b537884ac8c3d2906afdd58c2ce258666263464c7dbd636960b0e8f
2021-04-05 03:31:50 +02:00
Wladimir J. van der Laan
5179599526 Merge #12493: [wallet] Reopen CDBEnv after encryption instead of shutting down
c1dde3a949b36ce9c2155777b3fa1372e7ed97d8 No longer shutdown after encrypting the wallet (Andrew Chow)
d7637c5a3f1d62922594cdfb6272e30dacf60ce9 After encrypting the wallet, reload the database environment (Andrew Chow)
5d296ac810755dc47f105eb95b52b7e2bcb8aea8 Add function to close all Db's and reload the databae environment (Andrew Chow)
a769461d5e37ddcb771ae836254fdc69177a28c4 Move BerkeleyEnvironment deletion from internal method to callsite (Andrew Chow)

Pull request description:

  This is the replacement for #11678 which implements @ryanofsky's [suggestion](https://github.com/bitcoin/bitcoin/pull/11678#pullrequestreview-76464511).

  Shutting down the software was to prevent the BDB environment from writing unencrypted private keys to disk in the database log files, as was noted [here](https://bitcointalk.org/index.php?topic=51474.msg616068#msg616068). This PR replaces the shutdown behavior with a CDBEnv flush, close, and reopen which achieves the same effect: everything is cleanly flushed and closed, the log files are removed, and then the environment reopened to continue normal operation.

  To ensure that no unencrypted private keys are in the log files after encrypting the wallet, I wrote [this script](https://gist.github.com/achow101/7f7143e6c3d3fdc034d3470e72823e9d) to pull private keys from the original wallet file and searches for these keys in the log files (note that you will have to change your file paths to make it work on your own machine).

  As for concerns about private keys being written to slack space or being kept in memory, these behaviors no longer exist after the original wallet encryption PR and the shutting down solution from 2011.

  cc @ryanofsky

Tree-SHA512: 34b894283b0677a873d06dee46dff8424dec85a2973009ac9b84bcf3d22d05f227c494168c395219d9aee3178e420cf70d4b3eeacc9785aa86b6015d25758e75
2021-04-05 03:31:50 +02:00
Jonas Schnelli
75d375acb7 Merge #13111: Add unloadwallet RPC
fe65bdec2 bugfix: Delete walletView in WalletFrame::removeWallet (João Barbosa)
0b82bac76 bugfix: Remove dangling wallet env instance (João Barbosa)
0ee77b207 ui: Support wallets unloaded dynamically (João Barbosa)
9f9b50d5f doc: Add release notes for unloadwallet RPC (João Barbosa)
ccbf7ae74 test: Wallet methods are disabled when no wallet is loaded (João Barbosa)
4940a20a4 test: Add functional tests for unloadwallet RPC (João Barbosa)
6608c369b rpc: Add unloadwallet RPC (João Barbosa)
537efe19e rpc: Extract GetWalletNameFromJSONRPCRequest from GetWalletForJSONRPCRequest (João Barbosa)

Pull request description:

  This patch adds wallet unload feature via RPC. It also adds UI support for unloaded wallets.

Tree-SHA512: 7c7f9f32f7a2266d2df574aa6b95f993c3dc82736f93304562122beb8756fb28cd22d03866b48f493c747441f22d30e196b098dec435cc25e035633f090351ea
2021-04-05 03:31:50 +02:00
UdjinM6
0b7d7a084a
net: Use Intra-Quorum Relay connections for other messages too (#4021)
* net: Use Intra-Quorum Relay connections for other messages too

Make intra-quorum data delivery more robust.

* Apply review suggestions
2021-04-03 20:24:03 +03:00
UdjinM6
6773d0285e
Translations 202103 (#4046)
* qt: Add missing button translation

* `make translate`

* ru

* fi

* it, pl

* de, fr, nl, pt, sk, th, tr

* 90%+: ar, es, ko, zh_CN, zh_TW
2021-04-03 20:19:14 +03:00
UdjinM6
a78208ade6
evo: Ensure special tx processing is aligned with UTXOs processing in ConnectBlock and mempool (#4015)
* evo: Pass CCoinsViewCache instead of relying on pcoinsTip

This ensures that we are on the same page with ConnectBlock etc.

* evo: Process special txes before updating UTXOs

This ensures consistency between the way we do it in blocks and in mempool

* test: Verify db consistency after MN collateral is spent via ProTx that updates the same MN

* Make stuff const

* more constness

Co-authored-by: pasta <pasta@dashboost.org>
2021-04-03 20:18:50 +03:00
PastaPastaPasta
a72acc113d
Move net.h include from quorums_*.h into quorums.cpp (#4075)
* Remove net include from quorums-util.h

* circular depends -1

* include timedata.h in quorums_debug.cpp

* fix circular depends linter
2021-04-02 03:19:34 +02:00
dustinface
a3cc51118e
Merge #13063: Use shared pointer to retain wallet instance (#4076)
80b4910f7d87983f50047074c3c2397b0a5c4e92 wallet: Use shared pointer to retain wallet instance (João Barbosa)

Pull request description:

  Currently there are 3 places where it makes sense to retain a wallet shared pointer:
   - `vpwallets`;
   - `interfaces::Wallet` interface instance - used by the UI;
   - wallet RPC functions - given by `GetWalletForJSONRPCRequest`.

  The way it is now it is possible to have, for instance, listunspent RPC and in parallel unload the wallet (once #13111 is merged) without blocking. Once the RPC finishes, the shared pointer will release the wallet.

  It is also possible to get all existing wallets without blocking because the caller keeps a local list of shared pointers.

  This is mostly relevant for wallet unloading.

  This PR replaces #11402.

Tree-SHA512: b7e37c7e1ab56626085afe2d40b1628e8d4f0dbda08df01b7e618ecd2d894ce9b83d4219443f444ba889096286eff002f163cb0a48f37063b62e9ba4ccfa6cce

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
2021-04-01 13:28:43 -04:00
PastaPastaPasta
7e71a54e54
trivial: various include adjustments (#4074)
* remove unused includes in validation.cpp

circular depends -2

* use more specific include in quorums.h

circular depends -1

* Remove unneeded include from quorums.cpp

circular depends -1
2021-03-31 16:02:22 -04:00
PastaPastaPasta
4a84c99bad
trivial: Remove unneeded include from quorums_instantsend.cpp (#4073)
* Remove unneeded include from quorums_instantsend.cpp

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

* circular depends -6
2021-03-31 16:01:59 -04:00
UdjinM6
6770ba86ac
llmq: Implement GetAllQuorumMembers cache (#4072) 2021-03-29 14:11:26 -04:00
UdjinM6
cb59f13e1b
qt: Delete wallet views when wallets are removed in removeAllWallets (#4070) 2021-03-29 14:10:58 -04:00
dustinface
174f961d18
llmq: Refactor EnsureQuorumConnections (#4071)
* llmq: Return bool in EnsureQuorumConnections

* llmq: Call RemoveMasternodeQuorumNodes directly

Instead of removing the good nodes from the vector in first loop and 
call it with the bad ones in the second loop.

* refactor: Introduce and use CLLMQUtils::IsWatchQuorumsEnabled

* llmq: Move IsWatchQuorumsEnabled into EnsureQuorumConnections
2021-03-29 14:09:09 -04:00
dustinface
a3fa940b4d
test: Use reset_probe_timeouts and drop its sync_all call (#4063)
* test: Make use of reset_probe_timeouts in feature_llmq_simplepose.py

* test: Drop sync_all in reset_probe_timeouts

Seems like that not required here
2021-03-29 14:04:35 -04:00
PastaPastaPasta
9d1c35438c
rely on stopRequested which is set when ShutdownRequested (#4069)
circular depends -1

Signed-off-by: pasta <pasta@dashboost.org>
2021-03-29 14:03:17 -04:00
PastaPastaPasta
5c485c5b0b
refactor: Move CCoinJoinClientOptions from coinjoin-client.* (#4066)
* create coinjoin-client-options.cpp/.h

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

* Drop redundant forward declarations

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-03-27 04:11:33 +01:00
UdjinM6
308b4f7b62
llmq: Fix ProcessRecoveredSig bug (#4067)
Fixes #3960
2021-03-26 13:06:53 -04:00
UdjinM6
07ceb6d284
Use correct Serialization Type in CBlockHeader::GetHash() (#4068)
Nothing critical but it would be nice to use the right one.
2021-03-26 12:11:33 -04:00
UdjinM6
7518e1cbdb
Move -instantsendnotify into wallet, drop OptionsCategory::INSTANTSEND (#4062) 2021-03-26 15:33:37 +03:00
UdjinM6
3c3b51d684
rpc|doc: Adjust protx register prepare/submit help (#4061)
* doc: Tweak "protx register_prepare" help

* doc: tweak "protx register_submit" help
2021-03-26 15:32:59 +03:00