Commit Graph

18968 Commits

Author SHA1 Message Date
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
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
UdjinM6
8d0ff7d441
Fix versionbits cache usage in IsQuorumTypeEnabled (#3901) 2020-12-29 11:30:50 +01:00
UdjinM6
2faf8744bd
Do not shadow sigSharesToAnnounce (#3902)
Rename `sigSharesToAnnounce` class member in `CSigSharesManager` to `sigSharesQueuedToAnnounce` to avoid confusion with local variables/function args with the same name
2020-12-28 12:27:33 +01:00
UdjinM6
f1eaaf0f24
trivial: Fix release-notes-0.16.0.1 file extension (#3900) 2020-12-28 12:24:07 +01:00
UdjinM6
687aece098
Harden DIP0008 activation (#3889)
* Harden DIP0008 activation

* Update src/llmq/quorums_instantsend.cpp

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

* Update test/functional/test_framework/test_framework.py

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>
2020-12-28 12:21:01 +01:00
dustinface
7da706f8e4
bls: Directly assign some aggregation results (#3899) 2020-12-26 19:16:09 -06:00
UdjinM6
904420ba36
Fix CDKGSessionHandler thread names (#3896)
Some compilers seems to have an issue with this implicit conversion producing garbage instead of numbers.
2020-12-26 19:05:01 -06:00
UdjinM6
fade3c440a
Fix WakeSelect() (#3895)
Fixes `Syscall param write(buf) points to uninitialised byte(s)`
2020-12-26 19:02:13 -06:00
dustinface
52336be438
Revert "Merge bitcoin#13782: Fix osslsigncode compile issue in gitian-build"
We use osslsigncode 2.0 already due to dashpay#3258 so this commit reverts backport of bitcoin#13782 (619f7fb862)
2020-12-26 18:59:22 -06:00
thephez
4f077caf3b
rpc: remove duplicated type field from gobject list-prepared (#3881)
* rpc: remove duplicated type field from gobject list-prepared

* Remove one more "type"
2020-12-23 17:27:07 -06:00
UdjinM6
3e65238a74
rpc: masternode winners results should also include operator addresses (#3862)
* rpc: `masternode winners` results should also include operator addresses

* Add tests

* 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>
2020-12-23 17:24:06 -06:00
Wladimir J. van der Laan
96d306324f Merge #14441: [wallet] Backport(0.17): Restore ability to list incoming transactions by label
89306ab0df93bfdf5630910bc20b1eccb7379172 [wallet] Restore ability to list incoming transactions by label (Russell Yanofsky)

Pull request description:

  Backport of PR #14411 to v0.17.

  This change partially reverts #13075 and #14023.

  Fixes #14382

Tree-SHA512: 1f8300e1a79e826cd706561265b8788deef505fa510be1a76ed9a62e5fca37cf6a741423ac0e5de2a36d6e8b9f25f141885455aacacbbf6474814e6eae406a27
2020-12-22 17:58:12 +01:00
xdustinface
e9ba46c543 rpc: Use fAddLocked of CWallet::GetBalance in getbalance rpc command 2020-12-22 17:58:12 +01:00
xdustinface
dd80c54579 wallet: Add fAddLocked to CWallet::GetBalance() 2020-12-22 17:58:12 +01:00
Pieter Wuille
341b5a9714 Merge #13566: Fix get balance
702ae1e21a [RPC] [wallet] allow getbalance to use min_conf and watch_only without accounts. (John Newbery)
cf15761f6d [wallet] GetBalance can take a min_depth argument. (John Newbery)
0f3d6e9ab7 [wallet] factor out GetAvailableWatchOnlyBalance() (John Newbery)
7110c830f8 [wallet] deduplicate GetAvailableCredit logic (John Newbery)
ef7bc8893c [wallet] Factor out GetWatchOnlyBalance() (John Newbery)
4279da4785 [wallet] GetBalance can take an isminefilter filter. (John Newbery)

Pull request description:

  #12953 inadvertently removed the functionality to call `getbalance "*" <int> <bool>` to get the wallet's balance with either minconfs or include_watchonly.

  This restores that functionality (when `-deprecatedrpc=accounts`), and also makes it possible to call ``getbalance minconf=<int> include_watchonly=<bool>` when accounts are not being used.

Tree-SHA512: 67e84de9291ed6d34b23c626f4dc5988ba0ae6c99708d02b87dd3aaad3f4b6baa6202a66cc2dadd30dd993a39de8036ee920fcaa8cbb1c5dfe606e6fac183344
2020-12-22 17:58:12 +01:00
Pieter Wuille
b84b7da8c3 Merge #13498: [wallet] Fixups from account API deprecation
df10f07db1 [wallet] Don't use accounts when checking balance in sendmany (John Newbery)
e209184101 [wallet] deprecate sendfrom RPC method. (John Newbery)

Pull request description:

  A couple of fixups from the accounts API deprecation PR (#12953):

  - properly deprecate `sendfrom`
  - don't use accounts when calculating balance in `sendmany` (unless the `-deprecatedrpc=accounts` flag is being used)

Tree-SHA512: 1befde055067438c4c3391bbff1aaed0e6249efd708c567db3f1faad40a0f28e64f95e5bad0679ae826d24a0239e4bc8a1c392dc93e2e7502343a7f6b1d1845c
2020-12-22 17:58:12 +01:00