Commit graph

17718 commits

Author SHA1 Message Date
Wladimir J. van der Laan 028b0d963c
Merge #13425: Moving final scriptSig construction from CombineSignatures to ProduceSignature (PSBT signer logic)
b81560029 Remove CombineSignatures and replace tests (Andrew Chow)
ed94c8b55 Replace CombineSignatures with ProduceSignature (Andrew Chow)
0422beb9b Make SignatureData able to store signatures and scripts (Andrew Chow)
b6edb4f5e Inline Sign1 and SignN (Andrew Chow)

Pull request description:

  Currently CombineSignatures is used to create the final scriptSig or an input. However ProduceSignature is capable of doing this itself. Using both CombineSignatures and ProduceSignature results in code duplication which is unnecessary.

  To move the scriptSig construction to ProduceSignatures, the SignatureData class contains two maps to hold pubkeys mapped to signatures, and script ids mapped to scripts. DataFromTransaction is extended to be able to extract signatures, their public keys, and scripts from existing ScriptSigs.

  The SignaureData are then passed down to SignStep which can use the aforementioned maps to get the signatures, pubkeys, and scripts that it needs, falling back to the actual SigningProvider and SignatureCreator if the data are not available in the SignatureData.

  Additionally, Sign1 and SignN have been removed and their functionality inlined into SignStep since Sign1 is really just a wrapper around CreateSig.

  Since ProduceSignature can produce the final scriptSig or scriptWitness by using SignatureData which has extracted data from the transaction, CombineSignatures is unnecessary as ProduceSignature is able to replicate all of CombineSignatures' functionality.

  This also furthers BIP 174 support and begins moving towards a BIP 174 style backend.

  The tests have also been updated to use the new combining methodology.

Tree-SHA512: 78cd58a4ebe37f79229bd5eee2958a0bb45cd7f36d0e993eee13ff685b3665dd76ef2dfd5f47d34678995bb587f5594100ee5f6c09b1c69ee96d3684d470d01e
2018-07-05 17:18:50 +02:00
Ken Lee 70afa65b17
Fix depends Qt5.9.4 mac build
Apply patch from QTBUG-67286
2018-07-05 17:12:52 +02:00
Sebastian Kung 28482efefb
Ugrade Qt depends to Qt5.9.4
Depends can now be built with Qt5.9.4 , which is Qt's new long term
support version.
2018-07-05 17:12:42 +02:00
Wladimir J. van der Laan 40334c71d6
Merge #13580: build: Detect if char equals int8_t
49d1f4cdd Detect if char equals int8_t (Chun Kuan Lee)

Pull request description:

  Probably fixes #13576. I'm not able to test this. @stacepellegrino, can you test this?

Tree-SHA512: b750e00e11e6b6f6341fec668ec2254cc101c8ebdd4878f320d6cb3b07cf326761146e4ceff0b6405b7e503ff64c093a8274bd524a097e2c49382dc296972c4f
2018-07-05 13:34:15 +02:00
Akio Nakamura 1fc605a8ae fix bench/prevector.cpp
1. PrevectorClear()
2nd call of clear() should to operate t1 instead of t0.
This patch changes t0 to t1.

2. PREVECTOR_TEST()
PREVECTOR_TEST macro should to call both
PrevectorXX<nontrivial_t>(state) and PrevectorXX<trivial_t>(state)
by specific "name" which given by parameter instead of calling
PrevectorResize<>() regardless of "name".
This patch changes "PrevectorResize<" of this macro to
"Prevector ## name<".
2018-07-05 20:04:48 +09:00
Daniel Kraft 161e8d40a4 RPC: Add new getzmqnotifications method.
This adds a new RPC method "getzmqnotifications", which returns
information about all active ZMQ notification endpoints.  This is useful
for software that layers on top of bitcoind, so it can verify that
ZeroMQ is enabled and also figure out where it should listen.

See https://github.com/bitcoin/bitcoin/issues/13526.
2018-07-05 08:02:22 +02:00
Wladimir J. van der Laan b77c38e06c
Merge #13588: Docs: Improve doc of options addnode, connect, seednode
b330c3001 Docs: Improve doc of options addnode, connect, seednode (wodry)

Pull request description:

  Just clarify that options `addnode`, `connect` and `seednode` can be specified multiple times.

