Commit Graph

442 Commits

Author SHA1 Message Date
UdjinM6
5c2861538c
Merge pull request #3703 from PastaPastaPasta/backport-v16-realloc
[v0.16.x] Backport v16 realloc
2020-09-14 01:33:02 +03:00
dustinface
2bb94c73eb masternode|net|rpc: Improve masternode sync process (#3690)
* 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>
2020-09-12 22:54:56 +02:00
UdjinM6
eb163c53a5
Implement dynamic activation thresholds (#3692)
* 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 `;`
2020-09-12 13:27:04 -04:00
UdjinM6
7d6aba47cf
Implement Block Reward Reallocation (#3691)
* 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>
2020-09-12 13:27:04 -04:00
PastaPastaPasta
6a249f59b6
Merge #13564: [wallet] loadwallet shouldn't create new wallets. (#3592)
ea65182f03 [wallet] loadwallet shouldn't create new wallets. (John Newbery)

Pull request description:

  A bug in the initial implementation of loadwallet meant that if the
  arguement was a directory that didn't contain a wallet.dat file, a new
  wallet would be created in that directory. Fix that so that if a
  directory is passed in, it must contain a wallet.dat file.

  Bug reported by promag (João Barbosa).

Tree-SHA512: 0a59fa8a33fde51a88544ad288b00e4995284fe16424f643076aaba42b8244fff362145217650ee53d518dfab7efbed4237632c34cdd3dcbbecaa9ecaab5fd7b

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2020-08-23 11:46:10 -05:00
PastaPastaPasta
baf18a35d5
More pruning improvements (#3579)
* explicitly check that -disablegovernance is true for pruned mode.

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

* try to set -disablegovernance and -txindex if pruned mode is enabled

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

* Adjust InitWarning when governance validation is disabled

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

* Check for deprecated -litemode earlier

* Move -disablegovernance warning into AppInitParameterInteraction

* Tweak -prune help text and a related comment in AppInitParameterInteraction

* Ignore init warnings in blockchain.py

* Adjust "governance validation disabled" warning depending on if running a pruned node

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

* Skip init warnings in import-rescan.py and node_network_limited.py

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-08-23 11:44:39 -05:00
PastaPastaPasta
0297eb428a
Change litemode to disablegovernance (#3577)
* Change litemode to disablegovernance, this makes it more clear what that flag actually does.

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

* more fLiteMode to fDisableGovernance

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

* handle -litemode being set

Signed-off-by: pasta <pasta@dashboost.org>
2020-08-23 11:43:56 -05:00
Alexander Block
00486eca06 Use exponential backoff timeouts for recovery (#3535)
Starting with 2 seconds.
2020-06-24 10:04:32 +02:00
UdjinM6
b4008ee4fc Some Dashification (#3513)
* Trivial Dashification

* Tweak getnetworkinfo and dumpwallet help text

We don't have RBF and Segwit

* CopyrightHolders should also check for missing "Dash Core" copyright
2020-06-18 16:27:37 +02:00
PastaPastaPasta
0b3c3e8406
Merge bitcoin#11415: [RPC] Disallow using addresses in createmultisig (#3482)
* Merge #11415: [RPC] Disallow using addresses in createmultisig

1df206f Disallow using addresses in createmultisig (Andrew Chow)

Pull request description:

  This PR should be the last part of #7965.

  This PR makes createmultisig only accept public keys and marks the old functionality of accepting addresses as deprecated.

  It also splits `_createmultisig_redeemscript` into two functions, `_createmultisig_getpubkeys` and `_createmultisig_getaddr_pubkeys`. `_createmultisig_getpubkeys` retrieves public keys from the RPC parameters and `_createmultisig_getaddr_pubkeys` retrieves addresses' public keys from the wallet. `_createmultisig_getaddr_pubkeys` requires the wallet and is only used by `addwitnessaddress` (except when `createmultisig` is used in deprecated mode).

  `addwitnessaddress`'s API is also changed. Instead of returning just an address, it now returns the same thing as `createmultisig`: a JSON object with two fields, address and redeemscript.

Tree-SHA512: a5796e41935ad5e47d8165ff996a8b20d5112b5fc1a06a6d3c7f5513c13e7628a4fd37ec30fde05d8b15abfed51bc250710140f6834b13f64d0a0e47a3817969

* fix backport

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

* fix backport

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

* fix backport

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

* Dashify

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

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2020-05-15 12:34:41 +03:00
10xcryptodev
017c4779ca
Fix recovery from coin db crashes (and dbcrash.py test) (#3467)
* 🪲 improve evodb consistency recovering from dbcrash

* Adjust the fix

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

* Fix it

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

* Disable recovery from a crash during a fork and a corresponding part of dbcrash.py

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

* Skip some checks in CQuorumBlockProcessor when replaying blocks after the crash

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

* Process special txes in RollforwardBlock

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

* Update src/init.cpp

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>
2020-05-11 15:33:21 +03:00
John Newbery
8ebbdfe805
Merge #10740: [wallet] loadwallet RPC - load wallet at runtime
cd53981 [docs] Add release notes for `loadwallet` RPC. (John Newbery)
a46aeb6 [wallet] [tests] Test loadwallet (John Newbery)
5d15260 [wallet] [rpc] Add loadwallet RPC (John Newbery)
876eb64 [wallet] Pass error message back from CWallet::Verify() (John Newbery)
e0e90db [wallet] Add CWallet::Verify function (John Newbery)
470316c [wallet] setup wallet background flushing in WalletInit directly (John Newbery)
59b87a2 [wallet] Fix potential memory leak in CreateWalletFromFile (John Newbery)

Pull request description:

  Adds a `loadwallet` RPCs. This allows wallets to be loaded dynamically during runtime without having to stop-start the node with new `-wallet` params.

  Includes functional tests and release notes.

  Limitations:

  - currently this functionality is only available through the RPC interface.
  - wallets loaded in this way will not be displayed in the GUI.

Tree-SHA512: f80dfe32b77f5c97ea3732ac538de7d6ed7e7cd0413c2ec91096bb652ad9bccf05d847ddbe81e7cd3cd44eb8030a51a5f00083871228b1b9b0b8398994f6f9f1
2020-05-10 12:13:46 -05:00
Wladimir J. van der Laan
b0dc2ab3c1
Merge #11862: Network specific conf sections
c25321f Add config changes to release notes (Anthony Towns)
5e3cbe0 [tests] Unit tests for -testnet/-regtest in [test]/[regtest] sections (Anthony Towns)
005ad26 ArgsManager: special handling for -regtest and -testnet (Anthony Towns)
608415d [tests] Unit tests for network-specific config entries (Anthony Towns)
68797e2 ArgsManager: Warn when ignoring network-specific config setting (Anthony Towns)
d1fc4d9 ArgsManager: limit some options to only apply on mainnet when in default section (Anthony Towns)
8a9817d [tests] Use regtest section in functional tests configs (Anthony Towns)
30f9407 [tests] Unit tests for config file sections (Anthony Towns)
95eb66d ArgsManager: support config file sections (Anthony Towns)
4d34fcc ArgsManager: drop m_negated_args (Anthony Towns)
3673ca3 ArgsManager: keep command line and config file arguments separate (Anthony Towns)

Pull request description:

  The weekly meeting on [2017-12-07](http://www.erisian.com.au/meetbot/bitcoin-core-dev/2017/bitcoin-core-dev.2017-12-07-19.00.log.html) discussed allowing options to bitcoin to have some sensitivity to what network is in use. @theuni suggested having sections in the config file:

      <cfields> an alternative to that would be sections in a config file. and on the
                cmdline they'd look like namespaces. so, [testnet] port=5. or -testnet::port=5.

  This approach is (more or less) supported by `boost::program_options::detail::config_file_iterator` -- when it sees a `[testnet]` section with `port=5`, it will treat that the same as "testnet.port=5". So `[testnet] port=5` (or `testnet.port=5` without the section header) in bitcoin.conf and `-testnet.port=5` on the command line.

  The other aspect to this question is possibly limiting some options so that there is no possibility of accidental cross-contamination across networks. For example, if you're using a particular wallet.dat on mainnet, you may not want to accidentally use the same wallet on testnet and risk reusing keys.

  I've set this up so that the `-addnode` and `-wallet` options are `NETWORK_ONLY`, so that if you have a bitcoin.conf:

      wallet=/secret/wallet.dat
      upnp=1

  and you run `bitcoind -testnet` or `bitcoind -regtest`, then the `wallet=` setting will be ignored, and should behave as if your bitcoin.conf had specified:

      upnp=1

      [main]
      wallet=/secret/wallet.dat

  For any `NETWORK_ONLY` options, if you're using `-testnet` or `-regtest`, you'll have to add the prefix to any command line options. This was necessary for `multiwallet.py` for instance.

  I've left the "default" options as taking precedence over network specific ones, which might be backwards. So if you have:

      maxmempool=200
      [regtest]
      maxmempool=100

  your maxmempool will still be 200 on regtest. The advantage of doing it this way is that if you have `[regtest] maxmempool=100` in bitcoin.conf, and then say `bitcoind -regtest -maxmempool=200`, the same result is probably in line with what you expect...

  The other thing to note is that I'm using the chain names from `chainparamsbase.cpp` / `ChainNameFromCommandLine`, so the sections are `[main]`, `[test]` and `[regtest]`; not `[mainnet]` or `[testnet]` as might be expected.

  Thoughts? Ping @MeshCollider @laanwj @jonasschnelli @morcos

Tree-SHA512: f00b5eb75f006189987e5c15e154a42b66ee251777768c1e185d764279070fcb7c41947d8794092b912a03d985843c82e5189871416995436a6260520fb7a4db
2020-05-10 11:15:58 -05:00
Pasta
02dfb89b02 fix test 50 -> 500
Signed-off-by: Pasta <pasta@dashboost.org>
2020-04-23 14:33:31 -05:00
Wladimir J. van der Laan
7999080c04 Merge #11687: External wallet files
be8ab7d08 Create new wallet databases as directories rather than files (Russell Yanofsky)
26c06f24e Allow wallet files not in -walletdir directory (Russell Yanofsky)
d8a99f65e Allow wallet files in multiple directories (Russell Yanofsky)

Pull request description:

  This change consists of three commits:

  * The first commit is a pure refactoring that removes the restriction that two wallets can only be opened at the same time if they are contained in the same directory.
  * The second commit removes the restriction that `-wallet` filenames can only refer to files in the `-walletdir` directory.
  * The third commit makes second commit a little safer by changing bitcoin to create wallet databases as directories rather than files, so they can be safely backed up.

  All three commits should be straightforward:

  *  The first commit adds around 20 lines of new code and then updates a bunch of function signatures (generally updating them to take plain fs::path parameters, instead of combinations of strings, fs::paths, and objects like CDBEnv and CWalletDBWrapper).
  * The second commit removes two `-wallet` filename checks and adds some test cases to the multiwallet unit test.
  * The third commit just changes the mapping from specified wallet paths to bdb environment & data paths.

    ---

  **Note:** For anybody looking at this PR for the first time, I think you can skip the comments before _20 Nov_ and start reading at https://github.com/bitcoin/bitcoin/pull/11687#issuecomment-345625565. Comments before  _20 Nov_ were about an earlier version of the PR that didn't include the third commit, and then confusion from not seeing the first commit.

Tree-SHA512: 00bbb120fe0df847cf57014f75f1f7f1f58b0b62fa0b3adab4560163ebdfe06ccdfff33b4231693f03c5dc23601cb41954a07bcea9a4919c8d42f7d62bcf6024
2020-04-23 14:33:31 -05:00
Alexander Block
d235364534 Wait one additional second for disconnects 2020-04-21 16:49:36 +02:00
PastaPastaPasta
087d98477b
Merge bitcoin#10387: Eventually connect to NODE_NETWORK_LIMITED peers (#3417)
* Merge #10387: Eventually connect to NODE_NETWORK_LIMITED peers

eb91835 Add setter for g_initial_block_download_completed (Jonas Schnelli)
3f56df5 [QA] add NODE_NETWORK_LIMITED address relay and sync test (Jonas Schnelli)
158e1a6 [QA] fix mininode CAddress ser/deser (Jonas Schnelli)
fa999af [QA] Allow addrman loopback tests (add debug option -addrmantest) (Jonas Schnelli)
6fe57bd Connect to peers signaling NODE_NETWORK_LIMITED when out-of-IBD (Jonas Schnelli)
31c45a9 Accept addresses with NODE_NETWORK_LIMITED flag (Jonas Schnelli)

Pull request description:

  Eventually connect to peers signalling NODE_NETWORK_LIMITED if we are out of IBD.
  Accept and relay NODE_NETWORK_LIMITED peers in addrman.

Tree-SHA512: 8a238fc97f767f81cae1866d6cc061390f23a72af4a711d2f7158c77f876017986abb371d213d1c84019eef7be4ca951e8e6f83fda36769c4e1a1d763f787037
Signed-off-by: Pasta <pasta@dashboost.org>

# Conflicts:
#	src/init.cpp
#	src/protocol.h
#	test/functional/node_network_limited.py

* remove witness

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

* fix test expecting witness flag

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

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
2020-04-19 16:21:47 +03:00
Alexander Block
08477899b4
Merge #13522: [tests] Fix p2p_sendheaders race (#3438)
75848bcf40 [tests] Fix p2p_sendheaders race (John Newbery)

Pull request description:

  p2p_sendheaders has a race in part 1.3.

  part 1.2 sends a block to the node over the 'test_node' connection, but
  doesn't wait for an inv to be received on the 'inv_node' connection. If
  we get to part 1.3 before that inv has been received, then the
  subsequent call to check_last_inv_announcement could fail.

Tree-SHA512: ba9baffb3a9c0d379259190c737a7a4ad2e1133005a5b026af4f6b67a2978e24db39289551ad29134151879593ef5472be7e569a3557c0740fb51f5c56263d9a

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2020-04-19 14:04:58 +03:00
Alexander Block
3d24290bcb
Take all nodes into account in check_sigs instead of just just masternodes (#3437)
* Take all nodes into account in check_sigs instead of just just masternodes

Checking only masternodes might result in wait_for_sigs returning too early
when waiting for signatures to get cleaned up, so that node0 still has
the signature locally and thus does not fully re-process new signatures.

* Make sure node0 has received qsendrecsigs from the previously isolated node
2020-04-19 14:04:48 +03:00
PastaPastaPasta
d804a753af
Merge bitcoin#13134: net: Add option -enablebip61 to configure sending of BIP61 notifications (#3414)
* Merge #13134: net: Add option `-enablebip61` to configure sending of BIP61 notifications

87fe292d897e09e176ac7e254144466c319cc9ac doc: Mention disabling BIP61 in bips.md (Wladimir J. van der Laan)
fe16dd8226d924f44432c5b5014aa49ff45c82ff net: Add option `-enablebip61` to configure sending of BIP61 notifications (Wladimir J. van der Laan)

Pull request description:

  This commit adds a boolean option `-peersendreject`, defaulting to `1`, that can be used to disable the sending of [BIP61](https://github.com/bitcoin/bips/blob/master/bip-0061.mediawiki) `reject` messages. This functionality has been requested for various reasons:

  - security (DoS): reject messages can reveal internal state that can be used to target certain resources such as the mempool more easily.

  - bandwidth: a typical node sends lots of reject messages; this counts against upstream bandwidth. Also the reject messages tend to be larger than the message that was rejected.

  On the other hand, reject messages can be useful while developing client software (I found them indispensable while creating bitcoin-submittx), as well as for our own test cases, so whatever the default becomes on the long run, IMO the functionality should be retained as option. But that's a discussion for later, for now it's simply a node operator decision.

  Also adds a RPC test that checks the functionality.

Tree-SHA512: 9488cc53e13cd8e5c6f8eb472a44309572673405c1d1438c3488f627fae622c95e2198bde5ed7d29e56b948e2918bf1920239e9f865889f4c37c097c37a4d7a9

* 0.17 -> 0.16

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

* tx1 -> base_ tx fixing 13134

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

* move added bip61 message checking up

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

* Dash specific code, only send reject messages if bip61 is enabled

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

* Fix invalidtxrequest.py

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-04-19 14:04:31 +03:00
UdjinM6
75a1968c96
Fix abandonconflict.py (#3436)
One of rebases in #3407 reverted the fix
2020-04-18 21:04:01 +02:00
Alexander Block
6d83b0a053
Merge pull request #3431 from codablock/pr_socketevents_arg
Make socketevents mode (poll vs select) configurable via parameter
2020-04-18 12:34:34 +02:00
UdjinM6
20a0f3a51f
Merge pull request #3407 from PastaPastaPasta/backports-0.16-pr17
Backports 0.16 pr17
2020-04-18 12:57:51 +03:00
Alexander Block
a6d6c94a74 Allow to pass extra dashd args when running tests 2020-04-17 22:09:52 +02:00
Alexander Block
d5092c44cb
Make sure that cleanup is not triggered too early in llmq-signing.py (#3427) 2020-04-17 21:45:55 +02:00
Alexander Block
305485418b In disconnect_p2ps(), wait for p2p connections to disappear from getpeerinfo() 2020-04-17 07:53:07 +02:00
Alexander Block
0569997478 Also wait for node1 to close all sockets 2020-04-17 07:53:07 +02:00
Alexander Block
ee995ef02a
Merge pull request #3422 from codablock/pr_speedups7
Implement more reliable wait_for_masternode_probes in test framework
2020-04-17 07:52:34 +02:00
Alexander Block
755a23ca00
Always pass current mocktime to started nodes (#3423)
Instead of using the initial value. This removes the need for manually
passing of -mocktime when restarting nodes.

It also fixes a few flaky test cases where nodes are getting restarted.
2020-04-17 07:52:06 +02:00
Alexander Block
6467995178 Instead of manually counting expected probes, rely on what dashd expects
And really only check inbound connections for recent probes. Also bump
mocktime by an hour in llmq-simplepose.py.

This fixes flakiness of llmq-simplepose.py.
2020-04-16 18:18:47 +02:00
Wladimir J. van der Laan
bbce45d8bd
Merge #13652: rpc: Fix that CWallet::AbandonTransaction would leave the grandchildren, etc. active
89e70f9d7fe384ef9de4fa3828d4c80523290186 Fix that CWallet::AbandonTransaction would only traverse one level (Ben Woosley)

Pull request description:

  Prior to this change, it would mark only the first layer of
  child transactions abandoned, due to always following the input `hashTx`
  rather than the current `now` tx.

Tree-SHA512: df068b49637d299ad73237c7244005fe5aa966d6beae57aff12e6948f173d9381e1b5d08533f7e3a1416991ed57f9f1f7b834057141d85c07dc60bb1f0872cea
2020-04-16 10:24:22 -05:00
MarcoFalke
29a0865df3 Merge #13304: qa: Fix wallet_listreceivedby race
fa865efa4a qa: Fix wallet_listreceivedby race (MarcoFalke)

Pull request description:

  Generating a block on node 0 will only get node 0 out of IBD and not node 1. So the inv for the `txid` is dropped by node 1 and the call to `sync_all` fails.

  Solve it by a call to `sync_blocks` after `generate`.

Tree-SHA512: e21b01a9e8c90bd6a3aad290c97cc4866ab384e22797b318eed55ae2767512203597d3a184b23ad5a3fe76bdbb8a3d5c51e097d56b160232851164434059ff23
2020-04-15 21:01:42 -05:00
MarcoFalke
6dfb5a7377 Merge #13192: [tests] Fixed intermittent failure in p2p_sendheaders.py.
12d1b77f7e [tests] Fixed intermittent failure in p2p_sendheaders.py. (lmanners)

Pull request description:

  Added handling for the case where headers are announced over more than one message.
  refs #12453

Tree-SHA512: 2c5b48ff019089b86e358181ba170d3aac09d4ae41ec79c2718e0ee83705860501bbcb8fd94d0f5c4f86c0d54a96781a967716621bb8c5ecc991b39af3cec506
2020-04-15 21:01:42 -05:00
Alexander Block
2a87aa9d4f Bump mocktime by 60 secs after calling setnetworkactive(True)
When we bumped before the call, it sometimes happened that in the following
loop one of the early nodes which got the network reactivated tried to
connect to one of the latter nodes with still disabled network. Such
connection attempts were dropped by the latter nodes and the retry
throttling then prevented the connection to be retried later. Doing the
bumping after setnetworkactive(True) should fix this.
2020-04-14 15:16:51 +02:00
Alexander Block
d9911e51fc Bump mocktime while waiting for getblocktemplate 2020-04-14 15:16:51 +02:00
Alexander Block
8dc7ec7e56 Call set_node_times by default in bump_mocktime
And remove manual calls accordingly.
2020-04-14 15:16:51 +02:00
Alexander Block
12ae7e171e Sync mempool before generating blocks 2020-04-14 15:16:51 +02:00
Alexander Block
54198ce739
Backport bitcoin#15773: test: Add BitcoinTestFramework::sync_* methods (incomplete backport) (#3409)
* scripted-diff: Rename sync_blocks to send_blocks to avoid name collisions and confusion

-BEGIN VERIFY SCRIPT-
FILE_LIST=$(git grep -l 'def sync_blocks' ./test/functional/*.py)
sed -i -e 's/def sync_blocks/def send_blocks/g'   $FILE_LIST
sed -i -e 's/self.sync_blocks/self.send_blocks/g' $FILE_LIST
-END VERIFY SCRIPT-

* test: Pass at most one node group to sync_all

* test: Add BitcoinTestFramework::sync_* methods

* Move bumping of mocktime into BitcoinTestFramework.sync_mempool

Instead of doing it in every place it's needed

* scripted-diff: use self.sync_* methods

-BEGIN VERIFY SCRIPT-
sed -i -e 's/sync_blocks(self.nodes)/self.sync_blocks()/g'     $(git grep -l 'sync_blocks(self.nodes)'   ./test/functional/*.py)
sed -i -e 's/sync_mempools(self.nodes)/self.sync_mempools()/g' $(git grep -l 'sync_mempools(self.nodes)' ./test/functional/*.py)

sed -i -e 's/  sync_blocks(/  self.sync_blocks(/g'     $(git grep -l sync_blocks   ./test/functional/*.py)
sed -i -e 's/  sync_mempools(/  self.sync_mempools(/g' $(git grep -l sync_mempools ./test/functional/*.py)
-END VERIFY SCRIPT-

* Pass nodes into bump_mocktime

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2020-04-14 13:00:16 +03:00
UdjinM6
d2756fb210
Merge pull request #3395 from PastaPastaPasta/backports-0.16-pr16
Backports 0.16 pr16
2020-04-10 13:11:03 +03:00
Alexander Block
26dec64e79
Merge pull request #3397 from codablock/pr_backport_txrequests
Backport bitcoin#14897 and bitcoin#15834 and modify it to work with Dash messages
2020-04-09 00:12:44 +02:00
Alexander Block
f2364b7e5c Wait for ping/pong before starting testing in net.py 2020-04-08 22:43:56 +02:00
MarcoFalke
351ddf938d Merge #15069: test: Fix rpc_net.py "pong" race condition
de23739b22 test: Fix rpc_net.py "pong" race condition (Ben Woosley)

Pull request description:

  Prior to this change, the test fails with KeyError if pong has
  a zero value at the time this is called, as getpeerinfo's
  bytesrecv_per_msg result excludes zero-values.

  Combined these to a single wait_until as well, which will be a bit more
  forgiving re the timeout while still enforcing the same 2 seconds
  overall.

  https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/21310881#L62

Tree-SHA512: dc60f95a0e139c104fd81c8a7e0c9b3c25907de26c9d4e5976ae490e8ed5db0f0c492cd0e996ef6b5eb02cae82a62d4551ed36f95601871b19472050b3247bc0
2020-04-08 22:43:56 +02:00
MarcoFalke
62dc0bbdae Merge #16459: [qa] Fix race condition in example_test.py
d9ab0ffa386f2dd8d05852563d5011b3cb501df8 [qa] Fix race condition in example_test.py (Suhas Daftuar)

Pull request description:

  There's a race between sending a getdata for a bunch of blocks with the node receiving those blocks from a peer, which could cause test failure.  Fix this.

ACKs for top commit:
  MarcoFalke:
    ACK d9ab0ffa386f2dd8d05852563d5011b3cb501df8
  laanwj:
    ACK  d9ab0ffa386f2dd8d05852563d5011b3cb501df8
  promag:
    ACK d9ab0ffa386f2dd8d05852563d5011b3cb501df8.

Tree-SHA512: c891f209eb2492f44e47da52ee6df950ff874ae26d2739011aca940d1caff6cedbac032b6509adbed07044c14fd711ba9d4d0e35c0f70bb2691f2ea4a46672ed
2020-04-08 22:43:56 +02:00
Alexander Block
5cf417bc3a Bump mocktime while syncing mempools
Otherwise the inv/getdata logic won't work with inbound connections due to
the added delay of 2 seconds.
2020-04-08 22:28:39 +02:00
Alexander Block
24b25e13da Add wait_func to sync_mempool 2020-04-08 22:13:54 +02:00
Wladimir J. van der Laan
f7d5e538df
Merge #13451: rpc: expose CBlockIndex::nTx in getblock(header)
86edf4a2a502416ba8d6cebbce61030992f7ff6f expose CBlockIndex::nTx in getblock(header) (Gregory Sanders)

Pull request description:

  Recent publication of a weakness in Bitcoin's merkle tree construction demonstrates many SPV applications vulnerable to an expensive to pull off yet still plausible attack: https://bitslog.wordpress.com/2018/06/09/leaf-node-weakness-in-bitcoin-merkle-tree-design/

  Including the coinbase in the txoutproof seems the most effective fix, however results in a significant efficiency downgrade. Transactors will not even know a priori what the size of their proof will be within a couple orders of magnitude, unless they use the mid-state of SHA2 as detailed in the blog post.

  Some applications, like Elements blockchain platform that take SPV-style proofs have optional access to a bitcoind to verify these proofs of inclusion and check depth in the chain. Returning `CBlockIndex::nTx` would allow an extremely easy and compact way of checking the depth of the tree, with no additional overhead to the codebase, and works with pruned nodes.

  `getblockheader` is arguably not the place for it, but as mentioned before, is a natural workflow for us checking depth of a block in a possibly pruned node.

  We should also ensure that `verifytxoutproof` ends up validating this depth fact as well, but left this for another PR.

Tree-SHA512: af4cf48e704c6088f8da06a477fda1aaa6f8770cee9b876c4465d1075966d6a95831a88817673fe5a0d6bbcdc1ffcbc1892e2be0d838c60fc6958d33eacdcc14
2020-04-08 11:46:27 -05:00
MarcoFalke
01d3f009c5
Merge #12089: qa: Make TestNodeCLI command optional in send_cli
fae7b14a04 qa: Make TestNodeCLI command optional in send_cli (MarcoFalke)
ffffb10a9f qa: Rename cli.args to cli.options (MarcoFalke)

Pull request description:

  Makes the `command` optional, since there are valid bitcoin-cli calls that have no `command`:

  * `bitcoin-cli -?`
  * `bitcoin-cli -getinfo`
  * ...

  Also, rename self.args to self.options, since that is the name in the `bitcoin-cli -help` documentation.

Tree-SHA512: f49c06024e78423301d70782946d47c0fb97a26876afba0a1f71ed329f5d7124aee4c2df520c7af74079bf9937851902f7be9c54abecc28dc29274584804d46c
2020-04-08 11:46:27 -05:00
MarcoFalke
d6c36124c0
Merge #12227: test_runner: Readable output if create_cache.py fails
ac96e788fa test_runner: Readable output if create_cache.py fails (Russell Yanofsky)

Pull request description:

  Without this change, create_cache.py process output is shown as a byte() object
  with \n escapes in a single line that is hard to read.

Tree-SHA512: 49cd0fff037c03f558e31a1281712cc4419df6c4ed8b342057a3d54ab6b31180e1a23cb586686952d81b8add5bec07844efa8cdf16ad20f40cc903a19437fda5
2020-04-08 11:46:27 -05:00
Pasta
8e1484fc62
continued
Signed-off-by: Pasta <pasta@dashboost.org>
2020-04-08 11:46:27 -05:00
MarcoFalke
1ab6447f10
Merge #11791: [tests] Rename NodeConn and NodeConnCB
873beca6d [tests] Rename NodeConn and NodeConnCB (John Newbery)

Pull request description:

  Final step in #11518

  NodeConn -> P2PConnection
  NodeConnCB -> P2PInterface

  This is basically just a rename. Should be an easy review.

Tree-SHA512: fe1204b2b3d8182c5e324ffa7cb4099a47ef8536380e0bb9d37a5fccf76a24f548d1f1a7988ab8f830986a3058b670696de3fc891af5e5f75dbeb4e3273005d7
2020-04-08 11:46:27 -05:00