Commit Graph

18883 Commits

Author SHA1 Message Date
dustinface
0c1a02be2c
net|rpc: getpeerinfo - Add verified_pubkey_hash, fix a typo in verified_proregtx_hash docs (#3929)
* net|rpc: Add verified_pubkey_hash in getpeerinfo for MN connections

* Apply suggestions from code review

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

* rpc: One more typo

Co-authored-by: thephez <thephez@users.noreply.github.com>
2021-01-22 17:12:22 -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
Kolby Moroz Liebl
e197f976e1
backport bitcoin#16509 and add devnet test (#3946)
* Merge #16509: test: Adapt test framework for chains other than "regtest"

faf36838bdba7393960fce6ad0c56dc1f93f5870 test: Avoid hardcoding the chain name in combine_logs (MarcoFalke)
fa8a1d7ba30040f8c74f93fc41a61276c255a6a6 test: Adapt test framework for chains other than "regtest" (MarcoFalke)
68f546635d5de2ccfedadeabc7bc79e12e5eca6a test: Fix “local variable 'e' is assigned to but never used” (Ben Woosley)

Pull request description:

  This is required for various work in progress:

  * testchains #8994
  * signet #16411
  * some of my locally written tests

  While it will be unused in the master branch as of now, it will make all of those pull requests shorter. Thus review for non-regtest tests can focus on the actual changes and not some test framework changes.

ACKs for top commit:
  jonatack:
    ACK faf36838bdba7393960fce6ad0c56dc1f93f5870, ran tests and reviewed the code.

Tree-SHA512: 35add66c12cab68f2fac8f7c7d47c604d3f24eae9336ff78f83e2c92b3dc08a25e7f4217199bac5393dd3fb72f945bba9c001d6fbb8efd298c88858075fcb3d6

* Add devnet support for tests

* test: make sure devnet can connect to each other and start

* Partial merge bitcoin/bitcoin#16681: Tests: Use self.chain instead of 'regtest' in almost all current tests, revert one TODO while at it

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
Co-authored-by: Jorge Timón <jtimon@jtimon.cc>
2021-01-22 09:58:07 -05:00
dustinface
e695209d6c
spork: Add more constness in CSporkManager and CSporkMessage (#3955) 2021-01-22 00:57:42 -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
dustinface
ccbf574fa3
chainparams|init: Add -llmqinstantsend command line parameter for devnets (#3956)
* chainparams: Add methods to adjust llmqTypeInstantSend

* init: Add -llmqinstantsend command line parameter for devnets
2021-01-21 14:29:14 -06:00
dustinface
e6cc0b9bec
bls: Modify CBLSIES classes - Introduce individually encrypted objects (#3937)
* bls: Adjust CBLSIESEncryptedBlob to match CBLSIESMultiRecipientBlobs

With this change a single encrypted object of CBLSIESMultiRecipientBlobs is has the same structure like CBLSIESEncryptedBlob

* bls: Add CBLSIESEncryptedObject constructor

* bls: Add CBLSIESMultiRecipientObjects::Get

Allows to query a individual encrypted object as CBLSIESEncryptedObject

* bls: Drop unneeded constructor call

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-01-21 14:25:42 -06:00
UdjinM6
62c38282d8
blockchain: Implement auto-recovery from hardforks (#3926)
* Implement auto-recovery from hardforks

This should help users who fail to update their nodes/wallets in time when there is a hardfork.

* tests: tweak feature_llmq_chainlocks.py to check new behaviour

* tests: tidy up feature_llmq_chainlocks.py a bit
2021-01-21 11:18:25 -05:00
PastaPastaPasta
393ed59718
spork: implement spork caching (#3942)
* Implement Spork Caching

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

* spork: Add missing lock

* spork: Keep constness of SporkValueIsActive

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-01-21 03:04:14 +01:00
thephez
3f51db3401
docs: fix typo in addmultisigaddress (#3952) 2021-01-20 17:30:14 -05:00
UdjinM6
e9341da0a7
spork: Fix a couple of issues with multikey sporks cleanup, add more tests (#3947)
* Fix a couple of issues with multikey sporks cleanup

1. Should remove sporks with signatures from unknown signers from mapSporksActive
2. Should advance itSignerPair while doing (1)...

* tests: make sure sporks cleanup works as expected for multikey sporks

* tests: make sure multiple multikey sporks (and their cleanups) work together as expected

* Prettify node extra args
2021-01-20 17:27:41 -05:00
UdjinM6
e6a351993b
privatesend: Track mixing rounds via CTxDSIn and not via CTxOut (#3950)
* Do not use CTxDSIn when we don't care about PS rounds

Also refactor CreateCollateralTransaction

* Track input rounds via CTxDSIn and not via CTxOut

* refactor: Create collateral transactions in CPrivateSendClientSession

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-01-20 11:38:05 -05:00
UdjinM6
dcad667e17
wallet: Detect potential deadlocks in AddToWallet (#3949) 2021-01-20 11:36:09 -05:00
UdjinM6
fc92f8e13e
wallet: Update wallet utxo set when new keys are found for already known transactions (#3944)
* wallet: Update wallet utxo set when new keys are found for already known transactions

* Update src/wallet/wallet.cpp

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

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-01-20 11:35:46 -05:00
UdjinM6
611511589d
privatesend: Calculate base size in CTransactionBuilder ctor based on actual scriptPubKey-s (#3938)
* Store CInputCoin-s instead of COutpoint-s in CompactTallyItem

* Calculate base size in CTransactionBuilder ctor based on actual scriptPubKey-s

It breaks on non-p2pkh otherwise.
2021-01-20 11:31:51 -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
4a6eee2511
test: Check for the actual llmq_test session, not just for any (#3934) 2021-01-15 21:59:42 -05:00
dustinface
59991bec25
test/refactor: Fix typo, remove_mastermode -> remove_masternode (#3931) 2021-01-14 14:00:57 -06:00
UdjinM6
1f1f2d8078
refactor: Rename fMasternode and fMasternodeProbe (#3928)
* fMasternode -> m_masternode_connection

* fMasternodeProbe -> m_probe_connection

* probe_connection -> masternode_probe_connection
2021-01-14 13:59:18 -06:00
Kolby Moroz Liebl
3ee7c291b0
qt: Add masternode info to peer page (#3927)
* Add masternode info to peer page

* Update src/qt/forms/debugwindow.ui

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

* Use verifiedProRegTxHash to check if node is masternode

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-01-14 13:55:06 -06: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
a3a391dd32
rpc|test: Improve platform restrictions, add new commands to the whitelist (#3918)
* rpc: Rename platformAllowedCommands => mapPlatformRestrictions

* rpc: Use std::multimap instead of std::map for mapPlatformRestrictions

* rpc|init: Move restrictions to CRPCTable and initialize them in seperate

This is to allow restrictions based on the currently active network.

* rpc: Allow multiple parameter of type UniValue for mapPlatformRestrictions

* rpc: Add "quorum {sign,verify}" to the platform-user whitelist

* test: Add "quorum {sign, verify}" tests, test some invalid combinations

* rpc|test: Add verifyislock to platform-user whitelist
2021-01-14 13:39:34 -06:00
tomthoros
4ce3635d99
Consensus: DIP-0020: Dash opcode updates. Remaining dip0020 opcodes (#3893)
* DIP-0020: Dash opcode updates - enable AND, OR, XOR

* DIP-0020: Dash opcode updates - enable DIV, MOD

* DIP-0020: Dash opcode updates - enable BIN2NUM, NUM2BIN

* DIP-0020: Dash opcode updates - enable CHECKDATASIG, CHECKDATASIGVERIFY (no tests)

* DIP-0020: Dash opcode updates - fix whitespace

* DIP-0020: Dash opcode updates - add checkdatasig and datacheckdatasigverify json tests

* More AND_OR_XOR tests

* DIP-0020: Dash opcode updates - move opcodes enabled tests around. Add unit tests back

* DIP-0020: Dash opcode updates - sort BITCOIN_TESTS aplhabetically

* DIP-0020: Dash opcode updates - formatting

* DIP-0020: Dash opcode updates - formatting

* DIP-0020: Dash opcode updates - formatting references alignment

* DIP-0020: Dash opcode updates - formatting references alignment

* Update src/script/interpreter.h

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

* Update src/script/interpreter.h

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

* Update src/test/script_tests.cpp

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-13 14:45:04 -06:00
PastaPastaPasta
79ef4f8dee
Adjust version formatting and add formatted version to rpc (#3908)
* Always show full version precision

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

* add field "formattedversion" to `getnetworkinfo` that is the version, to include rc info, commit info, dirty, etc as available

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

* use `buildversion` instead of `formattedversion`

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

* adjust unit tests

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-01-11 20:34:42 +01: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
UdjinM6
f3e8401da5
rpc: Introduce verifyislock (#3906)
* Introduce `verifyislock` rpc

* Update test/functional/rpc_verifyislock.py

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

Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2021-01-11 11:13:50 -06:00
Kolby Moroz Liebl
724db5e1cb
rpc: Add runtime error for Generate commands when the build compiles without mining support (#3922)
* Add runtime error for generate commands when builds compile without mining support

* Update src/rpc/mining.cpp

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

* Update src/wallet/rpcwallet.cpp

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-01-10 21:30:24 -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
UdjinM6
074318a9ba
rpc: Introduce quorum verify (#3904)
* rpc: Introduce `quorum verify`

* test: Test both "quorum not found" paths

* rpc: Check both "quorum not found" failures in one place

* rpc: Adjust description of "quorum verify"

* auto -> int

Co-authored-by: xdustinface <xdustinfacex@gmail.com>
2021-01-10 21:21:16 -06:00
PastaPastaPasta
84ed589c15
Merge pull request #3903 from UdjinM6/bp11372
Backport 11167 (partial), 11372, 11630 and 14242
2021-01-10 21:20:47 -06:00
UdjinM6
7b3bac65eb
tests: fix random feature_dip4_coinbasemerkleroots.py failures (#3916) 2021-01-08 13:56:32 -06:00
UdjinM6
c4e269cf0c
A couple of fixes for stats (#3920)
* Use gaugeDouble for hashrate and difficulty stats

* Add transactions.totalTransactions gauge

Also group "transactions" gauges in PeriodicStats
2021-01-08 13:45:57 -06:00
UdjinM6
51027eed43
tests: Test all rpc commands in rpc_platform_filter.py (#3913)
* tests: Test all rpc commands in rpc_platform_filter.py

* bugfix: test "debug 1" instead of "stop" to avoid interference with the regular test shutdown process

* 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-01-08 13:43:59 -06:00
UdjinM6
171b17523f
Fix quorum selection for low heights (#3912) 2021-01-08 13:39:40 -06:00
dustinface
aff2d47ee8
llmq: Improve/Fix GetVerifiedContributions (#3911)
* llmq: Fix GetVerifiedContribution to return false in case of failure

* llmq: Move GetVerifiedContribution into GetVerifiedContributions

* llmq: Drop GetVerifiedContribution

* llmq: Keep cache locked while building GetVerifiedContributions result

* llmq: Read from DB into vvecPtr directly
2021-01-08 13:36:26 -06:00
Wladimir J. van der Laan
5cf45844d8
Merge #14242: Avoid triggering undefined behaviour (std::memset(nullptr, 0, 0)) if an invalid string is passed to DecodeSecret(...)
d855e4cac8303ad4e34ac31cfa7634286589ce99 Avoid triggering undefined behaviour (std::memset(nullptr, 0, 0)) if an invalid string is passed to DecodeSecret(...) (practicalswift)

Pull request description:

  Avoid triggering undefined behaviour (`std::memset(nullptr, 0, 0)`) if an invalid string is passed to `DecodeSecret(...)`.

  Background reading: [memcpy (and friends) with NULL pointers](https://www.imperialviolet.org/2016/06/26/nonnull.html)

  Steps to reproduce:

  ```
  ./configure --with-sanitizers=undefined && make check && ./test/functional/test_runner.py
  ```

Tree-SHA512: b8325ced4f724d9c03065e0747af56b1f297a90d9fb09a24d46c3231a90dce3df6299f2c41f863b5cec18eaeded7b46ee4b93d9a52adc2541eb4c44d2c0965d9
2021-01-08 22:35:46 +03:00
Wladimir J. van der Laan
fbb40717b4
Merge #11630: Simplify Base32 and Base64 conversions
b3ea8ccb7 Simplify Base32 and Base64 conversions (Pieter Wuille)
3296a3bb7 Generalize ConvertBits (Pieter Wuille)

Pull request description:

  Generalize `ConvertBits` a bit to also be usable for the existing Base32 and Base64 convertions (rather than just for Bech32).

Tree-SHA512: 3858247f9b14ca4766c08ea040a09b1d6d70caaccc75c2436a54102d6d526f499ec07f5bdfcbbe16cbde5aae521cd16e9aa693e688a97e6c5e74b8e58ee55a13
2021-01-08 22:35:46 +03:00
Wladimir J. van der Laan
70c82570b2
Merge #11372: Address encoding cleanup
92f1f8b31 Split off key_io_tests from base58_tests (Pieter Wuille)
119b0f85e Split key_io (address/key encodings) off from base58 (Pieter Wuille)
ebfe217b1 Stop using CBase58Data for ext keys (Pieter Wuille)
32e69fa0d Replace CBitcoinSecret with {Encode,Decode}Secret (Pieter Wuille)

Pull request description:

  This PR contains some of the changes left as TODO in #11167 (and built on top of that PR). They are not intended for backporting.

  This removes the `CBase58`, `CBitcoinSecret`, `CBitcoinExtKey`, and `CBitcoinExtPubKey` classes, in favor of simple `Encode`/`Decode` functions. Furthermore, all Bitcoin-specific logic (addresses, WIF, BIP32) is moved to `key_io.{h,cpp}`, leaving `base58.{h,cpp}` as a pure utility that implements the base58 encoding/decoding logic.

Tree-SHA512: a5962c0ed27ad53cbe00f22af432cf11aa530e3efc9798e25c004bc9ed1b5673db5df3956e398ee2c085e3a136ac8da69fe7a7d97a05fb2eb3be0b60d0479655

Make linter happy

Dashify
2021-01-08 22:35:34 +03:00
Pieter Wuille
c9936a5115
Partial merge bitcoin#11167: Full BIP173 (Bech32) support
Implement {Encode,Decode}Destination without CBitcoinAddress

Import Bech32 C++ reference code & tests

This includes a reformatted version of the Bech32 reference code
(see https://github.com/sipa/bech32/tree/master/ref/c%2B%2B), with
extra documentation.

Convert base58_tests from type/payload to scriptPubKey comparison

Add regtest testing to base58_tests

Implement ConvertBits

A part of "Implement BIP173 addresses and tests"

Make linter happy
2021-01-08 22:35:13 +03:00
UdjinM6
72f2e50e54
Use build badges provided by Gitlab (#3915) 2021-01-08 13:33:50 -06:00
UdjinM6
52cbc7fe0d
Extend activation timeout for all past bits (#3905)
Set `nTimeout` to `999999999999ULL` on testnet and devents for all bits that were activated on mainnet already to ensure they are going to be activated on future network resets.
2020-12-31 15:43:43 +01:00
PastaPastaPasta
9aaa23072c
Merge pull request #3886 from xdustinface/backport-11536
backport: Deprecate accounts
2020-12-30 13:38:17 -06:00
UdjinM6
a06eba3eb9
Implement kqueue support (#3892) 2020-12-30 13:34:42 -06:00
UdjinM6
bfe6c7ca5e
Fix thread names to fit into 15 symbols (#3897) 2020-12-30 13:33:45 -06:00