Commit Graph

463 Commits

Author SHA1 Message Date
PastaPastaPasta
41b43ec240
Static analysis fixes (#4316)
* Make constructors explicit

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

* static analysis fixes

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

* Make pFrom nullptr check it's own

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

* revert std thread changes and hasOperatorKey

Signed-off-by: pasta <pasta@dashboost.org>
2021-08-07 00:55:51 +03:00
Kittywhiskers Van Gogh
cbc4a74250 merge #16117: Replace boost sleep with std sleep 2021-08-05 16:13:47 +05:30
PastaPastaPasta
f87d62d677
refactor: misc bls, evo, include refactoring (#4305)
* refactor/bls: misc refactoring and spelling/grammar fixes in bls code

* refactor/evo: misc refactoring and spelling/grammar fixes in evo code

* refactor: some include changes

* refactor: remove redundant `public`

* fix linter

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

* Sort includes

* Move `class CTxDSIn;`

* Drop unused functions in CBLSWorker

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-07-31 21:29:12 +03:00
gabriel-bjg
41190e9899
Fix data races triggered by functional tests. (#4247)
Function CWallet::KeepKey requires locking as it has concurrent access to database and member nKeysLeftSinceAutoBackup.

Avoid data race when reading setInventoryTxToSend size by locking the read. If locking happens after the read, the size may change.

Lock cs_mnauth when reading verifiedProRegTxHash.

Make fRPCRunning atomic as it can be read/written from different threads simultaneously.

Make m_masternode_iqr_connection atomic as it can be read/written from different threads simultaneously.

Use a recursive mutex to synchronize concurrent access to quorumVvec.

Make m_masternode_connection atomic as it can be read/written from different threads simultaneously.

Make m_masternode_probe_connection atomic as it can be read/written from different threads simultaneously.

Use a recursive mutex in order to lock access to activeMasterNode.

Use a recursive mutex to synchronize concurrent access to skShare.

Guarded all mnauth fields of a CNode.

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-07-26 10:52:52 -05:00
PastaPastaPasta
8c91a8b7ff
docs: introduce doxygen comments for InstantSend (#4279)
* add comments

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

* Add doxygen comments for IS database handler

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

* Apply suggestions from code review

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

* Apply suggestions from code review

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-07-19 20:59:02 +03:00
UdjinM6
886024ba25
Merge pull request #4203 from UdjinM6/pr4196
ci: Add `--enable-werror` to arm and c++17 builds (and fix all issues found via these builds)
2021-07-17 02:37:07 +03:00
pasta
12972fe88e refactor: utilize GetLLMQParams, make it const, consistent naming
Removes all (besides one) usages of "Params().GetConsensus().llmqs.at" and instead uses the wrapper in quorum_utils.cpp

Rename all params to llmq_params for consistency and not conflict with non-llmq params

make some llmq_params const where possible

remove unneeded llmq_params variables where it's only used once

Signed-off-by: pasta <pasta@dashboost.org>
2021-07-15 15:28:58 -05:00
UdjinM6
69a72ea5d5
Initialize firstNodeId 2021-07-13 19:43:33 +03:00
UdjinM6
66f3f4f328
Check for locks in more places in CSigSharesManager 2021-07-13 19:43:32 +03:00
UdjinM6
cf3896304a
Hold the right lock in AskNodesForLockedTx 2021-07-13 19:43:31 +03:00
UdjinM6
a65a4669a7
Drop external protection of pending messages in CDKGSessionHandler 2021-07-13 19:43:31 +03:00
UdjinM6
3e95d592d8
Fix locks in CDKGSession 2021-07-13 19:43:31 +03:00
UdjinM6
d2a1bab978
Fix locks in EnforceBestChainLock() 2021-07-13 19:43:31 +03:00
gabriel-bjg
ee6d2f5b0d
Fix data races in bls_worker and use ctpl_stl queue. (#4240)
Change ctpl implementation to use STL queue & mutex.

Use ctpl synchronized queue instead of boost lockfree queue in bls worker aggregator.

Use smart pointers for memory management of Aggregator and VectorAggregator. With 'delete this;' the objects are prone to data race on the delete operator.

Use smart pointers for memory management of ContributionVerifier.

Pass shared_ptr by value to other threads via worker pool.
2021-07-11 22:25:27 -05:00
Wladimir J. van der Laan
4cd32e43e4
Merge #13235: Break circular dependency: init -> * -> init by extracting shutdown.h
1fabd59e7 Break circular dependency: init -> * -> init by extracting shutdown.h (Ben Woosley)
e62fdfeea Drop unused init.h includes (Ben Woosley)

Pull request description:

  Most includers just wanted to react to pending shutdown.

  This isolates access to `fRequestShutdown` and limits access to the shutdown api functions, including the new `CancelShutdown` for setting it to `false`.

Tree-SHA512: df42f75dfbba163576710e9a67cf1228531fd99d70a2f187bfba0bcc476d6749cf88180a97e66a81bb5b6c3c7f0917de7402d26039ba7b644cb7509b02f7e267
2021-07-02 00:42:18 +03:00
PastaPastaPasta
2125805a31
ISDB avoid processing the same fully confirmed block in DB multiple times (#4193) 2021-07-01 23:43:39 +03:00
Kittywhiskers Van Gogh
138997c8e6 partial bitcoin#15638: Add several util units 2021-06-27 12:03:15 +05:30
PastaPastaPasta
f09731f014
refactor: misc refactoring in instantsend, llmq, coinjoin (#4212)
* instantsend: make stuff const where possible

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

* instantsend: remove unused `params`

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

* instantsend: combine two nested if's into one

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

* instantsend: use auto in spots where possible and clear

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

* coinjoin: make IsValidStructure const

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

* coinjoin: divide by an integer to avoid double implicit conversions

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

* coinjoin: make unused parameter unnamed

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

* quorums.* use const and use references where possible

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

* quorums.h don't return const when returning by value

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

* quorums_blockprocessor.cpp remove redundant casts and combine two if statements

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

* quorums_blockprocessor.cpp make values const

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

* quorums_chainlocks.cpp access static function statically

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

* quorums_chainlocks.h remove commented out include

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

* quorums_commitment.cpp remove redundant casts

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

* quorums_debug.cpp remove redundant casts and add const

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

* quorums_dkgsession.cpp use const where possible

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

* quorums_dkgsessionhandler.cpp use const where possible

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

* quorums_dkgsessionhandler.cpp don't use std::move which apparently prevents "copy elision" in this instance

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

* quorums_dkgsessionhandler.cpp use const

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

* quorums_dkgsessionmgr.cpp misc refactoring

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

* quorums_signing.* misc refactoring

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

* quorums_signing_shares.* misc refactoring

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

* quorums_utils.cpp misc refactoring

Signed-off-by: pasta <pasta@dashboost.org>
2021-06-26 16:10:53 +03:00
Wladimir J. van der Laan
82659a4eb8 Merge #12257: [wallet] Use destination groups instead of coins in coin select
232f96f5c8a3920c09db92f4dbac2ad7d10ce8cf doc: Add release notes for -avoidpartialspends (Karl-Johan Alm)
e00b4699cc6d2ee5697d38dd6607eb2631c9b77a clean-up: Remove no longer used ivars from CInputCoin (Karl-Johan Alm)
43e04d13b1ffc02b1082176e87f420198b40c7b1 wallet: Remove deprecated OutputEligibleForSpending (Karl-Johan Alm)
0128121101fb3ee82f3abd3973a967a4226ffe0e test: Add basic testing for wallet groups (Karl-Johan Alm)
59d6f7b4e2f847ec1f2ff46c84e6157655984f85 wallet: Switch to using output groups instead of coins in coin selection (Karl-Johan Alm)
87ebce25d66952f5ce565bb5130dcf5e24049872 wallet: Add output grouping (Karl-Johan Alm)
bb629cb9dc567cc819724d9f4852652926e60cbf Add -avoidpartialspends and m_avoid_partial_spends (Karl-Johan Alm)
65b3eda458221644616d0fdd6ba0fe01bdbce893 wallet: Add input bytes to CInputCoin (Karl-Johan Alm)
a443d7a0ca333b0bae63e04b5d476f9ad9c7aeac moveonly: CoinElegibilityFilter into coinselection.h (Karl-Johan Alm)
173e18a289088c6087ba6fac708e322aa63b7a94 utils: Add insert() convenience templates (Karl-Johan Alm)

Pull request description:

  This PR adds an optional (off by default) `-avoidpartialspends` flag, which changes coin select to use output groups rather than outputs, where each output group corresponds to all outputs with the same destination.

  It is a privacy improvement, as each time you spend some output, any other output that is publicly associated with the destination (address) will also be spent at the same time, at the cost of fee increase for cases where coin select without group restriction would find a more optimal set of coins (see example below).

  For regular use without address reuse, this PR should have no effect on the user experience whatsoever; it only affects users who, for some reason, have multiple outputs with the same destination (i.e. address reuse).

  Nodes with this turned off will still try to avoid partial spending, if the fee of the resulting transaction is not greater than the fee of the original transaction.

  Example: a node has four outputs linked to two addresses `A` and `B`:

  * 1.0 btc to `A`
  * 0.5 btc to `A`
  * 1.0 btc to `B`
  * 0.5 btc to `B`

  The node sends 0.2 btc to `C`. Without `-avoidpartialspends`, the following coin selection will occur:
  * 0.5 btc to `A` or `B` is picked
  * 0.2 btc is output to `C`
  * 0.3 - fee is output to (unique change address)

  With `-avoidpartialspends`, the following will instead happen:
  * Both of (0.5, 1.0) btc to `A` or `B` is picked (one or the other pair)
  * 0.2 btc is output to `C`
  * 1.3 - fee is output to (unique change address)

  As noted, the pro here is that, assuming nobody sends to the address after you spend from it, you will only ever use one address once. The con is that the transaction becomes slightly larger in this case, because it is overpicking outputs to adhere to the no partial spending rule.

  This complements #10386, in particular it addresses @luke-jr and @gmaxwell's concerns in https://github.com/bitcoin/bitcoin/pull/10386#issuecomment-300667926 and https://github.com/bitcoin/bitcoin/pull/10386#issuecomment-302361381.

  Together with `-avoidreuse`, this fully addresses the concerns in #10065 I believe.

Tree-SHA512: 24687a4490ba59cf4198ed90052944ff4996653a4257833bb52ed24d058b3e924800c9b3790aeb6be6385b653b49e304453e5d7ff960e64c682fc23bfc447621

# Conflicts:
#	src/Makefile.am
#	src/bench/coin_selection.cpp
#	src/wallet/coincontrol.h
#	src/wallet/coinselection.cpp
#	src/wallet/coinselection.h
#	src/wallet/init.cpp
#	src/wallet/test/coinselector_tests.cpp
#	src/wallet/wallet.cpp
#	src/wallet/wallet.h
#	test/functional/test_runner.py
2021-06-24 13:21:20 -04:00
UdjinM6
bcc8b35194
Merge pull request #4178 from UdjinM6/backports-0.17-pr30
Merge #13033: Build txindex in parallel with validation
2021-06-05 22:08:47 +03:00
PastaPastaPasta
639f42abb7
instantsend: misc refactorings (#4017)
* instantsend: remove unused variable sum of input value

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

* instantsend: Access static member statically

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

* refac: make functions private as possible
2021-06-05 22:07:52 +03:00
UdjinM6
b4b24d370c
Merge pull request #4180 from UdjinM6/pre_pr4025_serialization
Various serialization backports
2021-05-29 23:23:19 +03:00
UdjinM6
011a178c60
Other Dash-specific serializations 2021-05-28 12:31:13 +03:00
UdjinM6
d60a6d1729
Convert bitset serializationis to use formatters 2021-05-28 12:31:13 +03:00
Pieter Wuille
671f1f8943
Merge #12954: util: Refactor logging code into a global object
8c2d695c4a util: Store debug log file path in BCLog::Logger member. (Jim Posen)
8e7b961388 scripted-diff: Rename BCLog::Logger member variables. (Jim Posen)
1eac317f25 util: Refactor GetLogCategory. (Jim Posen)
3316a9ebb6 util: Encapsulate logCategories within BCLog::Logger. (Jim Posen)
6a6d764ca5 util: Move debug file management functions into Logger. (Jim Posen)
f55f4fcf05 util: Establish global logger object. (Jim Posen)

Pull request description:

  This is purely a refactor with no behavior changes.

  This creates a new class `BCLog::Logger` to encapsulate all global logging configuration and state.

Tree-SHA512: b34811f54a53b7375d7b6f84925453c6f2419d21179379ee28b3843d0f4ff8e22020de84a5e783453ea927e9074e32de8ecd05a6fa50d7bb05502001aaed8e53
2021-05-25 14:09:35 +03:00
Pieter Wuille
7ff6515c88
Merge #13033: Build txindex in parallel with validation
9b2704777c [doc] Include txindex changes in the release notes. (Jim Posen)
ed77dd6b30 [test] Simple unit test for TxIndex. (Jim Posen)
6d772a3d44 [rpc] Public interfaces to GetTransaction block until synced. (Jim Posen)
a03f804f2a [index] Move disk IO logic from GetTransaction to TxIndex::FindTx. (Jim Posen)
e0a3b80033 [validation] Replace tx index code in validation code with TxIndex. (Jim Posen)
8181db88f6 [init] Initialize and start TxIndex in init code. (Jim Posen)
f90c3a62f5 [index] TxIndex method to wait until caught up. (Jim Posen)
70d510d93c [index] Allow TxIndex sync thread to be interrupted. (Jim Posen)
94b4f8bbb9 [index] TxIndex initial sync thread. (Jim Posen)
34d68bf3a3 [index] Create new TxIndex class. (Jim Posen)
c88bcec93f [db] Migration for txindex data to new, separate database. (Jim Posen)
0cb8303241 [db] Create separate database for txindex. (Jim Posen)

Pull request description:

  I'm re-opening #11857 as a new pull request because the last one stopped loading for people

  -------------------------------

  This refactors the tx index code to be in it's own class and get built concurrently with validation code. The main benefit is decoupling and moving the txindex into a separate DB. The primary motivation is to lay the groundwork for other indexers that might be desired (such as the [compact filters](https://github.com/bitcoin/bips/pull/636)). The basic idea is that the TxIndex spins up its own thread, which first syncs the txindex to the current block index, then once in sync the BlockConnected ValidationInterface hook writes new blocks.

  ### DB changes

  At the suggestion of some other developers, the txindex has been split out into a separate database. A data migration runs at startup on any nodes with a legacy txindex. Currently the migration blocks node initialization until complete.

  ### Open questions

  - Should the migration of txindex data from the old DB to the new DB block in init or should it happen in a background thread? The downside to backgrounding it is that `getrawtransaction` would return an error message saying the txindex is syncing while the migration is running.

  ### Impact

  In a sample size n=1 test where I synced nodes from scratch, the average time [Index writing](https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1903) was 3.36ms in master and 1.72ms in this branch. The average time between `UpdateTip` log lines for sequential blocks between 400,000 and IBD end on mainnet was 0.297204s in master and 0.286134s in this branch. Most likely this is just variance in IBD times, but I can try with some more trials if people want.

Tree-SHA512: 451fd7d95df89dfafceaa723cdf0f7b137615b531cf5c5035cfb54e9ccc2026cec5ac85edbcf71b7f4e2f102e36e9202b8b3a667e1504a9e1a9976ab1f0079c4
2021-05-25 13:48:04 +03:00
UdjinM6
7d44272ca3
instantsend: Actually relay islock inv when a tx is received later (#4167)
Extends 19145eba58 idea
2021-05-24 19:15:03 +03:00
UdjinM6
a02f8302d9
instantsend: Postpone mempool related cleanup fixes until dip0020 activation (#4159)
* instantsend: Upgrade IS db on dip0020 activation

* instantsend: Do not remove islocks for txes removed from mempool until dip0020 is activated

* refactor: introduce fUpgradedDB to avoid excessive locking and checking the state

* llmq: Decouple `fUpgradedDB` from `cs`

* Update src/llmq/quorums_instantsend.cpp

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

* Fix deadlock

Upgrade locks cs_main via GetTransaction

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-05-18 15:29:51 -05:00
UdjinM6
a89202726f
instantsend: Remove islocks for rejected/removed txes (#4155)
* instantsend: Resolve block conflicts first and take care of mempool ones later

* refactor: Rename RemoveChainLockConflictingLock -> RemoveConflictingLock

* instantsend: Handle transaction removal from mempool (for all reasons besides inclusion in blocks)

* instantsend: Remove old islocks with no known txes from db (once)

* refactor: Replace magic number with CURRENT_VERSION

* fix: Do not remove islocks for (yet) valid orphans

* Apply suggestions from code review

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

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-05-14 19:17:16 -05:00
dustinface
b06c69a48c
llmq: Drop quorumHeight in CDKGSessionHandler (#4128)
* llmq: Drop unused quorumHeight

* llmq: Adjust variable name in log

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2021-05-11 16:28:58 -05:00
UdjinM6
90d7e1f370
instantsend: Partially revert 3987, add more tests for CL vs IS conflicts (#4146)
* tests: Check that CLs override ISes which invalidated non-CLed blocks earlier

* partial revert 3987: Do not mark blocks which conflict with ISes as "conflicting"
2021-05-11 18:50:14 +02:00
UdjinM6
7616b04cb2
Rename bit 6 from "v17" to "dip0020" (#4142) 2021-05-07 18:36:30 +02:00
UdjinM6
1fde524ccb
llmq: Bump llmq leveldb cache size to 8 MiB (#4133) 2021-05-06 13:43:33 -04:00
UdjinM6
9862ea7e10
refactor: Drop excessive std::string conversions (#4130) 2021-05-05 23:30:35 -04:00
PastaPastaPasta
bf7b6adef2
refactor: Add a bunch of GUARDED_BY(*) in llmq code (#4121) 2021-04-27 17:11:45 +03:00
dustinface
9feb9250ce
rpc|llmq|test: Implement verifychainlock (#4119)
* llmq: Make CLSIG_REQUESTID_PREFIX available outside of quorums_chainlocks.cpp

* rpc: Implement `verifychainlock`

* test: Add rpc_verifychainlock.py

* rpc: Fix help text

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-04-26 13:51:15 +02:00
PastaPastaPasta
c5b919d084
Update copyright (#4115)
* run: `python3 contrib/devtools/copyright_header.py update .`

* bump copyright year
2021-04-20 22:33:02 +03:00
dustinface
cea353f4b8
Merge pull request #4099 from PastaPastaPasta/backports-0.17-pr28
Backports 0.17 pr28
2021-04-19 17:20:00 +02:00
Wladimir J. van der Laan
bb1ae8452c
Merge #12973: Avoid std::locale/imbue madness in DateTimeStrFormat
1527015 Avoid std::locale/imbue in DateTimeStrFormat (Pieter Wuille)

Pull request description:

  And replace them with just hardcoded ISO8601 strings and `gmtime_r`.

  Pointed out by @laanwj here: https://github.com/bitcoin/bitcoin/pull/12970#issuecomment-380962488

Tree-SHA512: a459758b42ca56f8462115aefe8e6377c1319fce509ea64dbb767f3f087c9b848335954cb684e5896c38008847684045505a3e1559fb3e83b8e80e10b003d1e7
2021-04-18 00:37:04 -04:00
UdjinM6
a8bef50052
Silence/tweak some log output (#4102)
* Silence some log output

* Drop redundant log output in ProcessGetData

* Tweak PushInventory log output
2021-04-17 15:23:54 -04:00
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
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
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
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
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
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
UdjinM6
308b4f7b62
llmq: Fix ProcessRecoveredSig bug (#4067)
Fixes #3960
2021-03-26 13:06:53 -04: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
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
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
PastaPastaPasta
9f4080d1ce
trivial: remove double space (#4045)
Signed-off-by: pasta <pasta@dashboost.org>
2021-03-19 11:24:28 +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
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
dustinface
716a07cab5
llmq: Drop unused timer in CDKGSession::FinalizeCommitments (#4034) 2021-03-12 14:42:14 -05:00
dustinface
cb6741b28f
llmq: Some refactoring in CInstantSendManager::ProcessTx (#4031)
* llmq: Let return ProcessTx void instead of bool

The returned boolean is never used..

* llmq: Combine some "bail out early" cases

* llmq: Explicitly check for nullptr
2021-03-12 14:41:37 -05:00
UdjinM6
58024dded0
bugfix: Add missing return in TrySignInputLocks (#4026) 2021-03-09 12:59:57 -05:00
PastaPastaPasta
6da3d5cad7
instantsend: Implement Spork 2 Mempool Signing signalling (#4024)
* instantsend: refactor input locking into it's own method

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

* instantsend: introduce spork 24 `SPORK_24_INSTANTSEND_SIGNING_ENABLED`

This spork tells masternodes to refuse to lock transactions in mempool. Only transactions included in a block should be retroactively signed.

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

add spork defenition

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

* instantsend: refactor `sed -i 's/allowReSigning/fRetroactive/g' src/llmq/*`

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

* instantsend: adjust comments

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

* instantsend/tests: implement Spork 24 support in tests, and test it's usage

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

* fix feature_llmq_is_retroactive.py

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

* drop Spork 24 and use Spork 2 value 1 as being no mempool signing

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

* fix spork check

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

* Fix tests

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

* Change comment

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

* IsInstantSendSigningEnabled -> IsInstantSendMempoolSigningEnabled

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-03-08 22:51:39 +03:00
PastaPastaPasta
38e222c483
trivial: remove unneeded lock (#4019)
Signed-off-by: pasta <pasta@dashboost.org>
2021-03-08 22:50:15 +03:00
PastaPastaPasta
fa06de1abc
trvial/quorums: Resolve some Clang-Tidy warnings
Signed-off-by: pasta <pasta@dashboost.org>
2021-02-28 15:26:50 -05:00
dustinface
a281cf6b3c
bls: Some char[] -> std::vector<uint8_t> refactoring in CBLSWrapper (#4010)
* refactor: CBLSWrapper::GetBuf -> CBLSWrapper::ToByteVector

* bls: Use std::vector<uint8_t> in CBLSWrapper::Unserialize

* bls: Refactor CBLSWrapper::SetBuf -> CBLSWrapper::SetByteVector

SetBuf(const void*, size_t) -> SetByteVector(std::vector<uint8_t>&)
2021-02-27 02:36:00 -05:00
UdjinM6
3d8f72a116
Rename -recsigsmaxage option to better match other similar options (#3997)
s/-recsigsmaxage/-maxrecsigsage/
2021-02-27 00:58:47 -05:00
UdjinM6
0b591043a0
instantsend: optimize db and cache usage (#3986)
* instantsend: keep islocks cache when removing confirmed islocks from db

unordered_lru_cache should truncate it automagically

* instantsend: Batched write/erase for connected/disconnected blocks
2021-02-24 12:32:34 -05:00
UdjinM6
821210a2ca
llmq: Avoid holding cs_data_requests longer than needed (#4009) 2021-02-23 01:47:36 +03:00
UdjinM6
07d020e1e1
chainlocks: Another attempt to fix deadlocks (#4007) 2021-02-23 01:47:13 +03:00
UdjinM6
8da57523b7
Make recently added help strings dynamic, add one missing string (#3996)
* docs: Add help for -recsigsmaxage option

* Make `-llmq-data-recovery` help string dynamic

* Make devnet/regtest specific help strings dynamic

Only show devnet related help strings on devnet.

* Make linter happy

* Skip FindDevNetGenesisBlock when creating devnet params for help purposes only
2021-02-23 01:46:40 +03:00
UdjinM6
c631d042c7
llmq: Use thread pool for quorum cache and data recovery threads (#4008)
* llmq: Use thread pool for quorum cache and data recovery threads

Move quorum data and cache thread handling into CQuorumManager.

* llmq: Fix explicit capture list

* llmq: Directly push the lamdas to workerPool

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-02-20 15:43:43 -05:00
UdjinM6
44e9ba50cc
instantsend: Ignore IS while reindexing/loading blocks from file, bail out early when IS is off (#3985)
* instantsend: Bail out early on disabled IS in more places

* instantsend: Disable InstantSend while reindexing and importing blocks

* Drop extra checks in GetInstantSendLockHashByTxid, GetInstantSendLockByInput and GetInstantSendLockByHash
2021-02-20 15:37:25 -05:00
UdjinM6
5d9c9089bb
instantsend: Introduce KnownInstantSendLock, optimize ProcessInstantSendLock a bit (#3984)
* instantsend: Introduce (and use) KnownInstantSendLock

Check islock hash against both current and archived islocks

* instantsend: Optimize ProcessInstantSendLock, check for known islocks first

Two reasons:
1. GetTransaction is a potentially much heavier one
2. Doesn't make much sense to look for a tx if we have a known islock already

* Drop extra pendingInstantSendLocks.count(hash)

* Check pindexMined != nullptr

* Update src/llmq/quorums_instantsend.cpp

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

* Update src/llmq/quorums_instantsend.h

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2021-02-17 10:59:16 -05:00
UdjinM6
77e9a4a83b
chainlocks: Relay clsig inv only after bestChainLock(Hash) are assigned (#3990)
Fixes a race condidion when we might reply with `notfound` to other nodes because we might still be waiting for locks here.
2021-02-16 16:54:19 +01:00
dustinface
6ec8b9a5c8
llmq: Some refactoring in CChainLocksHandler::ProcessNewChainLock (#3976)
* llmq: Drop InternalHasConflictingChainLock in ProcessNewChainLock

* llmq: Directly use clsig.blockHash instead of copying it into msgHash

* llmq: Reuse CInv(MSG_CLSIG, hash)

* llmq: Add const in two places
2021-02-14 16:12:40 -06:00
UdjinM6
054be30344
llmq: Sleep less in quorum data recovery threads (#3989)
Speeds up feature_llmq_data_recovery.py test ~25% and makes sense overall imo.
2021-02-14 16:11:20 -06:00
UdjinM6
f5e74c8a10
instantsend: Mark blocks as conflicting when there is a CL vs IS conflict (#3987)
* instantsend: Mark a block with IS-locks which conflict with txes in a CL-ed block as conflicting and not as invalid

* tests: Tweak feature_llmq_is_cl_conflicts.py to test CL overriding a block with conflicting IS-locks
2021-02-14 16:09:21 -06:00
UdjinM6
ee3e175722
instantsend: Refactor various parts (#3983)
* refactor: Add `const` qualifier to various InstantSend related methods

* refactor: Drop ProcessNewTransaction

* refactor: Simplify GetInstantSendLock(*) methods

* refactor: Check height inside Remove(Archived/Confirmed)InstantSendLocks

* refactor: Squash two loops in AddNonLockedTx into one

`!info.tx == res.second` is always `true`

* Update src/llmq/quorums_instantsend.cpp

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

* Update src/llmq/quorums_instantsend.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-02-14 16:07:54 -06:00
UdjinM6
899c124c76
instantsend|sigs: Sleep when there is no more work (#3988)
* instantsend|sigs: Sleep when there is no more work

Instead of sleeping only when no work has been done.
Avoids useless cycles, improves batching.

* llmq: Add and use nMaxBatchSize

* llmq: Compare to what we got in return, not what we verified at the end

It might happen that we get 32 pending but do only verify less than 32 and in this case we would assume there is no more work but it could still be more in the pipeline from my understanding.

* llmq: Rename more_work -> fMoreWork

* llmq: Be consistent with the other fMoreWork initialization

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-02-11 11:32:30 -05:00
UdjinM6
4c1a04a254
llmq: Avoid writing commitments to evodb and altering caches when all we want is to check block candidate validity (#3980)
* llmq: Avoid writing commitments to evodb and altering caches when all we want is to check block candidate validity

* tests: call `getblocktemplate` to trigger `CreateNewBlock` before quorum commitment is mined
2021-02-03 22:01:26 -05:00
dustinface
d6c6174958
llmq|init|test: Implement DKG data recovery / quorum verification vector sync (#3964)
* llmq: Implement automated DKG recovery threads

* llmq: Implement quorum verification vector sync

* init: Validiate quorum data recovery related command line parameter

* test: Add quorum_data_request_timeout_seconds in DashTestFramework

* test: Test quorum data recovery in feature_llmq_data_recovery.py

* test: Add feature_llmq_data_recovery.py to BASE_SCRIPTS

* test: Fix quorum_data_request_expiration_timeout in wait_for_quorum_data

* test: Always test the existence of secretKeyShare in test_mn_quorum_data

With this change it also validates that "secretKeyShare" is not in `quorum_info` if its not expected to be in there. Before this was basically just not tested.

* llmq|test: Use bool as argument type for -llmq-data-recovery

* llmq: Always set nTimeLastSuccess to 0

* test: Set -llmq-data-recovery=0 in p2p_quorum_data.py

* test: Simplify test_mns

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

* refactor: pass CQuorumCPtr to StartQuorumDataRecoveryThread

* test: Fix thread name in comment

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-02-01 17:10:19 +01:00
dustinface
d9105d8de1
llmq|rpc: Avoid some quorum data related copying (#3974)
* llmq|rpc: Return const reference in CQuorum::GetSkShare

* llmq: Refactor BuildQuorumContributions
2021-02-01 10:24:51 -05:00
UdjinM6
7c5710f64b
chainlocks: Fix potential deadlock (#3972)
Should fix this:
```
Previous lock order was:
 pnode->cs_sendProcessing  net.cpp:2854
 cs_main  net_processing.cpp:3946 (TRY)
 mempool.cs  net_processing.cpp:4183
 (1) pto->cs_inventory  net_processing.cpp:4183
 pto->cs_filter  net_processing.cpp:4233
 (2) cs  llmq/quorums_chainlocks.cpp:87
Current lock order is:
 cs_main  llmq/quorums_chainlocks.cpp:138
 (2) cs  llmq/quorums_chainlocks.cpp:138
 cs_vNodes  net.cpp:3662
 (1) cs_inventory  ./net.h:1085
```
2021-02-01 10:21:52 -05:00
dustinface
21cfb4c934
llmq|rpc|test|version: Implement P2P messages QGETDATA <-> QDATA (#3953)
* version: Bump PROTOCOL_VERSION and MIN_MASTERNODE_PROTO_VERSION

* version: Introduce LLMQ_DATA_MESSAGES_VERSION for QGETDATA/QDATA support

* test: Bump MY_VERSION to 70219 (LLMQ_DATA_MESSAGES_VERSION)

* llmq: Introduce CQuorumDataRequest as wrapper for QGETDATA requests

* llmq: Implement CQuorum::{SetVerificationVector, SetSecretKeyShare}

* llmq|net|protocol: Implement QGETDATA/QDATA P2P messages

* llmq: Restrict processing QGETDATA/QDATA to masternodes only

* llmq: Implement request limiting for QGETDATA/QDATA

* llmq: Implement CQuorumManger::RequestQuorumData

* rpc: Implement "quorum getdata" as wrapper around QGETDATA

Allows to trigger sending QGETDATA messages to connected peers by RPC.

* test: Handle QGETDATA/QDATA messages in mininode

* test: Add data structures to support QGETDATA/QDATA

* test: Add some helper in test_framework.py

* test: Implement tests for QGETDATA/QDATA in p2p_quorum_data.py

* test: Add p2p_quorum_data.py to BASE_SCRIPTS

* llmq|test: Add QWATCH support for QGETDATA/QDATA

* llmq: Store CQuorumPtr in cache, not CQuorumCPtr

* llmq: Fix cache usage after recent changes

* Use uacomment to create/find specific p2ps

* No need to use network adjusted time here, GetTime should be enough

* rpc: check proTxHash

* minor tweaks

* test: Adjustments after 4e27d6513e

* llmq: Rename and improve error lambda in CQuorumManager::ProcessMessage

* llmq: Process QDATA if -watchquorums is enabled

* test: Handle qwatch messages in mininode

* test: Add test for -watchquorums support

* test: Just some empty lines

* test: Properly stop the p2p network thread at the end of the test

* rpc: Adjust "quorum getdata" parameter descriptions

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

* rpc: Fix optionality of proTxHash in "quorum getdata" command

* test: Test optionality of proTxHash for "quorum getdata" command

* test: Be more specific about imports in p2p_quorum_data.py

* llmq|rpc: Add some comments about the request.GetDataMask checks

* test: Some more empty lines

* rpc: One more parameter description

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>

* test: Unify assert statements / drop parentheses for all of them

* fix typo

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

* adjust some line wrapping to 80 chars

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

* tests: Seperate out into dif atomic methods, add logging

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

* test: Avoid restarting masternodes, just let available requests expire

Just takes a lot time and isn't required imo.

* test: Drop redundant code/tests after separation

This was introduced in 9e224ec2f2

* test: Merge three tests

"test_mnauth_restriction", "test_invalid_messages" and "test_invalid_unexpected_qdata" with the resulting name "test_basics" because i don't feel like DKG recovery thing should be part of a test called "test_invalid_messages" and giving it an own test probably wouldn't make a lot sense because it would still depend on "test_invalid_messages". I also think there is no need for a separated "test_invalid_unexpected_qdata".

* test: Rename test_ratelimiting_banscore -> test_request_limit

* test: Apply python style

* test: Wrap all at 120 characters

Thats the default "draw annoying warnings" setting for PyCharm (and IMO a reasonable line length).

* test: Move some variables

* test: Optimize for speed

* tests: use wait_until in get_mininode_id

* test: Don't use `!=` to check for `None`

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
Co-authored-by: pasta <pasta@dashboost.org>
2021-01-28 17:33:18 -05:00
dustinface
dc2473cd04
llmq: Some fixes/improvements (#3943)
* llmq: Detach dash-q-cachepop from caller

There should be no reason to keep this tread attached
to its parent, if so, let me know.

* llmq: Avoid nullptr access for pindexStart in ScanQuorums

* llmq: Add cacheKey in ProcessCommitment

* llmq: Erase minable commitments if they have been processed

* llmq: Add CLLMQUtils::InitQuorumsCache

* llmq: Use unordered_lru_cache for quorumsCache and rename it

* llmq: Use unordered_lru_cache for hasMinedCommitmentCache and rename it

* llmq: Drop redundant check

* llmq: Rename nMaxCount2 -> nScanCommitments

* llmq: Refactor storeCache -> fCacheExists

* llmq: Rename maxCount -> nCountRequested

* llmq: Rename result -> vecResultQuorums

* llmq: Return an empty vector if the are zero elements requested

* unordered_lru_cache: Add max_size()

* llmq: Partially reuse existing cache if more than max is requested

* llmq: std::map<LLMQType, unordered_lru_cache<...>> for scanQuoumsCache

* llmq: Drop params

* llmq: Only emplace to cache if there is something available
2021-01-25 10:22:28 +01:00
UdjinM6
f69d0f4d64
instantsend: Relay IS-locks for matching txes when replying to merkleblock inv in getdata (#3959) 2021-01-25 00:01:08 -05:00
dustinface
ec1281c7ad
llmq: Store encrypted DKG contributitons (#3948)
* llmq: Add CDKGSessionManager::WriteEncryptedContributions

Allows to store each member's encrypted contributions of the DKG.

* llmq: Store each member's contributions in the llmq database

* llmq: Add CDKGSessionManager::GetEncryptedContributions

I decided to don't cache here since its probably very unlikely this is called twice in a short period with what we have planed for it so far. We can add caching if the requirement for it changes at some point?
2021-01-22 10:11:06 -05:00
UdjinM6
1e0cc1254c
Use single-threaded scheduler for IS, CL and Governance notifications (#3954)
* Use single-threaded scheduler for IS, CL and Governance notifications

* Pass shared_ptr-s instead of objects themselves for CL, IS and Governance notifiers in CMainSignals/CValidatibnInterface

* llmq: Create shared_ptr for clsig at the root of its lifetime

* llmq: Create shared_ptr for islock clsig at the root of its lifetime

* llmq: Create shared_ptr for recSig at the root of its lifetime

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-01-21 23:32:15 -05:00
PastaPastaPasta
f4c39a5897
Simplify PreVerifyInstantSendLock (#3941)
Signed-off-by: pasta <pasta@dashboost.org>
2021-01-18 20:29:10 +01:00
dustinface
ddb57ce2a3
llmq: Some refactoring in CQuorumManger (#3935)
* llmq: Refactor CQuorumManager::{BuildQuorumFromCommitment, GetQuorum}

Construct and cache new quorums inside BuildQuorumFromCommitment

* llmq: Make all methods of CQuorumManager const
2021-01-18 13:54:50 -05:00
dustinface
bdbadc1809
llmq:: Return const reference in GetLLMQParams() and move it out of CLLMQUtils (#3936)
* llmq: Return const reference in CLLMQUtils::GetLLMQParams

* llmq: Move GetLLMQParams out of CLLMQUtils
2021-01-18 01:27:29 +01:00
UdjinM6
482ba4f5ae
Always mark conflicting blocks with BLOCK_CONFLICT_CHAINLOCK flag (#3924)
* More accurate handling of the BLOCK_CONFLICT_CHAINLOCK flag

* Update test/functional/feature_llmq_chainlocks.py

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

* tests: make sure that previous tip on the reorged node is marked conflicting after chainlock

* Apply suggestions from code review

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

Co-authored-by: thephez <thephez@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-01-16 14:47:13 -05:00
dustinface
cc8a1bc19c
llmq|rpc|test: Add optional "submit" parameter to "quorum sign" (#3917)
* llmq: Split CSigShare creation/processing in CSigSharesManager

* rpc: Add "submit" parameter to "quorum sign"

* test: Add CSigShare and msg_qsigshare to messages.py

* test: Test the optional "submit" parameter of "quorum sign"
2021-01-14 20:53:26 +01:00
Kittywhiskers Van Gogh
4f38f5c2ef
Partial merge bitcoin#14624: Some simple improvements to the RNG code (#3923)
* random: Introduce std::shuffle alternative for FastRandomContext

3db746beb4

* random: change std::random_shuffle calls to std::shuffle

https://en.cppreference.com/w/cpp/algorithm/random_shuffle (deprecated in c++14)

* random: change FastRandomContext std::random_shuffle calls to shuffle

* random: change last std::shuffle calls to Shuffle

std::shuffle doesn't accept only two arguments so we use FastRandomContext()

* llmq: use inherited FastRandomContext

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

* llmq: use inherited FastRandomContext

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

* Make the linter happy :)

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-01-14 13:46:16 -06:00
UdjinM6
38ac83e385
Do not store hashes in ProcessPendingMessageBatch and do not pass them to ReceiveMessage-s (#3921)
* Do not store hashes in ProcessPendingMessageBatch and do not pass them to ReceiveMessage-s

* follow up: refactor/unify code in ProcessPendingMessageBatch
2021-01-14 13:42:08 -06:00
dustinface
0f62d55af6
llmq|rpc|test: Fix "quorumHash" parameter of "quorum sign" (#3914)
* llmq: Add an optional quorum hash to CSigningManager::AsyncSignIfMember

Allows to select the quorum to sign by its hash.

* rpc: Fix quorum selection of "quorum sign"

* test: Test the optional "quorumHash" parameter of "quorum sign"

* llmq: Move quorum checks up to avoid calling WriteVoteForId if they fail
2021-01-11 11:17:41 -06:00
dustinface
885dcb1b66
refactor: Drop some unused code (#3919)
* llmq: Drop hash parameter in PreVerifyMessage methods

* llmq: Drop some unused variables

* rpc: Drop unused variable

* llmq|net: Drop some unused CConnman parameter

* llmq: Drop some unused quorum parameter

* llmq: Drop some unused nodeId parameter

* Drop unused variables

* llmq: Drop more

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-01-10 21:28:37 -06:00
UdjinM6
8178b297ee
spork: Introduce SPORK_23_QUORUM_POSE (#3907)
This splits SPORK_21_QUORUM_ALL_CONNECTED into two which should let us control node connectivity and quorum PoSe individually.
2021-01-10 21:23:01 -06:00