Commit Graph

19052 Commits

Author SHA1 Message Date
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
UdjinM6
7099dea2e4
Merge pull request #3939 from PastaPastaPasta/backport-addrv2
Backport partial addrv2 support
2021-01-29 11:39:00 +03:00
UdjinM6
3c768739fc
chainlocks: Send an inv for the best ChainLock we have when replying to mempool p2p message (#3962) 2021-01-28 21:55:58 -05:00
UdjinM6
2aa584ba33
rpc: Loop through all nodes when looking for one to override mnauth data for (#3971) 2021-01-28 21:16:28 -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
UdjinM6
5d4431c017
refactor: Add (and use) queueAndMaybePushInv helper (#3961) 2021-01-25 22:35:18 -05:00
PastaPastaPasta
671b336a34
refactor: misc. governance refactoring (#3958)
* fix typos

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

* remove unneeded initialization

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

* make method const

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

* use default for trivial destructor

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

* governance: remove all typedefs for iterators, use auto instead

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

* remove redundant size_type

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

* Remove unused and singly used typedefs

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

* remove unused code

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

* mark constructor as explicit

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

* remove unused typedef

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

* remove unneeded initialization

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

* remove singly used typedef

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

* pass const reference, and don't copy for no reason

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

* make method const

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

* make method const

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

* make method const

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

* typo

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

* make constructor explicit

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

* Clang-Tidy: 'virtual' is redundant since the function is already declared 'override'

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

* Clang-Tidy: Prefer using 'override' or (rarely) 'final' instead of 'virtual'

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

* use default for trivial destructor

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

* remove unused include

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

* remove unneeded semicolon

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

* fix typos

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

* fix typo

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

* mark constructor explicit

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

* remove unused typedef

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

* remove commented out code

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

* mark constructor explicit

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

* remove unused spork

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

* remove boolean check where always true

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

* make method const

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

* Remove nCount completely

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

* Use default path

Signed-off-by: pasta <pasta@dashboost.org>
2021-01-25 22:31:31 -05:00
UdjinM6
783f07e9f7
tests: Add uacomment in P2PConnection and use it to create (correct network specific) strSubVer (#3969) 2021-01-25 19:35:17 +01: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
UdjinM6
a328756396
Flush callbacks one more time at shutdown (#3963)
This is needed to be able to process SetBestChain callback generated by the first FlushStateToDisk call in PrepareShutdown

Partially reverts #3378
2021-01-24 23:56:18 -05:00
UdjinM6
48bf736525
wallet: Upgrade path for non-HD wallets to HD (#3933)
* Check mnemonic passphrase size in SetMnemonic instead of CreateWalletFromFile

* Move processing of cmd-line options and recovery via hdseed out of GenerateNewHDChain

* Implement GenerateNewHDChainEncrypted and tweak EncryptHDChain to be able to generate new encrypted HD chains in an already encrypted wallet

* rpc: Implement upgradetohd rpc

* Address review comments

* tweak rpc response

* tests: Test various non-HD to HD wallet upgrade paths

* Apply suggestions from code review

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

* Fix suggestions

* tests: Check upgradetohd return value

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2021-01-24 22:03:33 -05:00
dustinface
ce3bcab3ab
rpc|test: Introduce "mnauth" RPC command to override masternode authentications (#3930)
* rpc: Introduce "mnauth" RPC command to fake masternode authentications

* test: Test "mnauth" RPC command

* test: Add rpc_mnauth.py to BASE_SCRIPTS

* Update src/rpc/misc.cpp

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

* Update test/functional/rpc_mnauth.py

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2021-01-24 21:50:16 -05:00
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
Wladimir J. van der Laan
888f36abe7
Merge #19534: net: save the network type explicitly in CNetAddr
bcfebb6d5511ad4c156868bc799831ace628a225 net: save the network type explicitly in CNetAddr (Vasil Dimov)
100c64a95b518a6a19241aec4058b866a8872d9b net: document `enum Network` (Vasil Dimov)

Pull request description:

  (chopped off from https://github.com/bitcoin/bitcoin/pull/19031 to ease review)

  Before this change, we would analyze the contents of `CNetAddr::ip[16]`
  in order to tell which type is an address. Change this by introducing a
  new member `CNetAddr::m_net` that explicitly tells the type of the
  address.

  This is necessary because in BIP155 we will not be able to tell the
  address type by just looking at its raw representation (e.g. both TORv3
  and I2P are "seemingly random" 32 bytes).

  As a side effect of this change we no longer need to store IPv4
  addresses encoded as IPv6 addresses - we can store them in proper 4
  bytes (will be done in a separate commit). Also the code gets
  somewhat simplified - instead of
  `memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0` we can use
  `m_net == NET_IPV4`.

ACKs for top commit:
  troygiorshev:
    reACK bcfebb6d5511ad4c156868bc799831ace628a225 via `git range-diff master 64897c5 bcfebb6`
  jonatack:
    re-ACK bcfebb6 per `git diff 662bb25 bcfebb6`, code review, debug build/tests clean, ran bitcoind.
  laanwj:
    Code review ACK bcfebb6d5511ad4c156868bc799831ace628a225

Tree-SHA512: 9347e2a50feac617a994bfb46a8f77e31c236bde882e4fd4f03eea4766cd5110216f5f3d24dee91d25218bab7f8bb6e1d2d6212a44db9e34594299fd6ff7606b
Signed-off-by: pasta <pasta@dashboost.org>

# Conflicts:
#	src/netaddress.cpp
#	src/netaddress.h
2021-01-18 16:12:49 -05:00
Wladimir J. van der Laan
3af7c994db
Merge #19351: test: add two edge case tests for CSubNet
ccef5d7bf0af8377c6c779295f7b41d5af435c47 test: add two edge case tests for CSubNet (Vasil Dimov)

Pull request description:

  This is chopped off from https://github.com/bitcoin/bitcoin/pull/19031. It is needed because later 19031 modifies the related code and the tests ensure that no surprising changes in behavior sneak in.

ACKs for top commit:
  practicalswift:
    ACK ccef5d7bf0af8377c6c779295f7b41d5af435c47 -- more test coverage is better than less test coverage :)
  laanwj:
    ACK ccef5d7bf0af8377c6c779295f7b41d5af435c47
  hebasto:
    ACK ccef5d7bf0af8377c6c779295f7b41d5af435c47, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 6d386672b6598aeddd33dabe3512e816cf548d5c1af56c4c9e6f897d513b62ba4659cde73405811a0df286ffee3a3f084ab7caf8e3a2086fa9ddecd1bdcb3c67
2021-01-18 16:12:49 -05:00
Wladimir J. van der Laan
233232ce3e
Merge #15689: netaddress: Update CNetAddr for ORCHIDv2
8be3f3063 netaddress: Update CNetAddr for ORCHIDv2 (Carl Dong)

Pull request description:

  ```
  The original ORCHID prefix was deprecated as of 2014-03, the new
  ORCHIDv2 prefix was allocated by RFC7343 as of 2014-07. We did not
  consider the original ORCHID prefix routable, and I don't see any reason
  to consider the new one to be either.
  ```

  Would like to know if people think this kind of thing is even worth keeping the codebase updated for. Perhaps it'd be nice to write a devtool to pull the csv from [here](https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml) and generate the code.

ACKs for commit 8be3f3:
  laanwj:
    utACK 8be3f3063
  ryanofsky:
    utACK 8be3f306338e27b3fa3ad3bfb75f822d038909a5. Only change since last review is rebasing after #15718 merge.

Tree-SHA512: 7c93317f597b1a6c1443e12dd690010392edb9d72a479a8201970db7d3444fbb99a80b98026caad6fbfbebb455ab4035d2dde79bc9263bfd1d0398cd218392e1
2021-01-18 16:12:49 -05:00
pasta
a9a9c3d865
Very partial merge bitcoin#19219
Signed-off-by: pasta <pasta@dashboost.org>
2021-01-18 16:12:49 -05:00
UdjinM6
78328c1898
Fix CService (de)serialization 2021-01-18 16:12:41 -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
Wladimir J. van der Laan
e8c6989e95
Merge #19360: net: improve encapsulation of CNetAddr
bc74a40a56128f81f11151d5966f53b82f19038c net: improve encapsulation of CNetAddr (Vasil Dimov)

Pull request description:

  Do not access `CNetAddr::ip` directly from `CService` methods.

  This improvement will help later when we change the type of
  `CNetAddr::ip` (in the BIP155 implementation).

  (chopped off from https://github.com/bitcoin/bitcoin/pull/19031 to ease review)

ACKs for top commit:
  dongcarl:
    ACK bc74a40a56128f81f11151d5966f53b82f19038c
  naumenkogs:
    ACK bc74a40
  fjahr:
    Code review ACK bc74a40
  laanwj:
    code review ACK bc74a40a56128f81f11151d5966f53b82f19038c
  jonatack:
    ACK bc74a40a56128f81f11151d5966f53b82f19038c
  jnewbery:
    ACK bc74a40a5

Tree-SHA512: 29a203905538e8311e3249b78565abe69ce36dc4ec239bec85c726c30e1a7b55b0aaf5c6659b676935008e068cfa53d716f7a598469064108daf130f94329a5d
2021-01-16 01:21:16 -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