Commit graph

15838 commits

Author SHA1 Message Date
Jonas Schnelli
d889c036cd
Merge #11403: SegWit wallet support
b224a47a1 Add address_types test (Pieter Wuille)
7ee54fd7c Support downgrading after recovered keypool witness keys (Pieter Wuille)
940a21932 SegWit wallet support (Pieter Wuille)
f37c64e47 Implicitly know about P2WPKH redeemscripts (Pieter Wuille)
57273f2b3 [test] Serialize CTransaction with witness by default (Pieter Wuille)
cf2c0b6f5 Support P2WPKH and P2SH-P2WPKH in dumpprivkey (Pieter Wuille)
37c03d3e0 Support P2WPKH addresses in create/addmultisig (Pieter Wuille)
3eaa003c8 Extend validateaddress information for P2SH-embedded witness (Pieter Wuille)
30a27dc5b Expose method to find key for a single-key destination (Pieter Wuille)
985c79552 Improve witness destination types and use them more (Pieter Wuille)
cbe197470 [refactor] GetAccount{PubKey,Address} -> GetAccountDestination (Pieter Wuille)
0c8ea6380 Abstract out IsSolvable from Witnessifier (Pieter Wuille)

Pull request description:

  This implements a minimum viable implementation of SegWit wallet support, based on top of #11389, and includes part of the functionality from #11089.

  Two new configuration options are added:
  * `-addresstype`, with options `legacy`, `p2sh`, and `bech32`. It controls what kind of addresses are produced by `getnewaddress`, `getaccountaddress`, and `createmultisigaddress`.
  * `-changetype`, with the same options, and by default equal to `-addresstype`, that controls what kind of change is used.

  All wallet private and public keys can be used for any type of address. Support for address types dependent on different derivation paths will need a major overhaul of how our internal detection of outputs work. I expect that that will happen for a next major version.

  The above also applies to imported keys, as having a distinction there but not for normal operations is a disaster for testing, and probably for comprehension of users. This has some ugly effects, like needing to associate the provided label to `importprivkey` with each style address for the corresponding key.

  To deal with witness outputs requiring a corresponding redeemscript in wallet, three approaches are used:
  * All SegWit addresses created through `getnewaddress` or multisig RPCs explicitly get their redeemscripts added to the wallet file. This means that downgrading after creating a witness address will work, as long as the wallet file is up to date.
  * All SegWit keys in the wallet get an _implicit_ redeemscript added, without it being written to the file. This means recovery of an old backup will work, as long as you use new software.
  * All keypool keys that are seen used in transactions explicitly get their redeemscripts added to the wallet files. This means that downgrading after recovering from a backup that includes a witness address will work.

  These approaches correspond to solutions 3a, 1a, and 5a respectively from https://gist.github.com/sipa/125cfa1615946d0c3f3eec2ad7f250a2. As argued there, there is no full solution for dealing with the case where you both downgrade and restore a backup, so that's also not implemented.

  `dumpwallet`, `importwallet`, `importmulti`, `signmessage` and `verifymessage` don't work with SegWit addresses yet. They're remaining TODOs, for this PR or a follow-up. Because of that, several tests unexpectedly run with `-addresstype=legacy` for now.

Tree-SHA512: d425dbe517c0422061ab8dacdc3a6ae47da071450932ed992c79559d922dff7b2574a31a8c94feccd3761c1dffb6422c50055e6dca8e3cf94a169bc95e39e959
2018-01-10 20:55:41 -10:00
Jonas Schnelli
b0d626d10f
Merge #12143: [Doc] Fix link for BIP-159 pull request
91769d6e2 [Doc] Fix link for bip 159 pull request (azuchi)

Pull request description:

  The link of the pull request for BIP-159 described in bips.md was a different link.

