Commit Graph

3391 Commits

Author SHA1 Message Date
Maayan Keshet
06e1fb0b17 Add new format string placeholders for walletnotify to include relevant block information for transactions 2021-03-15 18:45:36 +02:00
MarcoFalke
e9b6400a1e
Merge #21411: test: add logging, reduce blocks, move sync_all in wallet_ groups
c62f9bc0e9 test: use fewer blocks in wallet_groups and move sync call (Jon Atack)
3a16b5ef95 test: add missing logging to wallet_groups.py (Jon Atack)

Pull request description:

  - add logging (particularly useful as the tests are somewhat slow)
  - generate 101 blocks instead of 110
  - move `sync_all` call into the loop, so fewer blocks are synced on each call, to hopefully see fewer CI timeouts as in https://bitcoinbuilds.org/index.php?ansilog=88eee99e-1727-44ed-b778-3b9c75c33928.log

  ```
  L2742     File "/home/ubuntu/src/test/functional/wallet_groups.py", line 162, in run_test
  L2743       self.sync_all()
  test_framework.authproxy.JSONRPCException: 'syncwithvalidationinterfacequeue' RPC took longer than 960.000000 seconds. Consider using larger timeout for calls that take longer to return. (-344)
  ```

ACKs for top commit:
  MarcoFalke:
    cr ACK c62f9bc0e9

Tree-SHA512: 711deafcd589cb8196cb207ff882e0f2ab6b70828a6abad91f83f535974cc430a56b9e8a960fd233d31d610932a0d48b49ee681aae564d145a3040288ecda8f8
2021-03-11 19:09:09 +01:00
Jon Atack
c62f9bc0e9
test: use fewer blocks in wallet_groups and move sync call
- generate 101 blocks instead of 110

- move a sync_all call into the loop so that fewer blocks are
  synced on each call to hopefully see fewer timeouts
2021-03-11 17:15:05 +01:00
MarcoFalke
ceb6df391f
Merge #21388: doc: Rename fuzz seed_dir to corpus_dir
fad0ae6bb8 doc: Rename fuzz seed_dir to corpus_dir (MarcoFalke)

Pull request description:

  The fuzz corpus directory might contain hand-crafted seeds, but generally it is a set of test inputs. See also https://github.com/google/fuzzing/blob/master/docs/glossary.md#corpus

ACKs for top commit:
  practicalswift:
    cr ACK fad0ae6bb8: patch looks correct and "why not?" :)
  fanquake:
    ACK fad0ae6bb8 - did not test

Tree-SHA512: 38c952feb07aeeeb038b3261a12c824fab9ce5153d75f0ecf6d3f43db4f50998eeb2b14b11b7155f529189c93783fa2c11c81059021a04398c43f3505b31a2d4
2021-03-10 07:32:15 +01:00
Samuel Dobson
a8b0892b74
Merge #20536: wallet: Error with "Transaction too large" if the funded tx will end up being too large after signing
48a0319bab Add a test that selects too large if BnB is used (Andrew Chow)
3e69939b78 Fail if maximum weight is too large (Andrew Chow)
51e2cd322c Have CalculateMaximumSignedTxSize also compute tx weight (Andrew Chow)

Pull request description:

  Currently the `Transaction too large` is calculated on the transaction that is returned from `CreateTransaction`. This does not make sense for when `CreateTransaction` is being used for `fundrawtransaction` as no signing occurs so the final returned transaction is missing signatures. Thus users may successfully fund a transaction but fail to broadcast it after it has been fully signed.

  So instead we should figure out whether the transaction we are funding will be too large after it is signed. We can do this by having `CalculateMaximumSignedTxSize` also return the transaction weight and then comparing that weight against the maximum weight.

ACKs for top commit:
  instagibbs:
    ACK 48a0319bab
  meshcollider:
    utACK 48a0319bab
  Xekyo:
    utACK with nits 48a0319bab

Tree-SHA512: 1700c60b07f67e2d5c591c5ccd131ac9f1861fab3def961c3c9c4b3281ec1063fe8e4f0f7f1038cac72692340856406bcee8fb45c8104d2ad34357a0ec878ac7
2021-03-09 10:42:21 +13:00
MarcoFalke
fad0ae6bb8
doc: Rename fuzz seed_dir to corpus_dir 2021-03-08 15:23:51 +01:00
Jon Atack
3a16b5ef95
test: add missing logging to wallet_groups.py 2021-03-07 20:25:11 +01:00
MarcoFalke
f7653eb5ae
Merge #21345: test: bring p2p_leak.py up to date
a061a29970 test: bring p2p_leak.py up to date. (Martin Zumsande)

Pull request description:

  After the introduction of wtxidrelay and sendaddrv2 messages during version handshake, extend p2p_leak.py test to reflect this.
  Also, some minor fixes and doc improvements.

  I also added a test that peers not completing the version handshake will be disconnected for timeout, as suggested by MarcoFalke in https://github.com/bitcoin/bitcoin/pull/19723#issuecomment-699540294.

