Commit graph

24226 commits

Author SHA1 Message Date
MarcoFalke
6f51f6f357
Merge #18754: bench: add CAddrMan benchmarks
a9b957740e bench: add CAddrMan benchmarks (Vasil Dimov)

Pull request description:

  The added benchmarks exercise the public methods Add(), GetAddr(),
  Select() and Good().

ACKs for top commit:
  naumenkogs:
    utACK a9b9577
  MarcoFalke:
    ACK a9b957740e

Tree-SHA512: af54b2fbd97db34faf4cc6c9bacb20d2c97d0aaddb9cf91b220bc2e09227b55345402ed17e34450745493e3a2b286c176c031cdeb477415570a757cee16b06a8
2020-04-25 08:38:39 -04:00
MarcoFalke
9fac600aba
Merge #17383: Refactor: Move consts to their correct translation units
e9ea95a30d [net processing] Move all const declarations to top of net_processing.cpp (John Newbery)
507b36dd1b [validation] Move all const declarations to top of validation.h (John Newbery)
0109622b08 [validation] Move validation-only consts to validation.cpp (John Newbery)
b8580cacc7 [net processing] Move net processing consts to net_processing.cpp (John Newbery)

Pull request description:

  Following the main.cpp split, there are still some constants in the wrong places, eg net_processing constants in validation.h. Move them all to their rightful homes. At the same time, make them constexpr.

  Also move all const declarations to the top of their files, and ensure that they all have doxygen comments.

ACKs for top commit:
  practicalswift:
    ACK e9ea95a30d -- patch looks correct
  MarcoFalke:
    ACK e9ea95a30d 🚉

Tree-SHA512: 44d81da73c7be01e1d36b939789d793f297d3b94f84ea4e7ac853c621cc7054b5a05c7c9e7b83db506db44c16f344541be8f240d955694211e53a84c32b0d2c5
2020-04-25 08:36:39 -04:00
Sebastian Falbesoner
0956e46bff test: use zero-argument super() shortcut (Python 3.0+)
as defined in PEP 3135:

"The new syntax:

    super()

is equivalent to:

    super(__class__, <firstarg>)

where __class__ is the class that the method was defined in, and <firstarg> is
the first parameter of the method (normally self for instance methods, and cls
for class methods)."
2020-04-25 13:49:08 +02:00
MarcoFalke
5f19155e5b
Merge #18724: test: add coverage for -rpcwallet cli option
2495110012 test: add coverage for -rpcwallet cli option (Jon Atack)

Pull request description:

  The bitcoin-cli `-rpcwallet=` option is an essential RPC/CLI option when more than one wallet is loaded (see `bitcoin-cli -help | grep -A5 rpcwallet` or `src/bitcoin-cli.cpp::L61`) and it currently has no test coverage.

  It is not only used by users, but also by the test framework and ~10 test files via `get_wallet_rpc()`.

  This PR adds coverage, while simultaneously improving the `-getinfo` coverage when multiple wallets are loaded. This is similar to the test coverage that would be added in #18594.

ACKs for top commit:
  robot-visions:
    ACK 2495110012

Tree-SHA512: caaa8b99fb8fa481ab2c6b2a287ed29720bb4553c3f66657462c44fa2990acaaf36cabeaaf81408678e5fdce4e105d729dd94b5ed8588dd1a6f2cb03fc25acf3
2020-04-24 18:41:22 -04:00
MarcoFalke
fabe44e815
bench: Start nodes with -nodebuglogfile 2020-04-24 16:46:54 -04:00
MarcoFalke
a215c61333
Merge #18756: refactor: test: use wait_for_getdata() in p2p_compactblocks.py
c4027e7350 refactor: test: use wait_for_getdata() in p2p_compactblocks.py (Sebastian Falbesoner)