Tree-SHA512: 818ea29259ff84a55282df8b0c59fc4ccd3af08d124a104005ac48e67da4155a8b071b980b1d12c35af3f4a008ba77e5b4ee3242292f6c034cb0006b5532ce69
2018-01-10 20:31:15 -10:00
azuchi
91769d6e28 [Doc] Fix link for bip 159 pull request 2018-01-11 11:39:10 +09:00
Pieter Wuille
b224a47a1a Add address_types test
Improvements and cleanups by John Newbery
2018-01-09 15:35:31 -08:00
Pieter Wuille
7ee54fd7c7 Support downgrading after recovered keypool witness keys 2018-01-09 15:35:31 -08:00
Pieter Wuille
940a21932b SegWit wallet support
This introduces two command line flags (-addresstype and -changetype) which control
the type of addresses/outputs created by the GUI and RPCs. Certain RPCs allow
overriding these (`getnewaddress` and `getrawchangeaddress`). Supported types
are "legacy" (P2PKH and P2SH-multisig), "p2sh-segwit" (P2SH-P2WPKH and P2SH-P2WSH-multisig),
and "bech32" (P2WPKH and P2WSH-multisig).

A few utility functions are added to the wallet to construct different address type
and to add the necessary entries to the wallet file to be compatible with earlier
versions (see `CWallet::LearnRelatedScripts`, `GetDestinationForKey`,
`GetAllDestinationsForKey`, `CWallet::AddAndGetDestinationForScript`).
2018-01-09 15:35:31 -08:00
Pieter Wuille
f37c64e477 Implicitly know about P2WPKH redeemscripts
Make CKeyStore automatically known about the redeemscripts necessary for P2SH-P2WPKH
(and due to the extra checks in IsMine, also P2WPKH) spending.
2018-01-09 15:35:27 -08:00
Pieter Wuille
57273f2b30 [test] Serialize CTransaction with witness by default 2018-01-09 15:27:55 -08:00
Pieter Wuille
cf2c0b6f5c Support P2WPKH and P2SH-P2WPKH in dumpprivkey 2018-01-09 15:27:55 -08:00
Pieter Wuille
37c03d3e05 Support P2WPKH addresses in create/addmultisig 2018-01-09 15:27:51 -08:00
MarcoFalke
45173fa6fc
Merge #12079: Improve prioritisetransaction test coverage
7f67dd0aa6 [qa] Improve prioritisetransaction functional test (João Barbosa)

Pull request description:

Tree-SHA512: 7a5c446772069cd9ace085ae2635e1f61870c597e2216614628f4b6ebfe209b29f381a182a6f60d09f43f22bb82b59bb573b5441fa8e7b958a5fd0d5aad80d86
2018-01-06 03:28:23 -09:00
Pieter Wuille
b3ecb7bab6
Merge #10677: RPC Docs: addmultisigaddress is intended for non-watchonly addresses
73041c3c99 RPC Docs: addmultisigaddress is intended for non-watchonly addresses (Gregory Sanders)

Pull request description:

  Spent a couple hours debugging why my p2sh watchonly funds were not appearing in various accounting calls when address was imported via `addmultisigaddress`.

Tree-SHA512: 0673e276e5ca8cdc4c9357bd835a29bd5a994520a78179600944932c700917142930288bf179f5e89b0874beaf1a88bd70129f3a297a46df42a10bab847017bb
2018-01-06 02:54:33 -08:00
MarcoFalke
fd4ca17360
Merge #12092: [qt] Replaces numbered place marker %2 with %1.
8a93543419 Replaces numbered place marker %2 with %1. (251)