ACKs for top commit:
  brunoerg:
    Tested ACK a061a29970
  theStack:
    Tested ACK a061a29970

Tree-SHA512: 26c601491fa8710fc972d1b8f15da6b387a95b42bbfb629ec4c668769ad3824b6dd6a33d97363bca2171e403d8d1ce08abf3e5c9cab34f98d53e0109b1c7a0e5
2021-03-05 08:18:42 +01:00
fanquake
fbf5d16238
Merge #21246: doc: Correction for VerifyTaprootCommitment comments
6a0a6e7d05 Correction for VerifyTaprootCommitment comments (Russell O'Connor)

Pull request description:

  According to BIP-341, 'p' is called the taproot *internal* key, not inner key.

ACKs for top commit:
  sipa:
    ACK 6a0a6e7d05
  benthecarman:
    ACK 6a0a6e7d05
  theStack:
    ACK 6a0a6e7d05

Tree-SHA512: 94f553476a8404bff4b2d5724a1a54c5f530b987a616cd00a3800095f245c06e3c7a9066c729976f32069a56029406859a70ba523151d333dc1ed874f242bce8
2021-03-05 10:30:33 +08:00
Wladimir J. van der Laan
92b7efcf54
Merge #21148: Split orphan handling from net_processing into txorphanage
5e50e2d1b9 txorphanage: comment improvements (Anthony Towns)
eeeafb324e net_processing: move AddToCompactExtraTransactions into PeerManagerImpl (Anthony Towns)
f8c0688b94 scripted-diff: Update txorphanage naming convention (Anthony Towns)
6bd4963c06 txorphanage: Move functions and data into class (Anthony Towns)
03257b832d txorphanage: Extract EraseOrphansForBlock (Anthony Towns)
3c4c3c2fdd net_processing: drop AddOrphanTx (Anthony Towns)
26d1a6ccd5 denialofservices_tests: check txorphanage's AddTx (Anthony Towns)
1041616d7e txorphanage: Extract OrphanageAddTx (Anthony Towns)
f294da7274 txorphanage: Extract GetOrphanTx (Anthony Towns)
83679ffc60 txorphanage: Extract HaveOrphanTx (Anthony Towns)
ee135c8d5b txorphanage: Extract AddChildrenToWorkSet (Anthony Towns)
38a11c355a txorphanage: Add lock annotations (Anthony Towns)
81dd57e5b1 txorphanage: Pass uint256 by reference instead of value (Anthony Towns)
9d5313df7e move-only: Add txorphanage module (Anthony Towns)

Pull request description:

  Splits orphan handling into its own module and reduces global usage.

ACKs for top commit:
  jnewbery:
    utACK 5e50e2d1b9
  amitiuttarwar:
    utACK 5e50e2d1b9
  glozow:
    re ACK 5e50e2d1b9, comment updates
  laanwj:
    Code review ACK 5e50e2d1b9

Tree-SHA512: 92a959bb5dd414c96f78cb8dcaa68adb85faf16b8b843a2cbe0bb2aa08df13ad6bd9424d29b98f57a82ec29c942fbdbea3011883d00bf0b0feb643e295174e46
2021-03-04 10:16:38 +01:00
MarcoFalke
d099894ec1
Merge #20969: test: check that getblockfilter RPC fails without block filter index
233a886b42 test: check that getblockfilter RPC fails without block filter index (Sebastian Falbesoner)

Pull request description:

  If a node was started without compact block filter index (parameter `--blockfilterindex=0`), the `getblockfilter` RPC call should fail.

ACKs for top commit:
  MarcoFalke:
    review ACK 233a886b42

Tree-SHA512: c8824373fad7d1de2dcb43c1d9541d736b478235be243080d2b7479c2588eac0e5722337ec1307394b331e0002fbcabb368e4955c2dc98dd5fce76d8c089e8a1
2021-03-04 08:37:10 +01:00
Martin Zumsande
a061a29970 test: bring p2p_leak.py up to date.
After the introduction of wtxidrelay and sendaddrv2 messages during
version handshake, extend p2p_leak.py test to reflect this.
Also, some minor fixes and doc improvements.
2021-03-03 00:16:16 +01:00
Wladimir J. van der Laan
b9f41df1ea
Merge #20685: Add I2P support using I2P SAM
a701fcf01f net: Do not skip the I2P network from GetNetworkNames() (Vasil Dimov)
0181e24439 net: recognize I2P from ParseNetwork() so that -onlynet=i2p works (Vasil Dimov)
b905363fa8 net: accept incoming I2P connections from CConnman (Vasil Dimov)
0635233a1e net: make outgoing I2P connections from CConnman (Vasil Dimov)
9559bd1404 net: add I2P to the reachability map (Vasil Dimov)
76c35c60f3 init: introduce I2P connectivity options (Vasil Dimov)
c22daa2ecf net: implement the necessary parts of the I2P SAM protocol (Vasil Dimov)
5bac7e45e1 net: extend Sock with a method to check whether connected (Vasil Dimov)
42c779f503 net: extend Sock with methods for robust send & read until terminator (Vasil Dimov)
ea1845315a net: extend Sock::Wait() to report a timeout (Vasil Dimov)
78fdfbea66 net: dedup MSG_NOSIGNAL and MSG_DONTWAIT definitions (Vasil Dimov)
34bcfab562 net: move the constant maxWait out of InterruptibleRecv() (Vasil Dimov)
cff65c4a27 net: extend CNetAddr::SetSpecial() to support I2P (Vasil Dimov)
f6c267db3b net: avoid unnecessary GetBindAddress() call (Vasil Dimov)
7c224fdac4 net: isolate the protocol-agnostic part of CConnman::AcceptConnection() (Vasil Dimov)
1f75a653dd net: get the bind address earlier in CConnman::AcceptConnection() (Vasil Dimov)
25605895af net: check for invalid socket earlier in CConnman::AcceptConnection() (Vasil Dimov)
545bc5f81d util: fix WriteBinaryFile() claiming success even if error occurred (Vasil Dimov)
8b6e4b3b23 util: fix ReadBinaryFile() returning partial contents (Vasil Dimov)
4cba2fdafa util: extract {Read,Write}BinaryFile() to its own files (Vasil Dimov)

Pull request description:

  Add I2P support by using the [I2P SAM](https://geti2p.net/en/docs/api/samv3) protocol. Unlike Tor, for incoming connections we get the I2P address of the peer (and they also receive ours when we are the connection initiator).

  Two new options are added:

  ```
    -i2psam=<ip:port>
         I2P SAM proxy to reach I2P peers and accept I2P connections (default:
         none)

    -i2pacceptincoming
         If set and -i2psam is also set then incoming I2P connections are
         accepted via the SAM proxy. If this is not set but -i2psam is set
         then only outgoing connections will be made to the I2P network.
         Ignored if -i2psam is not set. Notice that listening for incoming
         I2P connections is done through the SAM proxy, not by binding to
         a local address and port (default: true)
  ```

  # Overview of the changes

  ## Make `ReadBinary()` and `WriteBinary()` reusable

  We would need to dump the I2P private key to a file and read it back later. Move those two functions out of `torcontrol.cpp`.

  ```
  util: extract {Read,Write}BinaryFile() to its own files
  util: fix ReadBinaryFile() returning partial contents
  util: fix WriteBinaryFile() claiming success even if error occurred
  ```

  ## Split `CConnman::AcceptConnection()`

  Most of `CConnman::AcceptConnection()` is agnostic of how the socket was accepted. The other part of it deals with the details of the `accept(2)` system call. Split those so that the protocol-agnostic part can be reused if we accept a socket by other means.

  ```
  net: check for invalid socket earlier in CConnman::AcceptConnection()
  net: get the bind address earlier in CConnman::AcceptConnection()
  net: isolate the protocol-agnostic part of CConnman::AcceptConnection()
  net: avoid unnecessary GetBindAddress() call
  ```

  ## Implement the I2P [SAM](https://geti2p.net/en/docs/api/samv3) protocol (not all of it)

  Just the parts that would enable us to make outgoing and accept incoming I2P connections.

  ```
  net: extend CNetAddr::SetSpecial() to support I2P
  net: move the constant maxWait out of InterruptibleRecv()
  net: dedup MSG_NOSIGNAL and MSG_DONTWAIT definitions
  net: extend Sock::Wait() to report a timeout
  net: extend Sock with methods for robust send & read until terminator
  net: extend Sock with a method to check whether connected
  net: implement the necessary parts of the I2P SAM protocol
  ```

  ## Use I2P SAM to connect to and accept connections from I2P peers

  Profit from all of the preceding commits.

  ```
  init: introduce I2P connectivity options
  net: add I2P to the reachability map
  net: make outgoing I2P connections from CConnman
  net: accept incoming I2P connections from CConnman
  net: recognize I2P from ParseNetwork() so that -onlynet=i2p works
  net: Do not skip the I2P network from GetNetworkNames()
  ```

ACKs for top commit:
  laanwj:
    re-ACK a701fcf01f
  jonatack:
    re-ACK a701fcf01f reviewed diff per `git range-diff ad89812 2a7bb34 a701fcf`, debug built and launched bitcoind with i2pd v2.35 running a dual I2P+Torv3 service with the I2P config settings listed below (did not test `onlynet=i2p`); operation appears nominal (same as it has been these past weeks), and tested the bitcoind help outputs grepping for `-i i2p` and the rpc getpeerinfo and getnetworkinfo helps

Tree-SHA512: de42090c9c0bf23b43b5839f5b4fc4b3a2657bde1e45c796b5f3c7bf83cb8ec6ca4278f8a89e45108ece92f9b573cafea3b42a06bc09076b40a196c909b6610e
2021-03-02 11:50:13 +01:00
MarcoFalke
cfce346508
Merge #21310: zmq test: fix sync-up by matching notification to generated block
8a8c6383f6 zmq test: fix sync-up by matching notification to generated block (Sebastian Falbesoner)

Pull request description:

  This is a follow-up PR for #21008, fixes #21216.

  In the course of investigating the problem with jnewbery (analyzing the Cirrus log https://cirrus-ci.com/task/4660108304056320), it turned out that the "sync up" procedure of repeatedly generating a block and waiting for a notification with timeout is too brittle in its current form, as the following scenario could happen:

  - generate block A
  - receive notification, timeout happens => repeat procedure
  - generate block B
  - node publishes block A notification
  - receive notification, we receive the one caused by block A (!!!) => sync-up procedure is completed
  - node publishes block B notification
  - the actual test starts
  - on the first notification reception, the one caused by block B is received, rather than the one actually caused by test code => assertion failure

  This change in the PR ensures that after each test block generation, we wait for the notification that is actually caused by that block and ignore others from possibly earlier blocks. The matching is kind of ugly, it assumes that one out of four components in the block is contained in the notification: the block hash, the tx id, the raw block data or the raw transaction data. (Unfortunately we have to support all publisher topics.)

  I'm aware that this is quite a lot of code now only for establishing a robust test setup. OTOH I wouldn't know of a better method right now, suggestions are very welcome.

  Note for potential reviewers: for both reproducing the issue on master branch and verifying on PR branch, one can simply generate two blocks in the sync-up procedure rather than one.

ACKs for top commit:
  MarcoFalke:
    Concept ACK 8a8c6383f6

Tree-SHA512: a2eb78ba06dfd0fda7b1c111b6bbfb5dab4ab08500cc19c7ea02c3239495d5c74cc7d45250a8b3ecc78ca42d97ee6719bf73db8a137839e5e09a3cfcf08ed29e
2021-03-02 11:30:17 +01:00
Vasil Dimov
a701fcf01f
net: Do not skip the I2P network from GetNetworkNames()
So that help texts include "i2p" in:
* `./bitcoind -help` (in `-onlynet` description)
* `getpeerinfo` RPC
* `getnetworkinfo` RPC

Co-authored-by: Jon Atack <jon@atack.com>
2021-03-01 18:19:47 +01:00
Vasil Dimov
76c35c60f3
init: introduce I2P connectivity options
Introduce two new options to reach the I2P network:

* `-i2psam=<ip:port>` point to the I2P SAM proxy. If this is set then
  the I2P network is considered reachable and we can make outgoing
  connections to I2P peers via that proxy. We listen for and accept
  incoming connections from I2P peers if the below is set in addition to
  `-i2psam=<ip:port>`

* `-i2pacceptincoming` if this is set together with `-i2psam=<ip:port>`
  then we accept incoming I2P connections via the I2P SAM proxy.
2021-03-01 18:19:46 +01:00
Russell O'Connor
6a0a6e7d05 Correction for VerifyTaprootCommitment comments
According to BIP-341, 'p' is called the taproot *internal* key, not inner key.
2021-03-01 09:01:48 -05:00
Wladimir J. van der Laan
362e901a17
Merge #18466: rpc: fix invalid parameter error codes for {sign,verify}message RPCs
a5cfb40e27 doc: release note for changed {sign,verify}message error codes (Sebastian Falbesoner)
9e399b9b2d test: check parameter validity in rpc_signmessage.py (Sebastian Falbesoner)
e62f0c71f1 rpc: fix {sign,message}verify RPC errors for invalid address/signature (Sebastian Falbesoner)

Pull request description:

  RPCs that accept address parameters usually return the intended error code `RPC_INVALID_ADDRESS_OR_KEY` (-5) if a passed address is invalid. The two exceptions to the rule are `signmessage` and `verifymessage`, which return `RPC_TYPE_ERROR` (-3) in this case instead. Oddly enough `verifymessage` returns `RPC_INVALID_ADDRESS_OR_KEY` when the _signature_ was malformed, where `RPC_TYPE_ERROR` would be more approriate.

  This PR fixes these inaccuracies and as well adds tests to `rpc_signmessage.py` that check the parameter validity and error codes for the related RPCs `signmessagewithprivkey`, `signmessage` and `verifymessage`.

  master branch:
  ```
  $ ./bitcoin-cli signmessage invalid_addr message
  error code: -3
  error message:
  Invalid address
  $ ./bitcoin-cli verifymessage invalid_addr dummy_sig message
  error code: -3
  error message:
  Invalid address
  $ ./bitcoin-cli verifymessage 12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX invalid_sig message
  error code: -5
  error message:
  Malformed base64 encoding
  ```
  PR branch:
  ```
  $ ./bitcoin-cli signmessage invalid_addr message
  error code: -5
  error message:
  Invalid address
  $ ./bitcoin-cli verifymessage invalid_addr dummy_sig message
  error code: -5
  error message:
  Invalid address
  $ ./bitcoin-cli verifymessage 12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX invalid_sig message
  error code: -3
  error message:
  Malformed base64 encoding
  ```

ACKs for top commit:
  laanwj:
    Code review ACK a5cfb40e27
  meshcollider:
    utACK a5cfb40e27

Tree-SHA512: bae0c4595a2603cea66090f6033785601837b45fd853052312b3a39d8520566c581994b68f693dd247c22586c638c3b7689c849085cce548cc36b9bf0e119d2d
2021-03-01 11:45:42 +01:00
Sebastian Falbesoner
8a8c6383f6 zmq test: fix sync-up by matching notification to generated block
It turned out that the "sync up" procedure of repeatedly generating a
block and waiting for a notification once with timeout is too naive in
its current form, as the following scenario could happen:
    - generate block A
    - receive notification, timeout happens -> repeat procedure
    - generate block B
    - node publishes block A notification
    - receive notification, we receive the one caused by block A
      -> sync-up procedure is completed
    - node publishes block B
    - the actual test starts
    - on the first notification reception, one caused by block B is received,
      rather than the one actually caused by test code, leading to failure

This change ensures that after each test block generation, we wait for
the notification that is actually caused by that block and ignore others
from possibly earlier blocks.

Co-authored-by: Jon Atack <jon@atack.com>
2021-03-01 01:31:41 +01:00
MarcoFalke
fb67caebe2
Merge #21297: test: feature_blockfilterindex_prune.py improvements
88c4b9b761 test: remove unneeded node from feature_blockfilterindex_prune.py (Jon Atack)
ace3f4cbdf test: improve assertions in feature_blockfilterindex_prune.py (Jon Atack)

Pull request description:

  - improves the assertions
  - removes an unneeded node, reducing from two to one, and some unneeded `extra_arg` code

ACKs for top commit:
  MarcoFalke:
    ACK 88c4b9b761
  brunoerg:
    Tested ACK 88c4b9b761

Tree-SHA512: 295700da3a5f583ee02ae2d184db93cce0e13aba69115d5db07f83e96a66b4b850adaff2c3725b6585799565b9ee654b1fee8a6245eaba8c21e1cb5ce524eb2b
2021-02-27 13:11:58 +01:00
Anthony Towns
6bd4963c06 txorphanage: Move functions and data into class
Collects all the orphan handling globals into a single member var in
net_processing, and ensures access is encapuslated into the interface
functions. Also adds doxygen comments for methods.
2021-02-27 01:07:55 +10:00
Wladimir J. van der Laan
8d37841cdf
Merge #21277: wallet: listdescriptors uses normalized descriptor form
a69c3b35f8 wallet: listdescriptors uses normalized descriptor form (Ivan Metlushko)

Pull request description:

  Rationale: show importable descriptors with `listdescriptors` RPC

  It uses #19136 to derive xpub at the last hardened step.

  **Before**:
  ```
  [
      {
        "desc": "wpkh(tpubD6NzVbkrYhZ4YUQRJL49TWw1VR5v3QKUNYaGGMUfJUm19x5ZqQ2hEiPiYbAQvD2nHoPGQGPg3snLPM8sjmYpvx7XQhkmyfk8xhsUwKbXzyh/84'/1'/0'/0/*)#p4cn3erf",
        "timestamp": 1613982591,
        "active": true,
        "internal": false,
        "range": [
          0,
          999
        ],
        "next": 0
      },
      ...
  ]
  ```

  **After**:
  ```
  [
    {
      "desc": "wpkh([d4ade89c/84'/1'/0']tpubDDUEYcVXy6Vh5meHvcXN3sAr4k3fWwLZGpAHbkAHL8EnkDxp4d99CjNhJHfM2fUJicANvAKnCZS6XaVAgwAeKYc1KesGCN5qbQ25qQHrRxM/0/*)#8wq8rcft",
      "timestamp": 1613982591,
      "active": true,
      "internal": false,
      "range": [
        0,
        999
      ],
      "next": 0
    },
    ...
  ]
  ```

ACKs for top commit:
  achow101:
    ACK a69c3b35f8

Tree-SHA512: 4f92e726cb8245aa0b520729cfd272945f0c66830f0555544e0618883aca516318543fa6ab1862058c64b4e4ed54ad1da953e032f4846eef7454122031c1b005
2021-02-26 10:08:02 +01:00
Jon Atack
88c4b9b761
test: remove unneeded node from feature_blockfilterindex_prune.py 2021-02-25 18:05:59 +01:00
Jon Atack
ace3f4cbdf
test: improve assertions in feature_blockfilterindex_prune.py 2021-02-25 15:10:19 +01:00
MarcoFalke
c0e44ee8e4
Merge #21254: test: Avoid connecting to real network when running tests
fa730e9157 test: Avoid connecting to real network when running tests (MarcoFalke)
fa1b713941 test: Assume node is running in subtests (MarcoFalke)

Pull request description:

  Introduced in #19884

ACKs for top commit:
  Sjors:
    ACK fa730e9157

Tree-SHA512: fe132a9ffe2fae1ab16857a3dec9839526fdf74d27a1ae794fbffca8356f639c4b916dc888b260281e9cc793916706c18d1687ebb5a076d4e1c481d218d308d3
2021-02-25 14:44:22 +01:00
MarcoFalke
1b1d8bde1c
Merge #21252: test: Add missing wait for sync to feature_blockfilterindex_prune
fa560cc6c4 test: Intermittent issue in feature_blockfilterindex_prune (MarcoFalke)

Pull request description:

  https://cirrus-ci.com/task/4962244553342976?command=ci#L5131

  The index is built in a background thread, so we have to wait for it.

ACKs for top commit:
  jonatack:
    ACK fa560cc6c4

Tree-SHA512: e7a246fe43a28511581fe34b1f5a85303b1874b2535330afc0405269cce7306984ecc6af389791321e3aa4b224819e89d9b89dd5bc080d60baa20bd007412787
2021-02-25 14:32:46 +01:00
Wladimir J. van der Laan
2059d32edb
Merge #21200: test: Speed up rpc_blockchain.py by removing miniwallet.generate()
faa137eb9e test: Speed up rpc_blockchain.py by removing miniwallet.generate() (MarcoFalke)
fa1fe80c75 test: Change address type from P2PKH to P2WSH in rpc_blockchain (MarcoFalke)
fa4d8f3169 test: Cache 25 mature coins for ADDRESS_BCRT1_P2WSH_OP_TRUE (MarcoFalke)
fad25153f5 test: Remove unused bug workaround (MarcoFalke)
faabce7d07 test: Start only the number of nodes that are needed (MarcoFalke)

Pull request description:

  Speed up various tests:

  * Remove unused nodes, which only consume time on start/stop
  * Remove unused "bug workarounds"
  * Remove the need for `miniwallet.generate()` by adding `miniwallet.scan_blocks()`. (On my system, with valgrind, generating 105 blocks takes 3.31 seconds. Rescanning 5 blocks takes 0.11 seconds.)

ACKs for top commit:
  laanwj:
    Code review ACK faa137eb9e

Tree-SHA512: ead1988d5aaa748ef9f8520af1e0bf812cf1d72e281ad22fbd172b7306d850053040526f8adbcec0b9a971c697a0ee7ee8962684644d65b791663eedd505a025
2021-02-25 10:13:39 +01:00
MarcoFalke
1b045b5eef
Merge #21053: rpc, test: document {previous,next}blockhash as optional
ba7e17e073 rpc, test: document {previous,next}blockhash as optional (Sebastian Falbesoner)

Pull request description:

  This PR updates the result help of the following RPCs w.r.t. the `previousblockhash` and `nextblockhash` fields:
  - getblockheader
  - getblock

  Also adds trivial tests on genesis block (should not contain "previousblockhash") and best block (should not contain "nextblockhash").

Top commit has no ACKs.

Tree-SHA512: ef42c5c773fc436e1b4a67be14e2532e800e1e30e45e54a57431c6abb714d2c069c70d40ea4012d549293b823a1973b3f569484b3273679683b28ed40abf46bb
2021-02-23 18:28:23 +01:00
Sjors Provoost
d4b0107d68
rpc: send: support external signer 2021-02-23 14:34:32 +01:00
Sjors Provoost
245b4457cf
rpc: signerdisplayaddress 2021-02-23 14:34:31 +01:00
Sjors Provoost
7ebc7c0215
wallet: ExternalSigner: add GetDescriptors method 2021-02-23 14:34:31 +01:00
Sjors Provoost
259f52cc33
test: external_signer wallet flag is immutable 2021-02-23 14:34:31 +01:00
Sjors Provoost
2655197e1c
rpc: add external_signer option to createwallet 2021-02-23 14:34:31 +01:00
Sjors Provoost
2700f09c41
rpc: signer: add enumeratesigners to list external signers 2021-02-23 14:34:31 +01:00
Sjors Provoost
07b7c940a7
rpc: add external signer RPC files 2021-02-23 14:34:30 +01:00
Sjors Provoost
f3e6ce78fb
test: add external signer test
Includes a mock to mimick the HWI interace.
2021-02-23 14:34:30 +01:00
Ivan Metlushko
a69c3b35f8 wallet: listdescriptors uses normalized descriptor form 2021-02-23 08:51:01 +01:00
Sjors Provoost
f7eb7ecc67
test: framework: add skip_if_no_external_signer 2021-02-21 16:27:10 +01:00
Sjors Provoost
87a97941f6
configure: add --enable-external-signer
This option replaces --with-boost-process

This prepares external signer support to be disabled by default.
It adds a configure option to enable this feature and to check
if Boost::Process is present.

This also exposes ENABLE_EXTERNAL_SIGNER to the test suite via test/config.ini
2021-02-21 16:27:10 +01:00
MarcoFalke
fa730e9157
test: Avoid connecting to real network when running tests
Can be reviewed with --word-diff-regex=.
2021-02-21 11:02:58 +01:00
MarcoFalke
fa1b713941
test: Assume node is running in subtests
Every (sub)test in the framework assumes the node is running, except for
the (sub)tests in this file. Remove that confusion by stopping the node
at the start of every subtest, instead of at the end.
2021-02-21 11:01:53 +01:00
MarcoFalke
fa560cc6c4
test: Intermittent issue in feature_blockfilterindex_prune 2021-02-21 08:08:08 +01:00
Jonas Schnelli
9f3ffa2938
Merge #21230: test: Fix NODE_NETWORK_LIMITED_MIN_BLOCKS disconnection
fa24247d0f test: Fix NODE_NETWORK_LIMITED_MIN_BLOCKS disconnection (MarcoFalke)
fab6995629 test: Make test actually test something (MarcoFalke)
fae8f35df8 test: pep8 touched test (MarcoFalke)

Pull request description:

  Fix several bugs. Also, fix #21227

ACKs for top commit:
  jonasschnelli:
    utACK fa24247d0f - thanks for fixing.
  ryanofsky:
    Code review ACK fa24247d0f with caveat above that I don't really understand the problem or fix. But the cleanups look good and the fix does seem perfectly safe. More description would be welcome!

Tree-SHA512: 67f6ec92f6493aa822ae3fa8a7426a5acdc684044b8bafc0c65b652f63ccce969d0a6f1d1f099d6a91d05f478724869345b70335f2cfcfd00df46aef05cc4f9e
2021-02-19 08:38:01 +01:00
Samuel Dobson
3a2d5bfeb3
Merge #21201: rpc: Disallow sendtoaddress and sendmany when private keys disabled
6bfbc97d71 test: disallow sendtoaddress/sendmany when private keys disabled (Jon Atack)
0997019e76 Disallow sendtoaddress and sendmany when private keys disabled (Andrew Chow)

Pull request description:

  Since `sendtoaddress` and `sendmany` (which use the `SendMoney` function) create and commit a transaction, they should not do anything when the wallet does not have private keys. Otherwise a valid transaction cannot be made.

  Fixes #21104

ACKs for top commit:
  jonatack:
    ACK 6bfbc97d71
  meshcollider:
    utACK 6bfbc97d71
  kristapsk:
    ACK 6bfbc97d71. "Error: Private keys are disabled for this wallet" is definitely a better error message than "Insufficient funds" here. Hopefully change of error code from -6 to -4 doesn't break any software using Bitcoin JSON-RPC API.

Tree-SHA512: f277d6b5252e43942d568614032596f2c0827f00cd0cb71e44ffcb9822bfb15a71730a3e3688f31e59ba4eb7d275250c4e65ad4b6b3e96be6314c56a672432fb
2021-02-19 14:00:48 +13:00
MarcoFalke
fa24247d0f
test: Fix NODE_NETWORK_LIMITED_MIN_BLOCKS disconnection 2021-02-18 20:45:05 +01:00
MarcoFalke
fab6995629
test: Make test actually test something
The context manager was not even created, so previously it did not check the debug log
2021-02-18 20:43:35 +01:00
MarcoFalke
fae8f35df8
test: pep8 touched test 2021-02-18 20:43:32 +01:00
Wladimir J. van der Laan
b805dbb0b9
Merge #19809: log: Prefix log messages with function name and source code location if -logsourcelocations is set
b4511e2e2e log: Prefix log messages with function name if -logsourcelocations is set (practicalswift)

Pull request description:

  Prefix log messages with function name if `-logfunctionnames` is set.

  Yes, exactly like `-logthreadnames` but for function names instead of thread names :)

  This is a small developer ergonomics improvement: I've found this to be a cheap/simple way to correlate log output and originating function.

  For me it beats the ordinary cycle of 1.) try to figure out a regexp matching the static part of the dynamic log message, 2.) `git grep -E 'Using .* MiB out of .* requested for signature cache'`, 3.) `mcedit filename.cpp` (`openemacs filename.cpp` works too!) and 4.) search for log message and scroll up to find the function name :)

  Without any logging parameters:

  ```
  $ src/bitcoind -regtest
  2020-08-25T03:29:04Z Using RdRand as an additional entropy source
  2020-08-25T03:29:04Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
  2020-08-25T03:29:04Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
  2020-08-25T03:29:04Z Loaded best chain: hashBestChain=0fff88f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e22ff height=0 date=2011-02-02T23:16:42Z progress=1.000000
  2020-08-25T03:29:04Z block tree size = 1
  2020-08-25T03:29:04Z nBestHeight = 0
  2020-08-25T03:29:04Z Imported mempool transactions from disk: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
  2020-08-25T03:29:04Z 0 addresses found from DNS seeds
  ```

  With `-logthreadnames` and `-logfunctionnames`:

  ```
  $ src/bitcoind -regtest -logthreadnames -logfunctionnames
  2020-08-25T03:29:04Z [init] [ReportHardwareRand] Using RdRand as an additional entropy source
  2020-08-25T03:29:04Z [init] [InitSignatureCache] Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
  2020-08-25T03:29:04Z [init] [InitScriptExecutionCache] Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
  2020-08-25T03:29:04Z [init] [LoadChainTip] Loaded best chain: hashBestChain=0fff88f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e22ff height=0 date=2011-02-02T23:16:42Z progress=1.000000
  2020-08-25T03:29:04Z [init] [AppInitMain] block tree size = 1
  2020-08-25T03:29:04Z [init] [AppInitMain] nBestHeight = 0
  2020-08-25T03:29:04Z [loadblk] [LoadMempool] Imported mempool transactions from disk: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
  2020-08-25T03:29:04Z [dnsseed] [ThreadDNSAddressSeed] 0 addresses found from DNS seeds
  ```