Tree-SHA512: ed149cabe7fc1d40f2fb6ad8b643656e0ec49cfae1834c157c89170eac1241efa3c5683d97266ff921f5229f28d732c9f7ee030e7902d9a79db1e0c8716fa3db
2018-07-04 15:57:40 +02:00
Wladimir J. van der Laan 79e677950b
Merge #13235: Break circular dependency: init -> * -> init by extracting shutdown.h
1fabd59e7 Break circular dependency: init -> * -> init by extracting shutdown.h (Ben Woosley)
e62fdfeea Drop unused init.h includes (Ben Woosley)

Pull request description:

  Most includers just wanted to react to pending shutdown.

  This isolates access to `fRequestShutdown` and limits access to the shutdown api functions, including the new `CancelShutdown` for setting it to `false`.

Tree-SHA512: df42f75dfbba163576710e9a67cf1228531fd99d70a2f187bfba0bcc476d6749cf88180a97e66a81bb5b6c3c7f0917de7402d26039ba7b644cb7509b02f7e267
2018-07-04 15:34:03 +02:00
Wladimir J. van der Laan 1756cb4472
Merge #13592: Docs: Modify policy to not translate command-line help
747ee89b4 Docs: Modify policy to not translate command-line help (Chun Kuan Lee)

Pull request description:

  After #13341, command-line helps would no longer be translated.

Tree-SHA512: 73e7a7545b316cc6ec07f2527cc0e63c922d8e382abd779638583d55a4ee0f3b26ecc9d63f51da8bab2eda9829ec5d1b3162a1115c78a1add2621ba2ccdb839e
2018-07-04 14:38:50 +02:00
Wladimir J. van der Laan 5c05dd6285
Merge #13575: Refactor: Rename NET_TOR to NET_ONION
07c493f2d scripted-diff: Replace NET_TOR with NET_ONION (wodry)

Pull request description:

  This is a follow-up to #13532, where @promag already asked if this renaming would make sense.

  If network shall be named _Onion_ instead of _Tor_ (like in the option `onlynet`), renaming the network enum NET_TOR to NET_ONION maybe would make sense and be stringent.

  Change was produced with the following script:

  ```
  #!/bin/bash

  for file in $(grep --exclude-dir='.git' --files-with-matches --binary-files=without-match --recursive NET_TOR bitcoin/)
  do
      sed --in-place --expression='s/NET_TOR/NET_ONION/g' $file
  done
  ```

  _Tor_ is used at many other places in the code, though.

Tree-SHA512: 4ffdeca8115031465eb64e1c76694fb77b5900c4ea465d3c13d9b6b75a1eb04c45913f83cdc8bdbef28936aeec4655f1d4905b3b98407da3263632a2128a8d23
2018-07-04 12:00:55 +02:00
Wladimir J. van der Laan 61a044a86a
Merge #13491: Improve handling of INVALID in IsMine
bb582a59c Add P2WSH destination helper and use it instead of manual hashing (Pieter Wuille)
eaba1c111 Add additional unit tests for invalid IsMine combinations (Pieter Wuille)
e6b9730c4 Do not expose invalidity from IsMine (Pieter Wuille)