Pull request description:

  This PR closes #12015 in which @chen610620 suggests to replace numbered place marker `%2` with `%1`.

  Calling member function`QString::arg()` on a `QString` object with one arbitrary numbered place marker within the range [1,99] works, because `QString::arg()` replaces the _lowest_ numbered place marker in the `QString` object it is called on.

  [QString::arg documentation:](http://doc.qt.io/qt-5/qstring.html#arg)
  > Returns a copy of this string with the lowest numbered place marker replaced by string a, i.e., %1, %2, ..., %99.

  I suspect that the `%2` marker is just an unfortunate typo or the remainder of a string that used to have multiple numbered place markers.

  This PR replaces the numbered place marker `%2` with `%1` to avoid any confusion in the future.

Tree-SHA512: 0bb40cf3b9824e1eeba0a184e72358b30d20e8261e12deb287155b7cc8317ad0b0787ef1d0671325eb8bccc9e51b3037d737015749338c31cf400930840e56b6
2018-01-05 12:38:22 -09:00
João Barbosa
7f67dd0aa6 [qa] Improve prioritisetransaction functional test 2018-01-05 15:34:43 +00:00
Jonas Schnelli
56910285fa
Merge #12093: Fix incorrect Markdown link
4aa64557b Fix incorrect Markdown link (practicalswift)

Pull request description:

  Fix incorrect Markdown link.

Tree-SHA512: c6c4e4ddf215fdffa49aa55aed590656356bb7e898b2843a7a6c669eff9f401fe4772a9298893e9fe7f7bc5ea25f7dd87f792241c09e4cd83e7609633556a5bb
2018-01-04 13:49:12 -10:00
practicalswift
4aa64557b5 Fix incorrect Markdown link 2018-01-04 23:55:13 +01:00
251
8a93543419 Replaces numbered place marker %2 with %1.
Replaces numbered place marker %2 with %1, because the QString::arg() member function is called once on the string used to create the QString object.
2018-01-04 20:57:22 +01:00
MarcoFalke
ddff3447f2
Merge #11997: [tests] util_tests.cpp: actually check ignored args
c99a3c32c8 [tests] util_tests.cpp: actually check ignored args (Anthony Towns)

Pull request description:

  An array with 7 elements was setup for checking argument parsing, but
  was passed to ParseParamaeters with argc=5, meaning the interpretation
  of the last two arguments was never actually checked.

Tree-SHA512: 7b81fde49742e524f1bb67e2ec084f5909ae36125f237f0210df4587c62e5a5a8f277f13543f0a85ad145c4bb80d62339a7d50d7ed41659df318c8198ea7f428
2018-01-04 05:08:13 -09:00
MarcoFalke
36a5a44048
Merge #12063: [Trivial] Update license year range to 2018
c9439e735a [Trivial] Update license year range to 2018 (Akira Takizawa)

Pull request description:

  The same as #9617.

  Happy new year! 😃

Tree-SHA512: 4b8fe343bf841da12157595bb51b59ac8e5cfa8ceb5910a499f26cff35c7ef8420dbf3ad8e5dd9f4225441e2fecff7fc6939f1a55f98ea51b57e420d326bda47
2018-01-04 03:13:13 -09:00
Wladimir J. van der Laan
a9a49e6e7e
Merge #12001: [RPC] Adding ::minRelayTxFee amount to getmempoolinfo and updating help
aad3090 [rpc] Adding ::minRelayTxFee amount to getmempoolinfo and updating mempoolminfee help description (Jeff Rade)

Pull request description:

  These are RPC document changes from #11475 which is now merged.  Took into consideration comments from #11475 and #6941 for this PR.

  Biggest change here is when calling `getmempoolinfo`, will now show the `minrelaytxfee` in the JSON reponse (see below):

  ```
  $ bitcoin-cli getmempoolinfo
  {
    "size": 50,
    "bytes": 13102,
    "usage": 70480,
    "maxmempool": 300000000,
    "mempoolminfee": 0.00001000,
    "minrelaytxfee": 0.00001000
  }
  ```

  Fixes #8953

Tree-SHA512: 5ca583961365ee1cfe6e0d19afb0b41d542e179efee3b3c5f3fcf7d3ebca9cc3eedfd1434a0da40c5eed84fba98b35646fda201e6e61c689b58bee9cbea44b9e
2018-01-04 09:22:53 +01:00
Jonas Schnelli
eeb6d5271d
Merge #12035: [qt] change µBTC to bits
ebcee1de2 bips: add bip176 (Bits Denomination) (William Casarin)
275b2eeed [qt] change µBTC to bits (William Casarin)

Pull request description:

  Now that we have bip176, change "µBTC" to the more colloquial "bits"

Tree-SHA512: eba5e5f89c392728a4f0a3bd81a9779a117b8d72a490390fd031d4e7cc56c2bfee0016aba7ef9535903e8cf2262ce46497283424e378906d0e3bf5b0d2d981c7
2018-01-03 22:16:13 -10:00
Jonas Schnelli
a1136f0cb4
Merge #12074: [qt] Optimizes boolean expression model && model->haveWatchOnly()
6dda059bd [qt] Simplifies boolean expression model && model->haveWatchOnly() (251)

Pull request description:

  This PR optimizes the boolean expression `model && model->haveWatchOnly()` to `model->haveWatchOnly()`.

  The boolean expression can be optimized because the method `TransactionView::exportClicked` already guards against a potential dereferenced null pointer by returning early if `model` is null.
  63a4dc1087/src/qt/transactionview.cpp (L351-L353)

Tree-SHA512: 8bdd0d05bf879745fa39d3ca7524471720ae08ceee9427d5a08776e7b56d18542ae87a6991cd6779e232305f504fdfc77223702b72ecbe231f5f5e98453456dd
2018-01-03 21:58:46 -10:00
MarcoFalke
c991b304de
Merge #12075: [scripts] Add missing univalue file to copyright_header.py
415f86c6ae [scripts] Add missing univalue file to copyright_header.py (fanquake)

Pull request description:

  This needs to be added so that PRs like #12062 don't modify the subtree.

Tree-SHA512: 3642bdb0c8271ae700857a79fa5800b0c26c4b3f126d4406f224293817fb74d498fa1fc581d576ae747fbbb6952d4369fc4ab823ab48fd0946c1e8ccbe93cee6
2018-01-03 06:03:03 -09:00
Anthony Towns
c99a3c32c8 [tests] util_tests.cpp: actually check ignored args
An array with 7 elements was setup for checking argument parsing, but
was passed to ParseParamaeters with argc=5, meaning the interpretation
of the last two arguments was never actually checked.
2018-01-04 00:02:52 +10:00
Pieter Wuille
3eaa003c88 Extend validateaddress information for P2SH-embedded witness
This adds new fields 'pubkeys' and 'embedded' to the RPC's output, and improves the
documentation for previously added 'witness_version' and 'witness_program' fields.
2018-01-03 05:43:06 -08:00
Pieter Wuille
30a27dc5b1 Expose method to find key for a single-key destination 2018-01-03 05:43:06 -08:00
Pieter Wuille
985c79552c Improve witness destination types and use them more 2018-01-03 05:43:06 -08:00
Pieter Wuille
cbe197470e [refactor] GetAccount{PubKey,Address} -> GetAccountDestination 2018-01-03 05:42:57 -08:00
Wladimir J. van der Laan
5961b23898
Merge #12062: Increment MIT Licence copyright header year on files modified in 2017
595a7ba Increment MIT Licence copyright header year on files modified in 2017 (Akira Takizawa)

Pull request description:

  Edited via:

  $ contrib/devtools/copyright_header.py update .

  ps) It is the same commit as #9450