ACKs for top commit:
  laanwj:
    Code review ACK b4511e2e2e
  MarcoFalke:
    review ACK b4511e2e2e 🌃

Tree-SHA512: d100f5364630c323f31d275259864c597f7725e462d5f4bdedcc7033ea616d7fc0d16ef1b2af557e692f4deea73c6773ccfc681589e7bf6ba970b9ec169040c7
2021-02-18 14:37:51 +01:00
Wladimir J. van der Laan
860f916803
Merge #20524: test: Move MIN_VERSION_SUPPORTED to p2p.py
9f21ed4037 [test] Check user agent string from test framework connections (John Newbery)
9ce4c3c4c1 [test] Add P2P_SERVICES to p2p.py (John Newbery)
010542614d [test] Move MY_RELAY to p2p.py (John Newbery)
9b4054cb7a [test] Move MY_SUBVERSION to p2p.py (John Newbery)
7e158a6910 [test] Move MY_VERSION to p2p.py (John Newbery)
652311165c [test] Move MIN_VERSION_SUPPORTED to p2p.py (John Newbery)

Pull request description:

  The messages.py module should contain code and helpers for
  [de]serializing p2p messages. Specific usage of those messages should
  be in p2p.py. This PR moves test framework specific constants to p2p.py.

  It also changes the SUBVERSION constant to be a string instead of a bytes object. That means that it needs to be explicitly converted to a bytes object to serialize into a version message. Failing to do so would cause an easy-to-spot bug. This should avoid silent failures like the one solved in #20522.

