Commit Graph

19014 Commits

Author SHA1 Message Date
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
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
dustinface
9c64708269
bls|depends: Upgrade to bls-signatures version 1.0.0 (#4027)
* build: Add cmake as depends package (cmake.mk)

The bls-signatures library requires cmake 3.14

* depends: Update chia_bls to version 1.0.0 of dashpay/bls-signatures

* depends: Rename package chia_bls to bls-dash

* depends: Disable blspy/tests/benchmarks build for chia_bls

Note: Building with tests would require the following:

depends: Fix macOS build for versions < 10.12

Seems like older versions of macOS pretend to support c++17 std libs but do not have/have issues with uncaught_exceptions. "Catch", the testing framework used in the bls lib wants those by default but setting `DCATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS` disables them which should be just fine to do in all cases here.
---
 depends/packages/chia_bls.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/depends/packages/chia_bls.mk b/depends/packages/chia_bls.mk
index e79a85844f..25749b74ab 100644
--- a/depends/packages/chia_bls.mk
+++ b/depends/packages/chia_bls.mk
@@ -28,6 +28,8 @@ define $(package)_set_vars
     $(package)_config_opts_darwin+= -DCMAKE_AR="$(host_prefix)/native/bin/$($(package)_ar)"
     $(package)_config_opts_darwin+= -DCMAKE_RANLIB="$(host_prefix)/native/bin/$($(package)_ranlib)"
   endif
+
+  $(package)_cppflags+= -DCATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS
 endef

 define $(package)_config_cmds
--

* depends: Drop obsolete variable

* bls: Integrate the upgraded version into the codebase

* depends: Pre-fetch relic to fix gitian

Can fetch apt packages only when building with lxc

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-03-26 15:32:31 +03:00
PastaPastaPasta
f492291aca
refactor: llmq pretty trivial refactor circular dependancy (#4065)
* move DEFAULT_WATCH_QUORUMS to quorums.h

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

* resolve circular lint, -10, +4
2021-03-26 13:21:41 +01:00
PastaPastaPasta
0ad22e1f00
wallet: Refactor some dash specific code in wallet.cpp (#4064)
* use nullptr instead of 0

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

* remove unused function

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

* remove another unused function

Signed-off-by: pasta <pasta@dashboost.org>
2021-03-26 13:20:40 +01:00
UdjinM6
9420314377
rpc: Adjust some masternode rpcs (#4060)
* rpc: Deprecate `masternode current` and `masternode winner`

* rpc: Drop deprecated `mode` param in `masternode count`
2021-03-26 13:17:25 +01:00
UdjinM6
83663c564e
trivial|doc: Some trivial housekeeping (#4059)
* Fix extra line break in CommitTransaction log message

Introduced in #3680 ebe7e80a49 (diff-b2bb174788c7409b671c46ccc86034bdR4113)

* doc: Fix `quorum sign` help

* doc: Add `getdata` to quorum commands list help

* doc: Drop "P2WSH" from signrawtransactionwithkey help

* trivial: Replace "push_back(Pair(..))" with "pushKV"

* trivial: Reorder wallet cmd-line options

* git: Add macos debug simbols to .gitignore

* trivial: Fix typos and whitespaces, drop unused stuff
2021-03-26 13:11:11 +01:00
PastaPastaPasta
fc96e34f28
trivial/wallet: remove unneeded spork include (#4057)
Signed-off-by: pasta <pasta@dashboost.org>
2021-03-26 13:07:31 +01:00
thephez
b0bafc0b07
trivial: -llmq-qvvec-sync help description (#4056)
* Update init.cpp

Fix parentheses

* Update src/init.cpp

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-03-25 12:59:40 -04:00
dustinface
1c667710be
llmq: Verify final commitments in CDKGSession::FinalizeCommitments (#4033)
* llmq: Verify final commitments in CDKGSession::FinalizeCommitments

* llmq: Measure verification time separated
2021-03-25 12:32:12 -04:00
dustinface
df0bf93cb7
llmq|rpc|test: Fix previous active set checks in RPC commands (#4048)
* llmq: Introduce signOffset in CSigningManager::VerifyRecoveredSig

* rpc|test: Fix `signHeight + dkgInterval` check in verifyislock

* rpc|test: Fix `signHeight + dkgInterval` check in `quorum verify`

* test: Test `signHeight + dkgInterval` checks

In `quorum verify` and `verifyislock` RPC commands
2021-03-25 12:30:00 -04:00
UdjinM6
f525f6148b
llmq: A couple of tweaks/fixes for handling nodeStates in CSigSharesManager (#4054)
* llmq: Protect nodeStates in CSigSharesManager::Cleanup()

* refactor: Tweak nodeState cleanup in CSigSharesManager::Cleanup()

* llmq: Add a couple of AssertLockHeld-s to ensure nodeStates protection
2021-03-24 13:13:55 +03:00
UdjinM6
00d237f98f
Add/fix/tweak translated strings (#4052)
* wallet: translate some dash specific warnings

* transaction type: "CoinJoin Denominate" -> "CoinJoin Mixing"

* transaction type: "CoinJoin" -> "CoinJoin Send"

* Avoid translating "CoinJoin"

* Move the link to CoinJoin doc out of the translated string

* Remove trailing whitespace

* Apply suggestions from code review

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Update src/wallet/test/wallet_tests.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Update src/coinjoin/coinjoin.cpp

Co-authored-by: thephez <thephez@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: thephez <thephez@users.noreply.github.com>
2021-03-24 13:13:25 +03:00
strophy
fb311468b7
Docker release CI (#4051)
* feat:add github actions

* add release tag

* multi-arch download

* remove erroneous add command

* install wget properly

* parse tag

* no multi-arch for now

* show vars

* more debug

* show uname

* install certs

* manually mutate tag

* fix syntax

* use env

* remove debug

* try docker meta

* try semver with v

* multi-arch

* remove v

* use tag-match

* match group 1

* prepare for dashpay repo

* optimize dockerfile

* remove unnecessary space

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

* Update .github/workflows/release_docker_hub.yml

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-03-24 13:11:50 +03:00
PastaPastaPasta
567909403c
Merge pull request #4050 from UdjinM6/bp13190_no_ShutdownRequested
qt: Avoid accessing ShutdownRequested directly from qt, use Node interface
2021-03-23 12:27:38 -04:00
PastaPastaPasta
6dd49002c0
Merge pull request #4049 from UdjinM6/bp17068
Fix two translation build issues
2021-03-23 12:26:20 -04:00
PastaPastaPasta
8ab18b439a
trivial: remove unused struct (#4053)
Signed-off-by: pasta <pasta@dashboost.org>
2021-03-23 12:16:20 -04:00
UdjinM6
221adfb426
Avoid accessing ShutdownRequested directly from qt, use Node interface 2021-03-23 04:37:16 +03:00
Kittywhiskers Van Gogh
e20dc9f374
partial merge #13815: Add [[nodiscard]] to all {Decode,Parse}[...](...) functions returning bool (#4035)
* Merge #13815: Explicitly ignore the return value of DecodeBase58(...)

579497e77a

* Merge #13815: Default to DEFAULT_BLOCK_MIN_TX_FEE if unable to parse arg

7c5bc2a523

* Merge #13815: Add NODISCARD to all {Decode,Parse}[...](...) functions returning bool.

9cc0230cfc
2021-03-22 13:10:27 -04:00
UdjinM6
25c14b999f
Fix "Qualifying with unknown namespace/class" warnings on make translate 2021-03-22 13:40:17 +03:00
Franck Royer
689da59e3d
backport #17068: qt: Always generate bitcoinstrings.cpp on make translate
`bitcoinstrings.cpp` is to be generated at release time. Hence,
it should not depend on whether the source files are younger as the
releaser may proceed from a fresh checkout.
2021-03-22 13:39:50 +03:00
UdjinM6
bca9577b8f
partial/logic backport #18544: net: limit BIP37 filter lifespan (active between 'filterload'..'filterclear') (#4043)
* partial backport 18544: net: limit BIP37 filter lifespan (active between 'filterload'..'filterclear')

Previously, a default match-everything bloom filter was set for every peer,
i.e. even before receiving a 'filterload' message and after receiving a
'filterclear' message code branches checking for the existence of the filter
by testing the pointer "pfilter" were _always_ executed.

* net: Match the backport PR a bit more

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-03-22 13:29:31 +03:00
dustinface
ea9daa762a
Merge pull request #4047 from UdjinM6/bp13341_2
Backport 13190 and 13341
2021-03-22 11:11:51 +01:00
MarcoFalke
b27554ba3f
Merge #13341: Stop translating command line options
3d4fa83587 Stop translating command line options (Wladimir J. van der Laan)

Pull request description:

  Many options are extremely technical, and refer internals, making it difficult to translate usefully. This came up in discussion of e.g.  #10949. If a message is not understood by translators (which are typically end-users, not developers) they'll either translate it literally, making it harder to understand instead of easier, with the added drawback of the user no longer being able to google it.

  Also the translation was only working for bitcoin-qt as with the console programs, there is no translation backend. So it was injecting never-used translation messages for bitcoin-cli, -tx.

  For these reasons, stop translating options help completely. This should not affect the output **in any way** \* except for bitcoin-qt when a non-English language is configured in the locale.

  This implements #10962.

  \*) I checked this, but please do verify this.

Tree-SHA512: 46c5f2ac0d4dbe9a6710fab498781e442dd6d6ac17613a99fcfe7a62bf6811fa1c92400d35bd389772cb4b31c6918df261548cbc677addba653f44083b9aeeda
2021-03-19 20:23:58 +03:00
UdjinM6
6bcc1bf0a3
backport bitcoin#13190: Have gArgs handle printing help 2021-03-19 18:00:24 +03:00
PastaPastaPasta
9f4080d1ce
trivial: remove double space (#4045)
Signed-off-by: pasta <pasta@dashboost.org>
2021-03-19 11:24:28 +03:00
PastaPastaPasta
a565437849
refactor: move some protocol constants (#4022)
* governance/net: move protocol constants into version.h, drop GOVERNANCE_FILTER_PROTO_VERSION

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

* drop GOVERNANCE_FILTER_PROTO_VERSION

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

* move MIN_COINJOIN_PEER_PROTO_VERSION into version.h and adjust includes accordingly

Signed-off-by: pasta <pasta@dashboost.org>
2021-03-19 11:11:41 +03:00
dustinface
ab819ce489
llmq: Move GetAllQuorumMembers into CFinalCommitment::Verify (#4032)
Instead of calling `CLLMQUtils::GetAllQuorumMembers` before each `CFinalCommitment::Verify` call to get the quorum members, just get them inside `CFinalCommitment::Verify`.
2021-03-17 19:49:58 -04:00
UdjinM6
d66d52a256
chainlocks: Run CheckActiveState before processing new CLSIG (#4042)
This avoids race condition for "spork19 off, spork 19 on" situations when some nodes might call CheckActiveState already, created new clsig and sent it so that other nodes processed it too already but they will call CheckActiveState afterwards (because it's done every 5 sec) and reset best chainlock to null.
2021-03-17 19:45:41 -04:00
dustinface
fecdbefe5b
test: Make some tests executable (#4044) 2021-03-17 19:43:54 -04:00
dustinface
ae506bae66
refactor: PrivateSend -> CoinJoin + Move the tab (#4038)
* qt|wallet|privatesend: Rename PrivateSend to CoinJoin in GUI strings

* qt: Move CoinJoin next to Transactions

* qt: Adjust status tip of privateSendCoinsMenuAction

Co-authored-by: thephez <thephez@users.noreply.github.com>

* rename: privateSend -> coinJoin

* rename: privatesend -> coinjoin

* rename: PrivateSend -> CoinJoin

* rename: use_ps -> use_cj

* rename: PRIVATESEND -> COINJOIN

* rename: privatesend -> coinjoin for files and folders

* refactor: Re-order coinjoin files in cmake/make files

* refactor: Re-order coinjoin includes where it makes sense

* test: Update lint-circular-dependencies.sh

* Few cleanups

* test: test/coinjoin_tests.cpp -> wallet/test/coinjoin_test.cpp

* s/AdvancedPSUI/AdvancedCJUI/g

* s/privateSentAmountChanged/coinJoinAmountChanged/g

* wallet: Rename "ps_salt" backwards compatible

* Minimal PrivateSend -> CoinJoin migration for settings and cmd-line

* wallet: Fix privatesendrounds -> coinjoinrounds migration

* qt: Migrate nPrivateSendAmount -> nCoinJoinAmount

* `-coinjoindenoms` never existed

* Migrate all PS options/settings

* rpc: Formatting only

* qt: Make Send/CoinJoin tabs a bit more distinguishable

Co-authored-by: thephez <thephez@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-03-17 18:36:11 -04:00
dustinface
4feb38b6ab
llmq|init|test: Add "mode" to -llmq-qvvec-sync parameter (#4030)
* llmq|init|test: Add "mode" to -llmq-qvvec-sync parameter

This changes the paramter from `-llmq-qvvec-sync=<quorum_name>` to `-llmq-qvvec-sync=<quorum_name:mode>`

With the following definitions:

- `quorum_name`: Internal name of the quorum type
- `mode=0` - Sync always from all quorums of the type defined by `quorum_name`
- `mode=1` - Sync only if member of any from all other quorum of the type defined by `quorum_name`

`-llmq-qvvec-sync=llmq_100_67:0` To always request qvvec's from all `LLMQ_100_67`.
`-llmq-qvvec-sync=llmq_100_67:1` Only request if type member.

This means, if platform enables this on all MNs with `mode=0` we will
have all nodes asking new quorum for their verification vector instead
of only `24*100` at max.

* llmq: Adjust GetQuorumRecoveryStartOffset to use all MNs

* Turn `QvvecSyncMode` into `enum class`

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-03-16 18:50:41 -04:00
UdjinM6
95e8492f31
llmq: Implement Intra-Quorum Relay connections for qrecsig-s (#4020)
* llmq: Implement Intra-Quorum Relay connections for qrecsig-s

Avoid relaying recsigs to non-masternodes.

* test: Simplify loop

* test: Assert connections are equal to llmq_size instead of static number

* test: Drop redundant brackets

* test: Fix typo

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-03-14 22:49:38 -04:00
UdjinM6
bc3137166f
bls: Avoid needless hashing (#4013)
* bls: Only update cached hash in CBLSWrapper when it's really needed

* bls: Reset cached hash in CBLSLazyWrapper instead of re-assigning uint256() to it

* bench: Update expected numbers in bls benchmarks

* bls: Drop UpdateHash methods

Make sure the hash is updated via GetHash() only.
2021-03-12 17:54:20 -05:00