Tree-SHA512: 274bfcd6cf2914315ed52f6db773a68800ce9d6bd225a3142654483f0bbc3fd865009e62f9d954f65765d038c626e55d2a64e37e16843809adc2f67abe659b6d
2018-01-03 14:33:28 +01:00
Pieter Wuille
0c8ea6380c Abstract out IsSolvable from Witnessifier 2018-01-03 05:32:00 -08:00
MarcoFalke
d38d1a3e75
Merge #11965: qa: Note on test order in test_runner
fadf60e381 qa: Note on test order in test_runner (MarcoFalke)

Pull request description:

  C.f. #11964

Tree-SHA512: 5f087965093722d9e7a3febddcc187e412bd0636a7ed2da60111668fe3bba6668110e25a38ddcccc0d0aae132611c56fa72f3f0c473fb3fb59e38be445edfcd5
2018-01-03 12:07:52 +02:00
Wladimir J. van der Laan
c04cb48df9
Merge #12077: [Docs] Correct sendmany curl example
0d663f8 Fixes issue #12067 `sendmany` curl example is wrong. (251)

Pull request description:

  The example curl command in the `sendmany` RPC help results in an error:
  ```
  {"result":null,"error":{"code":-1,"message":"JSON value is not an object as expected"},"id":"curltest"}
  ```
  because - as reported in #12067 - the second element in the `params` array should be a JSON object.

  This PR removes the escaped backslash and quote characters that serialize the JSON object to a string and make it a plain JSON object:

  ```
  curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendmany", "params": ["", {"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX":0.01,"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz":0.02}, 6, "testing"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
  ```

  which (when executed with valid addresses) yields the expected result:

  ```
  {"result":"c446213f06ee4489660ed5dc47d65daca27345d0b5fc5bd344ebca78b2d87356","error":null,"id":"curltest"}
  ```