ACKs for top commit:
  laanwj:
    Code review ACK 9f21ed4037

Tree-SHA512: 41d46575ac0ec36ad074d6c6a5b9cef50b05eeb8ddd8ed0a8f0d0c4617cc7b8baa6580af5b83a668230ce1ac27bf0e56914d0361a48b1b05fd75e2e60350eeaf
2021-02-18 14:01:57 +01:00
Samuel Dobson
db656db2ed
Merge #19136: wallet: add parent_desc to getaddressinfo
de6b389d5d tests: Test getaddressinfo parent_desc (Andrew Chow)
e4ac869a0a rpc: Add parent descriptor to getaddressinfo output (Andrew Chow)
bbe4a36152 wallet: Add GetDescriptorString to DescriptorScriptPubKeyMan (Andrew Chow)
9be1437c49 descriptors: Add ToNormalizedString and tests (Andrew Chow)

Pull request description:

  Adds `parent_desc` field to the `getaddressinfo` RPC to export a public descriptor. Using the given address, `getaddressinfo` will look up which `DescriptorScriptPubKeyMan` can be used to produce that address. It will then return the descriptor for that `DescriptorScriptPubKeyMan` in the `parent_desc` field. The descriptor will be in a normalized form where the xpub at the last hardened step is derived so that the descriptor can be imported to other wallets. Tests are added to check that the correct descriptor is being returned for the wallet's addresses and that these descriptors can be imported and used in other wallets.

  As part of this PR, a `ToNormalizedString` function is added to the descriptor classes. This really only has an effect on `BIP32PubkeyProvider`s that have hardened derivation steps. Tests are added to check that normalized descriptors are returned.

ACKs for top commit:
  Sjors:
    utACK de6b389d5d
  S3RK:
    Tested ACK de6b389
  jonatack:
    Tested ACK de6b389d5d modulo a few minor comments
  fjahr:
    Code review ACK de6b389d5d
  meshcollider:
    Tested ACK de6b389d5d

Tree-SHA512: a633e4a39f2abbd95afd7488484cfa66fdd2651dac59fe59f2b80a0940a2a4a13acf889c534a6948903d701484a2ba1218e3081feafe0b9a720dccfa9e43ca2b
2021-02-18 21:51:16 +13:00