Pull request description:

  This improves the handling of INVALID in IsMine:
  * Extra INVALID conditions were added to `IsMine` (following https://github.com/bitcoin/bitcoin/pull/13142/files#r185349057), but these were untested. Add unit tests for them.
  * In https://github.com/bitcoin/bitcoin/pull/13142#issuecomment-386396975 it was suggested to merge `isInvalid` into the return status. This PR takes a different approach, and removes the `isInvalid` entirely. It was only ever used inside tests, as normal users of IsMine don't care about the reason for non-mine-ness, only whether it is or not. As the unit tests are extensive enough, it seems sufficient to have a black box text (with tests for both compressed and uncompressed keys).

  Some addition code simplification is done as well.

Tree-SHA512: 3267f8846f3fa4e994f57504b155b0e1bbdf13808c4c04dab7c6886c2c0b88716169cee9c5b350513297e0ca2a00812e3401acf30ac9cde5d892f9fb59ad7fef
2018-07-04 11:36:42 +02:00
Wladimir J. van der Laan b9ded733c1
Merge #13568: Trivial: Remove double semicolon from wallet.cpp and misc.cpp
1336d9cb3 Delete double semicolon in wallet.cpp and misc.cpp (Matteo Sumberaz)

Pull request description:

Tree-SHA512: 86a65df8fdcf8b909ebdebbc510ed57df7c089707a6967c9714c653049eed5d193203443446659c8bbec3f64c12770466455ebedaf5d68cb2869561a477fcfd7
2018-07-04 11:28:05 +02:00
Chun Kuan Lee 747ee89b4c
Docs: Modify policy to not translate command-line help 2018-07-04 09:18:29 +08:00
Andrew Chow b815600295 Remove CombineSignatures and replace tests
Removes CombineSignatures and replaces its use in tests with
ProduceSignature to test the same behavior for ProduceSignature.
2018-07-03 17:19:23 -07:00
Andrew Chow ed94c8b556 Replace CombineSignatures with ProduceSignature
Instead of using CombineSignatures to create the final scriptSig or
scriptWitness of an input, use ProduceSignature itself.

To allow for ProduceSignature to place signatures, pubkeys, and scripts
that it does not know about, we pass down the SignatureData to SignStep
which pulls out the information that it needs from the SignatureData.
2018-07-03 17:19:23 -07:00
Andrew Chow 0422beb9bd Make SignatureData able to store signatures and scripts
In addition to having the scriptSig and scriptWitness, have SignatureData
also be able to store just the signatures (pubkeys mapped to sigs) and
scripts (script ids mapped to scripts).

Also have DataFromTransaction be able to extract signatures and scripts
from the scriptSig and scriptWitness of an input to put them in SignatureData.

Adds a new SignatureChecker which takes a SignatureData and puts pubkeys
and signatures into it when it successfully verifies a signature.

Adds a new field in SignatureData which stores whether the SignatureData
was complete. This allows us to also update the scriptSig and
scriptWitness to the final one when updating a SignatureData with another
one.
2018-07-03 17:18:52 -07:00
Karl-Johan Alm 189cf35f3e
Add simple bech32 benchmarks 2018-07-03 12:19:14 +09:00
wodry b330c3001c Docs: Improve doc of options addnode, connect, seednode 2018-07-02 20:15:17 +02:00
wodry 07c493f2d1 scripted-diff: Replace NET_TOR with NET_ONION
-BEGIN VERIFY SCRIPT-

sed --in-place'' --expression='s/NET_TOR/NET_ONION/g' $(git grep -I --files-with-matches 'NET_TOR')

-END VERIFY SCRIPT-

The --in-place'' hack is required for sed on macOS to edit files in-place without passing a backup extension.
2018-07-02 16:41:13 +02:00
Matteo Sumberaz 1336d9cb3b Delete double semicolon in wallet.cpp and misc.cpp 2018-07-02 10:10:27 +02:00
Chun Kuan Lee 49d1f4cdde Detect if char equals int8_t 2018-07-01 15:37:28 +00:00
MarcoFalke 686e97a0c7
Merge #13522: [tests] Fix p2p_sendheaders race
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
2018-06-30 22:09:11 -11:00
MarcoFalke 954f4a9c7c
Merge #13431: validation: count blocks correctly for check level < 3
f618ebc4e4 validation: count blocks correctly for check level < 3 (Karl-Johan Alm)

Pull request description:

  As noted in https://github.com/bitcoin/bitcoin/pull/13428#issuecomment-396129295 there is a bug where if check level < 3, the resulting count for blocks is wrong, because `pindexState` is never updated.

  Post-commit `./bitcoin-cli verifychain 1 3`:
  ```

  2018-06-11T07:12:28Z Verifying last 3 blocks at level 1
  2018-06-11T07:12:28Z [0%]...[33%]...[66%]...[99%]...[DONE].
  2018-06-11T07:12:28Z No coin database inconsistencies in last 3 blocks (0 transactions)
  ```

  Pre-commit `./bitcoin-cli verifychain 1 3`:
  ```
  2018-06-11T07:13:34Z Verifying last 3 blocks at level 1
  2018-06-11T07:13:34Z [0%]...[33%]...[66%]...[99%]...[DONE].
  2018-06-11T07:13:34Z No coin database inconsistencies in last 0 blocks (0 transactions)
  ```

Tree-SHA512: 3d82ed26665162c9615fb0e6e91a46ed4d229a5e6797c6c420e6b0bf1be6e5e02401c6e9a93b7a5aec503a2650d8c20d1b45fe300a922379e4cef8ee26e18d96
2018-06-30 22:07:32 -11:00
Jonas Schnelli 10ffca7429
Merge #13537: GUI: Peer table: Visualize inbound/outbound state for every row
4132ad3bf Show symbol for inbound/outbound in peer table (wodry)

Pull request description:

  Fixes #13483

  The address in the network peer table is prefixed with an up-arrow symbolizing an outbound connection, or an down-array symbolizing an inbound connection. See screenshot.

  The user has an easy visual confirmation about the connection direction state. I really like it :)
  Impact to columns sorting is grouping by inbound/outbound first, which in my opinion is an advantage, too.
  ![bildschirmfoto](https://user-images.githubusercontent.com/8447873/41862752-13803eb2-78a5-11e8-9126-a52385f5ec19.png)

Tree-SHA512: d355f679d34c3006743c06750be5f36a083c1a8376da8f5f35045fcd9df964153409946fdde5007734f23bd692c91355962dc42df31122cdcf88e4affce8bc0e
2018-07-01 10:27:43 +02:00
mruddy 2dcd7b4ec7 logging: avoid nStart may be used uninitialized in AppInitMain warning 2018-06-30 07:25:25 -04:00
Andrew Chow b6edb4f5e6 Inline Sign1 and SignN
Sign1 and SignN are kind of redundant so remove them and inline their
behavior into SignStep
2018-06-29 17:32:32 -07:00
John Newbery 702ae1e21a [RPC] [wallet] allow getbalance to use min_conf and watch_only without accounts. 2018-06-29 15:54:24 -04:00
John Newbery e3aab295e7 [tests] p2p_segwit: sync_blocks in subtest wrapper. 2018-06-29 15:35:07 -04:00
John Newbery 55e8050853 [tests] p2p_segwit: remove unnecessary arguments from subtests. 2018-06-29 15:35:07 -04:00
John Newbery 25711c2696 [tests] p2p_segwit: log and assert segwit status in subtest wrapper. 2018-06-29 15:35:07 -04:00
John Newbery 6839863d53 [tests] p2p_segwit: Make sure each subtest leaves utxos for the next. 2018-06-29 15:35:07 -04:00
John Newbery bfe32734de [tests] p2p_segwit: wrap subtests with subtest wrapper.
The subtest wrapper logs the name of the subtest.
2018-06-29 15:34:22 -04:00
John Newbery 2af4e398dc [tests] p2p_segwit: re-order function definitions.
This re-orders the defintions in p2p_segwit so subtests are
defined in the order that they're called.
2018-06-29 15:34:22 -04:00
John Newbery 94a0134a40 [tests] p2p_segwit: standardise comments/docstrings. 2018-06-29 15:32:52 -04:00
John Newbery f7c7f8ecf3 [tests] p2p_segwit: Fix flake8 warnings. 2018-06-29 15:32:52 -04:00
Wladimir J. van der Laan a6ed99a1e6
Merge #13517: qa: Remove need to handle the network thread in tests
fa87da2f17 qa: Avoid start/stop of the network thread mid-test (MarcoFalke)

Pull request description:

  This simplifies test writing by removing the need to handle the network thread in tests. E.g. start thread, join thread, restart thread mid-test, adding p2p connections at the "right" time, ...

Tree-SHA512: 533642f12fef5496f1933855edcdab1a7ed901d088d34911749cd0f9e044c8a6cb1f89985ac3a7f41a512943663e4e270a61978f6f072143ae050cd102d4eab8
2018-06-29 18:10:57 +02:00
Daniel Kraft caac39b0ac Make ZMQ notification interface instance global.
This moves the used instance of CZMQNotificationInterface from a static
variable in init.cpp to a globally-accessible one declared in
zmq/zmqnotificationinterface.h.  The variable is also renamed to
g_zmq_notification_interface, to be consistent with other globals.

We need this to implement a new RPC method "getzmqnotifications" (see
https://github.com/bitcoin/bitcoin/issues/13526) in a follow up.
2018-06-29 15:16:31 +02:00
MarcoFalke f3c9c40aeb
Merge #13545: tests: Fix test case streams_serializedata_xor. Remove Boost dependency.
962d8eed5b Remove boost dependency (boost/assign/std/vector.hpp) (practicalswift)
c6fd0df4ef Fix incorrect tests (practicalswift)

Pull request description:

  * Fix test case `streams_serializedata_xor`.
  * Remove Boost dependency.

Tree-SHA512: 609c4ced1b6a8b86f6a37e4220535f1b3c9f2e80949cd034ecc069a94c55c05cd514f2e132fe7f715161ee29811a0fadb6903635c507411d8dc3e7efe864edeb
2018-06-30 00:29:59 +14:00
Wladimir J. van der Laan 90990d2741
Merge #13544: depends: Update Qt download url
2fca6568f2 depends: Update Qt download url (fanquake)

Pull request description:

  Qt has moved the 5.7.1 downloads from the [official_releases](https://download.qt.io/official_releases/qt/) directory to it's [archive](https://download.qt.io/archive/qt/).

  ```
  Fetching qtbase-opensource-src-5.7.1.tar.gz from http://download.qt.io/official_releases/qt/5.7/5.7.1/submodules
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
    0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0
  curl: (22) The requested URL returned error: 404 Not Found
  ```

  This updates the qt download url in depends so we aren't always falling back on [bitcoincore.org/depends-sources](https://bitcoincore.org/depends-sources).

Tree-SHA512: 2aca3260fa0550322108b5bcc8c226e13b48c3500b7d95f545651e5b60d290edde16d9f6dea45f438c39a1388cb304cc16768a9728d32d3a441667968ea35425
2018-06-29 11:42:12 +02:00
John Newbery cf15761f6d [wallet] GetBalance can take a min_depth argument. 2018-06-28 17:56:59 -04:00
John Newbery 0f3d6e9ab7 [wallet] factor out GetAvailableWatchOnlyBalance() 2018-06-28 17:56:59 -04:00
John Newbery 7110c830f8 [wallet] deduplicate GetAvailableCredit logic 2018-06-28 17:56:57 -04:00
John Newbery ef7bc8893c [wallet] Factor out GetWatchOnlyBalance() 2018-06-28 17:50:40 -04:00
John Newbery 4279da4785 [wallet] GetBalance can take an isminefilter filter.
GetBalance() can now take an ismine filter, which is passed down to
GetAvailableCredit. This allows GetBalance to be used to get watch-only
balances.
2018-06-28 17:50:36 -04:00
MarcoFalke b330f3fdd5
Merge #13563: bench: Simplify CoinSelection
c2e4fc84ec bench: Simplify CoinSelection (João Barbosa)

Pull request description:

  Closes #13549.

  As pointed by @MarcoFalke:
   - `SelectCoinsMinConf` should always succeed as there are enough coins in the wallet.
   - Removed creating the coins in the wallet.

Tree-SHA512: 965c363bcaf0ca7a1dec35b5cf4866abcf190c53eb7012dc4aeb4d29830f13a7465644bfb5a47f6ea3eaa86e4d4a57fe41e7b2593bf5094b76a551c4c71625bb
2018-06-29 10:08:54 +14:00
Ben Woosley f95989b3ed
Fix AreInputsStandard test to reference the proper scriptPubKey
This value doesn't affect the outcome of the test, because the values are
properly set on line 351, but this makes the test values internally coherent.
2018-06-28 14:41:23 -04:00
John Newbery ea65182f03 [wallet] loadwallet shouldn't create new wallets.
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).
2018-06-28 13:37:44 -04:00
João Barbosa c2e4fc84ec bench: Simplify CoinSelection 2018-06-28 14:28:42 +01:00
MarcoFalke c93c360eec
Merge #13551: tests: Fix incorrect documentation for test case cuckoocache_hit_rate_ok
ea49e06c82 tests: Fix incorrect documentation for test case cuckoocache_hit_rate_ok (practicalswift)

Pull request description:

  Fix incorrect documentation for test case `cuckoocache_hit_rate_ok`.

Tree-SHA512: 2c1138953f077666c0bba784d9f5e5a627403dcd8b81851ca74793f1bf7bb5dc274af7887d51edb6669de1e9354ca7e5dfba80a3ce62f16eaaee6c6fa57b79f5
2018-06-29 02:09:23 +14:00
MarcoFalke 2328039bfc
Merge #13535: [qa] wallet_basic: Specify minimum required amount for listunspent
fa103a5d5e [qa] wallet_basic: Specify minimum required amount for listunspent (MarcoFalke)

Pull request description:

  A value less than that would fail the tests later on anyway:

  ```
  File "./test/functional/wallet_basic.py", line 250, in run_test
      self.nodes[1].sendrawtransaction(signed_raw_tx['hex'])

  test_framework.authproxy.JSONRPCException: bad-txns-in-belowout, value in (1.00) < value out (49.998) (code 16) (-26)

Tree-SHA512: 7e72ad02b5623bc078610da06c34721836822a920a4e85b12a1e0f339e3205cdc11d39763197770e649fb73376f922ff91a8f244b465195e50a6798658e04f80
2018-06-29 02:05:30 +14:00