Tree-SHA512: 9be055515175f633d21cbe2f6735e08709af306639b31e9f2bf83d9eb1cf4dbbf807951728649f3c091fde96dbf4ea732ee903dec9589f90ea1e046b832b90d0
2018-01-03 10:21:15 +01:00
251
0d663f8197 Fixes issue #12067 sendmany curl example is wrong.
This commit removes the escaped backslash and quote characters from the keys in the JSON object to make it a plain JSON object.
2018-01-02 20:53:30 +01:00
Akira Takizawa
595a7bab23 Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
fanquake
415f86c6ae
[scripts] Add missing univalue file to copyright_header.py 2018-01-02 10:20:50 +08:00
251
6dda059bde [qt] Simplifies boolean expression model && model->haveWatchOnly()
The boolean expression model && model->haveWatchOnly() can be simplified to model->haveWatchOnly(), because if (!model || !model->getOptionsModel()) { return; } guards against a potential dereferenced null pointer.
2018-01-02 01:06:23 +01:00
Akira Takizawa
c9439e735a [Trivial] Update license year range to 2018 2018-01-01 04:33:09 +09:00
William Casarin
ebcee1de26 bips: add bip176 (Bits Denomination)
For the implementation in #12035.
Note that this only applies to the QT GUI at this time.

Signed-off-by: William Casarin <jb55@jb55.com>
2017-12-30 10:45:50 -08:00
Wladimir J. van der Laan
63a4dc1087
Merge #12027: [Docs] Remove boost --c++ flag from osx build instructions
5ec3eae remove brew c++ flag (Pablo Fernandez)

Pull request description:

  the c++ is not needed since the listed brew formulas no longer have this option. It also raises a warning that may generate confusion.

Tree-SHA512: 37c0ebee2901947a21abfcd646ae0c7e73293568f37db9b130d1c521aa4222b0e82e21614e6ac60bb5347c34ef15bbd24eb8066ebf576ea3da9f365be9a4d062
2017-12-30 13:55:10 +01:00
Wladimir J. van der Laan
efae3663a7
Merge #11984: doc: Update OpenBSD build instructions for 6.2 (cont'd)
6915f93 doc: Update OpenBSD build instructions for 6.2 (Wladimir J. van der Laan)