Pull request description:

  The method `wait_for_getdata()` was recently changed to be more precise by waiting for a specified list of hashes, instead of only matching _any_ `getdata` message (see Issue #18614 and PR  #18690). This PR replaces the remaining occurences of manual inspection of `last_messages` with this call.

ACKs for top commit:
  robot-visions:
    ACK c4027e7350

Tree-SHA512: e10b346742f235b6ee2ef1f32f7fd74406c1a277389f020fb9913a93e94cc9530e1e9414872b83c9d2ae652ebce2b09b2c8c8372260c1afb4e0e54fbf7a935b0
2020-04-24 16:37:17 -04:00
MarcoFalke
29637a5c56
Merge #18745: test: Check submitblock return values
fa262712ca test: Check submitblock return values (MarcoFalke)

Pull request description:

  Add `assert_equal` in some tests to check the `submitblock` return value

ACKs for top commit:
  robot-visions:
    ACK fa262712ca

Tree-SHA512: 25d9effe82a4f6852184b9ac848f96336cc2cafb0bb07edb2792f00cd363f0759575bc9c164dd62f64425d3754028b4acd0675600c07d51277aa80bf66c6f960
2020-04-24 16:34:43 -04:00
Jon Atack
2495110012
test: add coverage for -rpcwallet cli option
and add -getinfo coverage with multiple wallets loaded.
2020-04-24 21:51:00 +02:00
MarcoFalke
8c0f86f284
Merge #18757: test: Remove enumeration of expected deserialization exceptions in ProcessMessage(...) fuzzer
fdceb63283 fuzz: Remove enumeration of expected deserialization exceptions in ProcessMessage(...) fuzzer (practicalswift)

Pull request description:

  Remove enumeration of expected deserialization exceptions in `ProcessMessage(...)` fuzzer.

  Closes #18749.

Top commit has no ACKs.

Tree-SHA512: fe0411dd1e574fe635019d9e3329202798295c8be1b0c5cb9c092ecc27ab7d4d2883104d7bd781ff5d422d13480d858fc8a7f5578d09268d142ae966afb79002
2020-04-24 14:38:23 -04:00
MarcoFalke
7812889849
Merge #18157: doc: fixing init.md documentation to not require rpcpassword
a2a03c3ca9 fixing documentation to not require rpcpassword (“jkcd”)

Pull request description:

  Configuration section in [doc/init.md](https://github.com/bitcoin/bitcoin/blob/master/doc/init.md) says user must set rpcpassword in order to run bitcoind. Since [71cbea](71cbeaad9a) fixed the code to use a cookie for authentication, it is not mandatory to set rpcpassword in the configuration.

  Fixes #16346

ACKs for top commit:
  hebasto:
    ACK a2a03c3ca9, modulo nit

Tree-SHA512: a62816fef78bed32200bb278cfc7aacf6ea154a60fdf5181927e48b806a1bd694bdf3ccec8362f5e58aad694d636c63f540323d54d85b61deaa417b95b8b56eb
2020-04-24 14:22:14 -04:00
Hennadii Stepanov
8098dea069
test: Add mempool_updatefromblock.py 2020-04-24 18:18:34 +03:00
practicalswift
fdceb63283 fuzz: Remove enumeration of expected deserialization exceptions in ProcessMessage(...) fuzzer 2020-04-24 14:53:59 +00:00
MarcoFalke
d1aa0ae1ad
Merge #18712: test: display command line options passed to send_cli() in debug log
8f5dc8800a test: display command line options passed to send_cli() in debug log (Jon Atack)

Pull request description:

  as per https://github.com/bitcoin/bitcoin/pull/18691#discussion_r411382589, and revert two cli calls changed in #18691 from rpc commands back to command line options (these were the only occurrences).

ACKs for top commit:
  MarcoFalke:
    ACK 8f5dc8800a

Tree-SHA512: fcb3eca00aa4099066028c90d5e50a02e074366e09a17f5f5b937d9f7562dd054ff65681aa0ad4c94f6de1e98b1e2b9ac4cd084ddc297010253989a80483b1b9
2020-04-24 08:41:15 -04:00
practicalswift
fd8e99da57 tests: Add fuzzing harness for functions in primitives/transaction.h 2020-04-24 12:16:03 +00:00
MarcoFalke
85bae24d06
Merge #18752: test: Fix intermittent error in mempool_reorg
fae98668d1 test: Fix intermittent error in mempool_reorg (MarcoFalke)

Pull request description:

  Example: https://travis-ci.org/github/bitcoin/bitcoin/jobs/677689899#L4717

  Also speed up tx relay and fix two pep8 errors while touching the file anyway.

ACKs for top commit:
  vasild:
    utACK fae9866

Tree-SHA512: 23a7894e71ad0e1a59c74c73643708fca21b505fa4e980038d554294063fd63c396669eefb233ffdffb0083968e51b702c643cb449df8f656dd8345a20f33907
2020-04-24 07:57:48 -04:00
Sebastian Falbesoner
c4027e7350 refactor: test: use wait_for_getdata() in p2p_compactblocks.py 2020-04-24 13:55:20 +02:00
fanquake
d8ca51db5d
Merge #18589: Fix naming of macOS SDK and clarify version
eb37275a6f Fix naming of macOS SDK and clarify version (Andrew Chow)

Pull request description:

  Fixes the `MacOSX10.14.sdk.tar.gz` creation command to have `MacOSX.sdk` be correctly named as `MacOSX10.14.sdk` and for the resulting file to be placed in the current directory. Gitian requires that `tar.gz` contains a folder named `MacOSX10.14.sdk` and the command did not do this originally. Having the file be placed in the current directory is a convenience so builders don't have to go find it.

  Also clarifies which version of Xcode to download and where it can be downloaded.

ACKs for top commit:
  fanquake:
    ACK eb37275a6f - tested the macOS and Linux SDK extraction. Also noticed something seemingly broken with Apple `tar`, but will open an issue to follow up.
  Sjors:
    ACK eb37275 for the macOS instruction

Tree-SHA512: d691e14711cf195999291dd6fb7ffe552c86f8b30d2b1a77e88b4db6050dd817ba128b047cf36d29b0bb0d4183e709b7c03aa27f31b64e562ea8cd948434ca55
2020-04-24 17:22:54 +08:00
MarcoFalke
fa8b9b5d1f
test: Fix intermittent failure in wallet_importmulti 2020-04-23 19:01:26 -04:00
MarcoFalke
fae98668d1
test: Fix intermittent error in mempool_reorg 2020-04-23 18:43:44 -04:00
Amiti Uttarwar
50fc4df6c4 [mempool] Persist unbroadcast set to mempool.dat
Ensure that the unbroadcast set will still be meaningful if the node is
restarted.
2020-04-23 14:42:25 -07:00
Amiti Uttarwar
297a178536 [test] Integration tests for unbroadcast functionality
Check that...
- mempool tracks & reattempts delivery of a transaction where a GETDATA hasn't
  been requested by a peer yet.
- transaction delivery is not attempted again after GETDATA is received.
- transaction is removed from the unbroadcast set when its removed from the
  mempool.
2020-04-23 14:42:25 -07:00
Amiti Uttarwar
6851502472 [refactor/test] Extract P2PTxInvStore into test framework 2020-04-23 14:42:25 -07:00
Amiti Uttarwar
dc1da48dc5 [wallet] Update the rebroadcast frequency to be ~1/day.
Since the mempool unbroadcast mechanism handles the reattempts for initial
broadcast, the wallet rebroadcast attempts can be much less frequent
(previously ~1/30 min)
2020-04-23 14:42:25 -07:00
Amiti Uttarwar
e25e42f20a [p2p] Reattempt initial send of unbroadcast transactions
Every 10-15 minutes, the scheduler kicks off a job that queues unbroadcast
transactions onto each node.
2020-04-23 14:42:25 -07:00
Amiti Uttarwar
7e93eecce3 [util] Add method that returns random time in milliseconds 2020-04-23 14:42:25 -07:00
Amiti Uttarwar
89eeb4a333 [mempool] Track "unbroadcast" transactions
- Mempool tracks locally submitted transactions (wallet or rpc)
- Transactions are removed from set when the node receives a GETDATA request
  from a peer, or if the transaction is removed from the mempool.
2020-04-23 14:42:25 -07:00
Andrew Chow
223588b1bb Add a --descriptors option to various tests
Adds a --descriptors option globally to the test framework. This will
make the test create and use descriptor wallets. However some tests may
not work with this.

Some tests are modified to work with --descriptors and run with that
option in test_runer:
* wallet_basic.py
* wallet_encryption.py
* wallet_keypool.py
* wallet_keypool_topup.py
* wallet_labels.py
* wallet_avoidreuse.py
2020-04-23 13:59:48 -04:00
Andrew Chow
869f7ab30a tests: Add RPCOverloadWrapper which overloads some disabled RPCs
RPCOverloadWrapper overloads some deprecated or disabled RPCs with
an implementation using other RPCs to avoid having a ton of code churn
around replacing those RPCs.
2020-04-23 13:59:48 -04:00
Andrew Chow
cf06062859 Correctly check for default wallet 2020-04-23 13:59:48 -04:00
Andrew Chow
886e0d75f5 Implement CWallet::IsSpentKey for non-LegacySPKMans 2020-04-23 13:59:48 -04:00
Andrew Chow
3c19fdd2a2 Return error when no ScriptPubKeyMan is available for specified type
When a CWallet doesn't have a ScriptPubKeyMan for the requested type
in GetNewDestination, give a meaningful error. Also handle this in
Qt which did not do anything with errors.
2020-04-23 13:59:48 -04:00
Andrew Chow
388ba94231 Change wallet_encryption.py to use signmessage instead of dumpprivkey 2020-04-23 13:59:48 -04:00
Andrew Chow
1346e14831 Functional tests for descriptor wallets 2020-04-23 13:59:48 -04:00
Hugo Nguyen
f193ea889d add importdescriptors RPC and tests for native descriptor wallets
Co-authored-by: Andrew Chow <achow101-github@achow101.com>
2020-04-23 13:59:48 -04:00
Andrew Chow
ce24a94494 Add IsLegacy to CWallet so that the GUI knows whether to show watchonly 2020-04-23 13:59:48 -04:00
Andrew Chow
1cb42b22b1 Generate new descriptors when encrypting 2020-04-23 13:59:48 -04:00
Andrew Chow
82ae02b165 Be able to create new wallets with DescriptorScriptPubKeyMans as backing 2020-04-23 13:59:48 -04:00
Andrew Chow
b713baa75a Implement GetMetadata in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow
8b9603bd0b Change GetMetadata to use unique_ptr<CKeyMetadata> 2020-04-23 13:59:48 -04:00
Andrew Chow
72a9540df9 Implement FillPSBT in DescriptorScriptPubKeyMan
FillPSBT will add our own scripts to the PSBT if those inputs are ours.
If an input also lists pubkeys that we happen to know the private keys
for, we will sign those inputs too.
2020-04-23 13:59:48 -04:00
Andrew Chow
84b4978c02 Implement SignMessage for descriptor wallets 2020-04-23 13:59:48 -04:00
Andrew Chow
bde7c9fa38 Implement SignTransaction in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow
d50c8ddd41 Implement GetSolvingProvider for DescriptorScriptPubKeyMan
Internally, a GetSigningProvider function is introduced which allows for
some private keys to be optionally included. This can be called with a
script as the argument (i.e. a scriptPubKey from our wallet when we are
signing) or with a pubkey. In order to know what index to expand the
private keys for that pubkey, we need to also cache all of the pubkeys
involved when we expand the descriptor. So SetCache and TopUp are
updated to do this too.
2020-04-23 13:59:48 -04:00
Andrew Chow
f1ca5feb4a Implement GetKeypoolOldestTime and only display it if greater than 0 2020-04-23 13:59:48 -04:00
Andrew Chow
586b57a9a6 Implement ReturnDestination in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow
f866957979 Implement GetReservedDestination in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow
a775f7c7fd Implement Unlock and Encrypt in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow
bfdd073486 Implement GetNewDestination for DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow
58c7651821 Implement TopUp in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow
e014886a34 Implement SetupGeneration for DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00