* Backport Statoshi
This backports some of https://github.com/jlopp/statoshi.
Missing stuff: README.md and client name changes, segwit and fee estimation stats.
Fix RejectCodeToString
Fix copy-paste mistake s/InvalidBlockFound/InvalidChainFound/
* Merge #16728: move-only: move coins statistics utils out of RPC
8a3b2eb17572ca2131778d52cc25ec359470a90f move-only: move coins statistics utils out of RPC (James O'Beirne)
Pull request description:
This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11):
Parent PR: #15606
Issue: #15605
Specification: https://github.com/jamesob/assumeutxo-docs/tree/master/proposal
---
In the short-term, this move-only commit will help with fuzzing (https://github.com/bitcoin/bitcoin/pull/15606#issuecomment-524482297). Later, these procedures will be used to compute statistics (particularly a content hash) for UTXO sets coming in from snapshots.
Most easily reviewed with `git ... --color-moved=dimmed_zebra`. A nice follow-up would be adding unittests, which I'll do if nobody else gets around to it.
ACKs for top commit:
MarcoFalke:
ACK 8a3b2eb17572ca2131778d52cc25ec359470a90f, checked --color-moved=dimmed-zebra
Tree-SHA512: a187d2f7590ad2450b8e8fa3d038c80a04fc3d903618c24222d7e3172250ce51badea35860c86101f2ba266eb4354e6efb8d7d508b353f29276e4665a1efdf74
* Fix 16728
* Modernize StatsdClient
- Reuse some functionality from netbase
- Switch from GetRand to FastRandomContext
- Drop `using namespace std` and add `// namespace statsd`
* Introduce PeriodicStats and make StatsdClient configurable via -stats<smth> (enabled/host/port/ns/period)
* Move/rename tip stats from CheckBlock to ConnectBlock
* Add new false positives to lint-format-strings.py
* Add snprintf in statsd_client to the list of known violations in lint-locale-dependence.sh
* Fix incorrect include guard
* Use bracket syntax includes
* Replace magic numbers with defaults
* Move connection stats calculation into its own function
And bail out early if stats are disabled
* assert in PeriodicStats
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
Co-authored-by: MarcoFalke <falke.marco@gmail.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
* rpc: Implement `masternode payments`
Returns an array of deterministic masternodes and their payments for a specific block
* tests: Add rpc_masternode.py
* Apply review suggestions
* Add amounts calculated per masternode and per block
* Tweak help string
* Update src/rpc/masternode.cpp
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
* rpc: Check against vector size instead of decrementing a counter
* rpc: Use `std::vector::begin()` instead of `std::begin(std::vector)`
* Drop set_dash_dip8_activation in rpc_masternode.py
* Apply suggestions from code review
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: xdustinface <xdustinfacex@gmail.com>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
* Add LLMQ_100_67 quorums
* Re-use DEPLOYMENT_V17 bit to activate LLMQ_100_67 quorums
* Add LLMQ_TEST_NEW quorum and test its activation
* Tweak mine_quorum to work correctly with multiple quorum types
And to avoid a potentialy endless "while" loop
* llmq: Rename IsQuorumTypeEnabledAtBlock -> IsQuorumTypeEnabled
* chainparams|test: Rename llmq_test_new -> llmq_test_v17
* chainparams|consensus|llmq: Rename LLMQ_TEST_NEW -> LLMQ_TEST_V17
* Tweak few strings and the name of the test
* llmq: Make GetEnabledQuorumTypes return a vector of LLMQTypes, introduce GetLLMQParams
Signed-off-by: pasta <pasta@dashboost.org>
* Tweak minSize
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
* Exclude LLMQ_100_67 from Concentrated Recovery
* Update test/functional/feature_new_quorum_type_activation.py
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
Co-authored-by: xdustinface <xdustinfacex@gmail.com>
Co-authored-by: pasta <pasta@dashboost.org>
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
* Send islock notifications for txes received after their islocks were received
Also drop UpdateWalletTransaction - its name makes no sense and it's only used once.
* tests: early islocks should trigger notifications once a corresponding tx is received
* Tweak tests
- fail if an unexpected islock is received
- drop unused variable
* llmq: Drop `c_str()` in two log statements
* test: Move create_islock to DashTestFramework in test_framework.py
Just because it's used the same way in two files
* test: Simplify send tx in zmq test
* format
Co-authored-by: xdustinface <xdustinfacex@gmail.com>
* tests: Bump mocktime in smaller intervals while (not) signaling
This is needed to avoid triggering `CMasternodeSync::Reset()`.
* tests: force faucet node to finish mnsync in prepare_datadirs
* test: Drop redundant force_finish_mnsync in interface_zmq_dash.py
Co-authored-by: xdustinface <xdustinfacex@gmail.com>
* Convert comments into log output in feature_llmq_dkgerrors.py
* Remove llmq folder in wallet_backup.py
* There is no `-blockmaxweight` option in Dash
* test: Add more C++ representing classes in message.py
* test: Add interface_zmq_dash.py
* test: Add interface_zmq_dash.py to BASE_SCRIPTS in test_runner.py
* test: Adjust hashrecoveredsig parsing
* Force node0 to finish syncing
* Avoid `uint256_to_string(uint256_from_str())`
* Be more specific in imports
* Plural for "publisher" when makes sense
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
* implement whitelist for commands needed by Dash Platform
Signed-off-by: pasta <pasta@dashboost.org>
* Add test for platform command filtering
Signed-off-by: pasta <pasta@dashboost.org>
* Use less if statements
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
* make defaultPlatformUser const
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
* test: Make rpc_platform_filter.py executable
* test: Refactor tests in rpc_platform_filter.py
* minor modifications to rpc_platform_filter.py
Signed-off-by: pasta <pasta@dashboost.org>
* test: Expand test cases in rpc_platform_filter.py
* rpc: Use std::map instead of std::vector for platformAllowedCommands
* rpc: Improve readability and be more specific about the reject reason
* rpc: Fix comment
* rpc|httprpc: Rename RPC_PROTECTED_COMMAND to RPC_PLATFORM_RESTRICTION
* minor modifications to server.cpp
Signed-off-by: pasta <pasta@dashboost.org>
* add help text
Signed-off-by: pasta <pasta@dashboost.org>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: xdustinface <xdustinfacex@gmail.com>
* tests: Use lower mocktime bump value to reset masternode probes in feature_llmq_simplepose.py
Bumping `50 * 60 + 1` should be enough, see https://github.com/dashpay/dash/blob/master/src/llmq/quorums_utils.cpp#L218-L222. Bumping `60 * 60 + 1` interferes with mnsync reset, see https://github.com/dashpay/dash/blob/master/src/masternode/masternode-sync.cpp#L112-L119.
* Fix expected connection count in llmq-signing.py and llmq-simplepose.py
* Sleep a couple of seconds to let mn sync tick to happen
* Move helper functions out of run_test
* Let helper functions return expect_contribution_to_fail
* No need to check for "punished" state in test_banning
* Split mninfos in test_banning and mine_quorum into "online" and "valid" sets
Needed for wait_for_masternode_probes in mine_quorum. Also, refactor and fix test_banning while at it.
* test: Introduce uint256_to_string
* test: Use uint256_to_string in some places
* Avoid converting back and forth, reuse known string represntations of hashes for blocks and txes instead of converting sha256
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
bd9d67b752 Don't test against min relay fee information in mining_prioritisetransaction.py (Kristaps Kaupe)
Pull request description:
Follow-up on #13032.
As advised by @MarcoFalke.
Tree-SHA512: a690ff2e6499b0b4ee6a952c849e363738b9a5ae553266e1780fc7910a6b01e240d71b434fe87da53dc43f6e26cec23a900ec16aab64bb8f6765c26d7aa37c56
1accfbc Output values for "min relay fee not met" error (Kristaps Kaupe)
Pull request description:
It is already done this way for "mempool min fee not met" error.
Tree-SHA512: 829db78ecc066cf93b8e93ff1aeb4e7b98883cf45f341d5be6e6b4dff4135f3f54fa49b3a6f12eb43f676a9ba54f981143c9887f786881e584370434a9566cfd
80a5e59 [qa] Attach node index to test_node AssertionError and print messages (James O'Beirne)
Pull request description:
In the midst of fighting with https://github.com/bitcoin/bitcoin/pull/12873 it became apparent that there're a number of assertions and print statements which are emitted by test nodes but don't identify the node in question. This change makes debugging a bit easier by adding identifying information to non-logger test_node-related error messages.
Tree-SHA512: 7cc86f2c81f4b3fdba15ec9a2d21a84c4b083629e845e82288087c3affbbdc5c68e74067621856cc97fe84fbc8cb4f5ca4977a51ef381e5d74515df8eb001239
fix 13022
Signed-off-by: pasta <pasta@dashboost.org>
1f83839 [wallet] [tests] Test disallowed multiwallet params (John Newbery)
3476e3c [wallet] Fix zapwallettxes/multiwallet interaction. (John Newbery)
Pull request description:
`-zapwallettxes` should be disallowed when starting bitcoin in multiwallet mode.
There's code in `WalletInit::ParameterInteraction()` to disallow `-zapwallettxes` when running in multiwallet mode. This code functioned as expected when passing the parameter `-zapwallettxes=1`, but not when passing the parameter `-zapwallettxes` (ie without the value specified). Fix that and add a test.
The new test in the
_[wallet] [tests] Test disallowed multiwallet params_ commit reproduces the bug and should fail against master.
Fixes#12505
Tree-SHA512: 6cd921717e9c7d2773ca84c946c310c2adec8430e37cbecdb33a620f510db3058a72bd328411812ba415111bc52a3367b332c9d15a37a92ccfd7ae785d2f32ab
6cba60ace2 speed up wallet_hd.py and clarify/augment checks (Gregory Sanders)
Pull request description:
With `keypool=0` I see no reason to do 300 addresses and sends.
(with --enable-debug)
Before patch:
real 1m10.412s
user 0m49.772s
sys 0m3.988s
After:
real 0m11.566s
user 0m3.344s
sys 0m4.648s
Also added check, since I failed to understand that on startup the wallet already knows about funds by rescanning blocks newer than oldest key birthdate.
Tree-SHA512: cf90f7fe6a437b8b7b1f0707464b9c06085233167826f1a12c3871684664d4d572e13f03e13a718e4537cac39713271c4ac3d9b983e10080b50647caf3cbe82d
ea04bf7862 Enable flake8 warning F841 ("local variable 'foo' is assigned to but never used") (practicalswift)
169f3e8637 Remove assigned but never used local variables (practicalswift)
Pull request description:
Remove assigned but never used local variables. Enable Travis checking for unused local variables.
Tree-SHA512: d6052ec9044c5d1f03d874ea3c8addd5a156779213ef9200f89d3ae53230f2fd1691aff405c3dae14178e5ef09912c4432e92f606ef4a5220ed9daa140cdee81
8394300859 [Tests] fix a typo in TestNode.assert_start_raises_init_error() (Roman Zeyde)
Pull request description:
`self.wait_util_stopped()` should be `self.wait_until_stopped()`.
Also, use a specific Exception subclass for indicating node failure to start (instead of using `AssetionError` and an `except Exception` clause).
Following https://travis-ci.org/bitcoin/bitcoin/jobs/359066226#L2726 and depending on #12806 (which fixes the root cause of the Travis test failure).
Tree-SHA512: 7bd5a95586a412472ef9dffdb086789d7275ddaf862724e21cebb3418d0c97e6d89b4d1a58375e42114060d028403d6eab89e3a1e9a833ffe8dadf3439ab1fe2
fae1374 qa: Allow for partial_match when checking init error (MarcoFalke)
5812273 [Tests] Require exact match in assert_start_raises_init_eror() (John Newbery)
0ec08a6 [Tests] Move assert_start_raises_init_error method to TestNode (John Newbery)
Pull request description:
Extracted from #12379, because the changes are important on their own.
This allows for exact testing, since the match can be specified with a strict regex. Internal details (such as exact formatting of the error message) can still be fuzzed away by regex wildcards.
Tree-SHA512: 605d2c9c42362a32d42321b066637577a026d0bb8cfc1c9f5737a4ca6503ffe85457a5122cea6e1101053ccc6c8aa1bbae3602e1fa7d2988bf7d5c275f412f66
Signed-off-by: pasta <pasta@dashboost.org>
d71bedb qa: Fix function names in feature_blocksdir (MarcoFalke)
Pull request description:
This fixes the test failure on master:
```
AttributeError: 'BlocksdirTest' object has no attribute 'assert_start_raises_init_error'
```
Tree-SHA512: d96a9b707a9b4fb8752b15f28dae02c60c25cbec21dca5f3ee62e2717c6a49951533c24b52ed0d6e99c5a964ef2c3e90fdc58a9104122714ae9874e121955df6
a192636 -blocksdir: keep blockindex leveldb database in datadir (Jonas Schnelli)
f38e4fd QA: Add -blocksdir test (Jonas Schnelli)
386a6b6 Allow to optional specify the directory for the blocks storage (Jonas Schnelli)
Pull request description:
Since the actual block files taking up more and more space, it may be desirable to have them stored in a different location then the data directory (use case: SSD for chainstate, etc., HD for blocks).
This PR adds a `-blocksdir` option that allows one to keep the blockfiles and the blockindex external from the data directory (instead of creating symlinks).
I fist had an option to keep the blockindex within the datadir, but seems to make no sense since accessing the index will (always) lead to access (r/w) the block files.
Tree-SHA512: f8b9e1a681679eac25076dc30e45e6e12d4b2d9ac4be907cbea928a75af081dbcb0f1dd3e97169ab975f73d0bd15824c00c2a34638f3b284b39017171fce2409
* test: Optimize feature_block_reward_reallocation.py
Signed-off-by: pasta <pasta@dashboost.org>
* use submitblock instead of p2p.send_blocks_and_test in one more place
* drop empty line
* make sure all nodes are synced after reallocation is done
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
* Implement dynamic activation thresholds
* fix
* Revert unrelated changes
* Clarify switching to/staying in LOCKED_IN state
* Fix signal function to work correctly with num_blocks=0
* Add simplified threshold calculation and use it in tests
* Check that thresholds are decreasing, reach the min level and stay there
* Drop `;`
* masternode: Replace sync states INITIAL and WAITING with BLOCKCHAIN
* masternode: Peer dependent "assume tip" timeout
I would say its enough to only wait 1 tick if we have more than 3
peers before we move over to governance sync.
* masternode: Notify the UI instantly if switched to governance sync
Without this it takes one iteration more for the UI to receive the
update.
* masternode: Notify the UI about CMasternodeSync::Reset calls
* masternode: Don't instantly reset the sync process
Give it MASTERNODE_SYNC_RESET_SECONDS (600) seconds time after the last
UpdateBlockTip call.
* rpc: Don't switch to next asset in "mnsync reset"
* rpc: Force the reset in "mnsync reset"
* net: Make sure the sync gets a reset if required after network changes
This will reset the sync process if its outdated in the following cases:
- If the connections dropped to zero
- If the connections went from zero to one
- If the network has been enabled or disabled
* Apply suggestions from code review
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
* net: Only open masternode connections if the blockchain is synced
In general it doesn't make sense to connect to masternodes before due to
MNAUTH requires blockchain sync. This could lead to failing quorum
connections/failing masternode
probing.. if a just restarted node/a out of sync node
would hit a dkg block.. Then they would not try to open those
llmq/probing connections for the next 60s (nLLMQConnectionRetryTimeout).
Thats basically what happens in tests right now and they fail without
this commit.
* test: Make sure nodes are synced when they get restored after isolation
Their sync might be out of date otherwise due to bigger mocktime bumps
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
* Implement Block Reward Reallocation
* Add integr. test
* drop unused variable
* Sep -> Oct
* Update test/functional/feature_block_reward_reallocation.py
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
* Revert to Sep for testnet and devnet
* validation: Refactor reallocation calculations
Makes it much more readable imo and avoids calculating the percentage
each time.
* test: Align reallocation calculation with c++ (GetMasternodePayment)
* test: Make feature_block_reward_allocation.py executable
* Make linter happy
Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
Co-authored-by: xdustinface <xdustinfacex@gmail.com>