Pull request description:

  (this continues #11442)
  There is no more need to install a new compiler. This simplifies instructions a lot.

  From discussion with @fanquake on IRC I first wanted to add a new section for 6.2, but that made the document a complex mess. I think it's good enough (and more maintainable too) to only support the most recent release.

  Includes #11976.

  I moved the "resource limits" section to the end as I didn't seem to need it with clang, but this may vary based on source changes and the phase of the moon so it's good to keep it as optional extra information.

Tree-SHA512: 15794afec6d682323d0aa13c7616d009acb7fce8b0ef5d2106261f2ebd86b7b2fe66040c04860d9bf2f0c1934fbdc2b594b8c09a98accfaac04f3daf9a6cadf3
2017-12-30 10:36:37 +01:00
MarcoFalke
a332a7d5a1
Merge #11291: Fix string concatenation to os.path.join and add exception case
a3ac7672ed Fix string concatenation to os.path.join and add exception case (dongsamb)

Pull request description:

  Solved some warnings for [Python PEP 8 convention](https://www.python.org/dev/peps/pep-0008/)

  - [Method Names and Instance Variables](https://www.python.org/dev/peps/pep-0008/#method-names-and-instance-variables)
  lowercase with words separated by underscores as necessary to improve readability.

      - `testDir` to `test_dir`
      - `inputData` to `input_data`
      - ...

  - [Blank Lines](https://www.python.org/dev/peps/pep-0008/#blank-lines)
  Surround top-level function and class definitions with two blank lines.

  - [Exception Names](https://www.python.org/dev/peps/pep-0008/#exception-names)

  and added verification logic about referenced before assignment for `output_type`

Tree-SHA512: 346d08799f03077a2b7257ccdca123b4945b89dbf0677dba452d96b81ce186ec7b5dcdb10b8bb59cfce657a7aedbb7df64921036cbd1bf4ad8bd313d40faa796
2017-12-30 00:19:38 -05:00
Jeff Rade
aad309065d [rpc] Adding ::minRelayTxFee amount to getmempoolinfo and updating mempoolminfee help description 2017-12-29 08:56:44 -06:00
Pieter Wuille
d9fdac130a
Merge #11824: Block ActivateBestChain to empty validationinterface queue
97d2b09c12 Add helper to wait for validation interface queue to catch up (Matt Corallo)
36137497f1 Block ActivateBestChain to empty validationinterface queue (Matt Corallo)
5a933cefcc Add an interface to get the queue depth out of CValidationInterface (Matt Corallo)
a99b76f269 Require no cs_main lock for ProcessNewBlock/ActivateBestChain (Matt Corallo)
a734896038 Avoid cs_main in net_processing ActivateBestChain calls (Matt Corallo)
66aa1d58a1 Refactor ProcessGetData in anticipation of avoiding cs_main for ABC (Matt Corallo)
818075adac Create new mutex for orphans, no cs_main in PLV::BlockConnected (Matt Corallo)

Pull request description:

  This should fix #11822.

  It ended up bigger than I hoped for, but its not too gnarly. Note that "
  Require no cs_main lock for ProcessNewBlock/ActivateBestChain" is mostly pure code-movement.

Tree-SHA512: 1127688545926f6099449dca6a4e6609eefc3abbd72f1c66e03d32bd8c7b31e82097d8307822cfd1dec0321703579cfdd82069cab6e17b1024e75eac694122cb
2017-12-29 01:51:23 -08:00
William Casarin
275b2eeed4 [qt] change µBTC to bits
* Now that we have bip176, change "µBTC" to the more colloquial "bits"

* We retain the `µBTC (bits)` description in dropdowns and status bars.
  The more concise "bits" is used when appended to numbers.

Signed-off-by: William Casarin <jb55@jb55.com>
2017-12-28 09:54:58 -08:00
Pablo Fernandez
5ec3eae393
remove brew c++ flag
the c++ is not needed since the listed brew formulas no longer have this option. It also raises a warning that may generate confusion.
2017-12-26 14:23:58 -03:00
Matt Corallo
97d2b09c12 Add helper to wait for validation interface queue to catch up 2017-12-26 11:56:00 -05:00
Matt Corallo
36137497f1 Block ActivateBestChain to empty validationinterface queue 2017-12-26 11:54:49 -05:00
Matt Corallo
5a933cefcc Add an interface to get the queue depth out of CValidationInterface 2017-12-26 11:54:49 -05:00
Matt Corallo
a99b76f269 Require no cs_main lock for ProcessNewBlock/ActivateBestChain
This requires the removal of some very liberal (incorrect) cs_mains
sprinkled in some tests. It adds some chainActive.Tip() races, but
the tests are all single-threaded anyway.
2017-12-26 11:54:43 -05:00
Matt Corallo
a734896038 Avoid cs_main in net_processing ActivateBestChain calls 2017-12-24 13:20:52 -05:00