Commit graph

20029 commits

Author SHA1 Message Date
Wladimir J. van der Laan 6d58a5c3b0
Merge #14685: fix a deserialization overflow edge case
b08af10fb2 disallow oversized CBlockHeaderAndShortTxIDs (Kaz Wesley)
6bed4b374d fix a deserialization overflow edge case (Kaz Wesley)
051faf7e9d add a test demonstrating an overflow in a deserialization edge case (Kaz Wesley)

Pull request description:

  A specially-constructed BlockTransactionsRequest can cause `offset` to wrap in deserialization. In the current code, there is not any way this could be dangerous; but disallowing it reduces the potential for future surprises.

Tree-SHA512: 1aaf7636e0801a905ed8807d0d1762132ac8b4421a600c35fb6d5e5033c6bfb587d8668cd9f48c7a08a2ae793a677b7649661e3ae248ab4f8499ab7b6ede483c
2018-11-18 10:15:18 +01:00
Carl Dong 6be7d14d24 Properly generate salt in rpcauth.py, update tests
Previously, when iterating over bytes of the generated salt to construct
a hex string, only one character would be outputted when the byte is
less than 0x10. Meaning that for a 16 byte salt, the hex string might be
less than 32 characters and collisions would occur.
2018-11-17 01:26:49 -08:00
Kristaps Kaupe 2474de0265 Fix running individually through test_runner.py, as suggested by @MarcoFalke (#14732) 2018-11-16 22:26:07 +02:00
MarcoFalke 35739976c1
Merge #14731: doc: Improve scripted-diff developer docs
07e286d940 Improve scripted-diff developer docs (Carl Dong)

Pull request description:

  Instead of verifying all scripted-diffs, provide an example that only verifies all scripted-diffs in commits since `origin/master`.

Tree-SHA512: 2faecfd1df04046c77ca2b7426675265f7ed656b2b7e2714ae61c0a38b3ea239f35d2be6d615c5191a21f3a453e37f6a4622bd4558173b768cb73183b56c4d62
2018-11-16 11:21:28 -05:00
Murray Nesbitt c54e5a41c4 Remove unreferenced boost headers 2018-11-16 03:20:44 +00:00
Carl Dong 07e286d940 Improve scripted-diff developer docs
Instead of verifying all scripted-diffs, provide an example that only verifies all scripted-diffs in commits since `origin/master.
2018-11-15 15:45:48 -08:00
Kaz Wesley b7b36decaf fix uninitialized read when stringifying an addrLocal
Reachable from either place where SetIP is used when our best-guess
addrLocal for a peer is IPv4, but the peer tells us it's reaching us at
an IPv6 address.

In that case, SetIP turns an IPv4 address into an IPv6 address without
setting the scopeId, which is subsequently read in GetSockAddr during
CNetAddr::ToStringIP and passed to getnameinfo. Fix by ensuring every
constructor initializes the scopeId field with something.
2018-11-15 13:47:53 -08:00
Kaz Wesley 8ebbef0169 add test demonstrating addrLocal UB 2018-11-15 13:47:53 -08:00
MarcoFalke 384967f311
Merge #13815: util: Add [[nodiscard]] to all {Decode,Parse}[...](...) functions returning bool
9cc0230cfc Add NODISCARD to all {Decode,Parse}[...](...) functions returning bool. Sort includes. (practicalswift)
579497e77a tests: Explicitly ignore the return value of DecodeBase58(...) (practicalswift)
145fe95ec7 tests: Check return value of ParseParameters(...) (practicalswift)
7c5bc2a523 miner: Default to DEFAULT_BLOCK_MIN_TX_FEE if unable to parse -blockmintxfee (practicalswift)

Pull request description:

  Changes in this PR:
  * ~~Add linter to make sure the return value of `Parse[...](...)` is checked~~
  * Add `__attribute__((warn_unused_result))` to all `{Decode,Parse}[...](...)` functions returning `bool`
  * Fix violations

  Context:
  * #13712: `wallet: Fix non-determinism in ParseHDKeypath(...). Avoid using an uninitialized variable in path calculation.` would have been prevented by this

Tree-SHA512: 41a97899f2d5a26584235fa02b1ebfb4faacd81ea97e927022955a658fa7e15d07a1443b4b7635151a43259a1adf8f2f4de3c1c75d7b5f09f0d5496463a1dae6
2018-11-15 14:39:37 -05:00
MarcoFalke fa5e0452e8
rpc: Documentation fixups 2018-11-15 12:19:11 -05:00
Pieter Wuille 109699dd33 Add release notes 2018-11-14 14:21:42 -08:00
Pieter Wuille b65326b562 Add matching descriptors to scantxoutset output + tests 2018-11-14 14:21:42 -08:00
Pieter Wuille 16203d5df7 Add descriptors to listunspent and getaddressinfo + tests 2018-11-14 14:21:42 -08:00
MarcoFalke fa91e8eda5
Use RPCHelpMan for all RPCs 2018-11-14 15:33:15 -05:00
Ben Woosley 69ca48717c
Implement prevector::fill once
Now that the implementation is identical, we can use a default value to
distinguish them.
2018-11-14 12:19:28 -05:00
Ben Woosley 7bad78c2c8
Drop defunct IS_TRIVIALLY_CONSTRUCTIBLE handling from prevector.h
It's now only referenced from the bench, so leave it there. This allows us to
drop the associated includes as well.
2018-11-14 12:19:04 -05:00
MarcoFalke fa520e72f7
lint: Must use RPCHelpMan to generate the RPC docs 2018-11-14 12:11:06 -05:00
MarcoFalke e74649e951
Merge #14411: [wallet] Restore ability to list incoming transactions by label
da427dbd48 Rename ListTransactions filter variable (Russell Yanofsky)
65b740f92b [wallet] Restore ability to list incoming transactions by label (Russell Yanofsky)

Pull request description:

  This change partially reverts #13075 and #14023.

  Fixes #14382

Tree-SHA512: 8c4e56104b3a45784cdc06bae8e5facdfff04fe3545b63a35e0ec2e440a41b79d84833ca4c4e728d8af7ebb8a519303a9eda7bee4bbfb92bd50c58587a33eb30
2018-11-14 11:59:41 -05:00
MarcoFalke c7366d2399
Merge #14478: Show error to user when corrupt wallet unlock fails
b4f6e58ca5 Better error message for user when corrupt wallet unlock fails (MeshCollider)

Pull request description:

  Mentioned here: https://github.com/bitcoin/bitcoin/issues/14461#issuecomment-429183503

  Current behavior is to assert(false) and crash, only info is printed in the log. This shows the message to the user before abort() instead.

Tree-SHA512: 526f9ed9262257fca55caf7153ab913ed958b13b079d2f01db797485614d8c375815a1554276e8cf73d3838104b2691a9cf85c8d097973127ae8de9e111446bf
2018-11-14 11:27:01 -05:00
Wladimir J. van der Laan 2e8f9dc2bb
Merge #14704: doc: add detached release notes for #14060
86cddf0856 doc: add detached release notes for #14060 (mruddy)

Pull request description:

  Adding detached release notes for #14060 in order to assist with https://github.com/bitcoin/bitcoin/pull/14688.

Tree-SHA512: 170cd0b6ac27237f58875f301132e0695dee36eec5d90a0c1234c0fa9db125151e6cebd94e63e634ddc4ddcfb77d7a4a07434ffd3725cb0dfa13fc4ccfbde2a0
2018-11-14 13:44:02 +01:00
Wladimir J. van der Laan 99a3e6f0b1
Merge #14688: Doc: update release notes for changes since 0.17.0 branch
ba8f0c6c8d Release notes: integrate detached release notes (David A. Harding)
6062f0e613 Release notes: update notes through to 11e1ac3ae0 (David A. Harding)

Pull request description:

  This documents changes listed by `git log v0.17.0...11e1ac3 --merges` and integrates the existing detached release notes into the main file.

  My goal is to update the release notes each month in order to reduce the amount of writing and review that needs to be done all at once near the start of the RC cycle.

  Note: I've chosen to use fully-qualified URLs for linking to documentation, rather than shorter relative URLs that would otherwise be preferred, as the release notes are commonly copied into emails, reddit threads, and blog posts where relative URLs would be incomplete or would point to the wrong page.

Tree-SHA512: a943327d48e166f4a188ab0f468972609276e9c8f0ed85513823511ed989606445bf6b0ae9dd693b5d1e13d2f98c13573acd13865c57fe9c8ee9dbd04ceeff7f
2018-11-14 13:42:51 +01:00
Wladimir J. van der Laan 74213fa4d1
Merge #14725: qt: Bump the minimum Qt version to 5.2
2bc3f114d0 Bump the minimum Qt version to 5.2 (Hennadii Stepanov)

Pull request description:

  Refs:
  - #13478
  - https://github.com/bitcoin/bitcoin/issues/13478#issuecomment-438431556 by @MarcoFalke

Tree-SHA512: b598a80f25df9c440e0776b373b88a305250582049ab60caee48375f6599c2f6d40ed94b488ff3604ec9fc12c71f440f6881a3fc656c81f99e89dc5bf9ea2f6d
2018-11-14 13:13:28 +01:00
Wladimir J. van der Laan 33cd94279c
Merge #14698: build: Add bitcoin-tx.exe into Windows installer
5c5902acc5 build: Add bitcoin-tx.exe into Windows installer (Chun Kuan Lee)

Pull request description:

  I think bitcoin-tx.exe should be packed into the Windows installer.

Tree-SHA512: 346051d3680e74e773d5d8736b5d90604dc52689484cf14b2bc47e1fe3a010f9322f82993e2b1ba3533736bcb9bc8478d71f8c4d42eadf6605195fba619d71a2
2018-11-14 12:42:20 +01:00
Hennadii Stepanov 2bc3f114d0
Bump the minimum Qt version to 5.2 2018-11-14 01:32:51 +02:00
Russell Yanofsky da427dbd48 Rename ListTransactions filter variable
Suggested by MeshCollider <dobsonsa68@gmail.com> in
https://github.com/bitcoin/bitcoin/pull/14411#discussion_r232134086
2018-11-13 16:49:23 -05:00
MarcoFalke 8c59bb85f9
Merge #14720: rpc: Correctly name arguments
fa0815c300 rpc: Correctly name arguments (Jon Layton)

Pull request description:

  Consistently use the same name to describe arguments in the documentation and add a test that uses the name.

  By splitting it up, the changes are easier to potentially backport and also make review easier when we switch to `RPCHelpMan`.

  The tests should pass with or without the changes in `src`.

  Partly stolen from #14459 (More RPC help description fixes by ch4ot1c)

Tree-SHA512: 1072992b1e93ac41006613523e54a0a8004f529fcb101eb9d74d91474abb0945a5a7539f249905151b904b87448f9efc0cacbd9e052fbe2ea9111e62f3e7249c
2018-11-13 16:49:23 -05:00
Russell Yanofsky 65b740f92b [wallet] Restore ability to list incoming transactions by label
This change partially reverts #13075 and #14023.

Fixes #14382
2018-11-13 17:49:23 -04:00
Kaz Wesley b08af10fb2 disallow oversized CBlockHeaderAndShortTxIDs
Otherwise we'd reply with a bogus BlockTransactionsRequest trying to
request indexes with overflowed deltas.
2018-11-13 12:41:41 -08:00
Wladimir J. van der Laan f617e05c38
Merge #14679: importmulti: Don't add internal addresses to address book
7afddfa8ce importmulti: Don't add internal addresses to address book (Gregory Sanders)

Pull request description:

  Currently anything imported with `internal` will not be treated as change since checking the address book is a primary test of this.

  Added basic tests of all combinations of arguments and change identification.

  Resolves https://github.com/bitcoin/bitcoin/issues/14662

Tree-SHA512: a1f08dc624a3fadee93cc5392d50c4796b0c5eedf38e295382f71570f2066d9e978ed6e3962084b902989863fe1273a8642d8fdb094a266d69de10622a4176b0
2018-11-13 21:34:23 +01:00
Kaz Wesley 6bed4b374d fix a deserialization overflow edge case
A specially-constructed BlockTransactionsRequest can overflow in
deserialization in a way that is currently harmless.
2018-11-13 12:14:34 -08:00
Kaz Wesley 051faf7e9d add a test demonstrating an overflow in a deserialization edge case
Also add a test that the highest legal index is accepted.
2018-11-13 12:14:08 -08:00
Jon Layton fa0815c300
rpc: Correctly name arguments 2018-11-13 14:24:40 -05:00
Ben Woosley bd3b0361d8
Add stop_block out arg to ScanForWalletTransactions
Accurately reports the last block successfully scanned, replacing a return of
the chain tip, which represented possibly inaccurated data in a race condition.
2018-11-13 12:51:16 -05:00
MarcoFalke c651265c93
Merge #14530: Use RPCHelpMan to generate RPC doc strings
fa483e13b3 rpc: Add RPCHelpMan for machine-generated help (MarcoFalke)
fa0d36f712 rpc: Include rpc/util.h where needed for RPCHelpMan (MarcoFalke)

Pull request description:

  This introduces a manager for the RPC help generation and demonstrates its use of it in some RPCs.

  It is the first non-exhaustive step toward #14378 and I will create pull requests for the next steps after this one is merged.

Tree-SHA512: 86f68322443ff01cd964aaf0ebe186be63fbebe4c47676cf7a622cc2b5305fd176bd57badfd1bbf788a036812253eb0dead74ecc3b30664c3e0d9392b2248054
2018-11-13 12:34:50 -05:00
MarcoFalke e0c6bb7823
Merge #14705: travis: Avoid timeout on verify-commits check
fa5a6ce102 qa: Raise ci test_runner timeout to 40 mins (MarcoFalke)
fa3df025e1 travis: Avoid timeout on verify-commits check (MarcoFalke)

Pull request description:

  The verify-commits check is too expensive to run in full (calculate Tree-SHA512 and clean-merge for every single merge commit in history) every day (the cron job runs every ~24h). Since the cron job is running every day, it is also redundant to redo most of the work on the next day.

  So, only check two days worth of commits and assume that travis checked the Tree-SHA512 and clean-merge for all other commits already. The script will still check all the signatures, since the check-result for them depends on external inputs such as current time or the public keys we got from the server.

  [Note that travis is not meant to do the verification for anyone or is meant to be trusted in any way. This check only serves as a belt-and-suspender to notify maintainers in case of a technical issue or script malfunction. But since the script is timing out for months now, its purpose is diminished right now.]

Tree-SHA512: 336c5cbcc03cdf50be96cd61412471be9078d862da8ba2054f337441e062a6067c95fbbd03912e3de6a116f3caa75fd3f01a04864d34aae1489faa3154572815
2018-11-13 12:25:25 -05:00
MarcoFalke fa7da0617c
qa: Check specific reject reasons in feature_block 2018-11-13 11:05:24 -05:00
Gregory Sanders b81a186056 GetPubKey: make sigdata const 2018-11-13 10:42:10 -05:00
MarcoFalke 5d605b2745
Merge #14700: qa: Avoid race in p2p_invalid_block by waiting for the block request
fa21568208 qa: Avoid race in p2p_invalid_block by waiting for the block request (MarcoFalke)
6c787d340c tests: Make feature_block pass on centos (MarcoFalke)

Pull request description:

  This hopefully fixes #14661, which I believe is caused by a race in `send_blocks_and_test`. By setting `request_block=False` we only effectively check `node.getbestblockhash() != blocks[-1].hash` before returning and checking the debug.log. By setting `request_block=True` (the default) we make sure that we send the block, then sync with a ping before asserting on the debug.log.

  Even if this patch doesn't fix the issue, it is good cleanup: There is no reason to not wait for the blocks to be requested, since in all these cases the header gives no indication that the block is consensus invalid. So this patch makes the test also a bit stricter and more useful.

  Unrelated to this, I also include a fix that makes the tests pass on latest CentOS.

Tree-SHA512: c7abee3b7dc790a8af6c289159a7751bd962f6fa16c1537e7e21a0a0ef05b9596d1f4eb75319614603c05cb803e021314fa3596508ba443edd03046b25527e0f
2018-11-13 10:24:51 -05:00
Wladimir J. van der Laan c51e1516a9
Merge #14714: util.h: explicitly include required QString header
27154ce765 util.h: explicitly include required QString header (1Il1)

Pull request description:

  Alternative to #14713.

  Instead of depending on clang formatter to not reorder includes, another fix is to explicitly include the missing header file.

Tree-SHA512: f419ef2fd1dfd8da28160a94d187af78463fb398ef6aadd6c68ebf57e6d02380d93f5f370bf2d39e88dcbfeb252c3e5f245c0a157c7d0a64c38fc0f0c7004515
2018-11-13 14:52:03 +01:00
Wladimir J. van der Laan ce7fcc3569
Merge #14690: Throw error if CPubKey is invalid during PSBT keypath serialization
4e4de10f69 Throw error if CPubKey is invalid during PSBT keypath serialization (Gregory Sanders)

Pull request description:

  Related to https://github.com/bitcoin/bitcoin/pull/14689

  We should catch this error before attempting to deserialize it later.

Tree-SHA512: d2f3ea7f363818ac70c81ee988231b2bb50d055b6919f7bff3f27120c85a7048bfa183efae33e23e6b81d684bcb8bb81e5b209abb3acbcaff1d88014f4f1aa93
2018-11-13 13:44:09 +01:00
Jonas Schnelli 083f535470
Merge #14608: qt: Remove the "Pay only required fee..." checkbox
a16f44c04 qt: Remove "Pay only required fee" checkbox (Hennadii Stepanov)
8711cc0c7 qt: Improve BitcoinAmountField class (Hennadii Stepanov)

Pull request description:

  Ref #13280
  This PR removes the "Pay only the required fee..." checkbox from the custom transaction fee section in the "Send" tab. Instead, a minimum value will be enforced on the custom fee input box.

  All comments from #13280 are addressed.

  Before:
  ![screenshot from 2018-10-30 16-42-18](https://user-images.githubusercontent.com/32963518/47726622-866d8e80-dc63-11e8-8670-3f97ff0fa5da.png)

  After:
  ![screenshot from 2018-10-30 16-40-37](https://user-images.githubusercontent.com/32963518/47726633-8f5e6000-dc63-11e8-82cf-5b9ff4aae91d.png)

  cc: @promag @MarcoFalke @Sjors

Tree-SHA512: 073577d38d8353b10e8f36fb52e3c6e81dd45d25d84df9b9e4f78f452ff0bdbff3e225bdd6122b5a03839ffdcc2a2a08175f81c2541cf2d12918536abbfa3fd1
2018-11-13 15:44:11 +07:00
Jonas Schnelli b60f4e3f09
Merge #13381: RPC: creates possibility to preserve labels on importprivkey
a6b5ec18f rpc: creates possibility to preserve labels on importprivkey (marcoagner)

Pull request description:

  Closes #13087.

  As discussed in the issue, this is a feature request instead of a bug report since the behaviour was as intended (i.e. label with default: `''`). With this, the old behaviour is kept while the possibility to achieve the preservation of labels, as expected in the open issue, is added.

Tree-SHA512: b33be50e1e7f62f7ddfae953177ba0926e2d848961f9fac7501c2b513322c0cb95787745d07d137488267bad1104ecfdbe800c6747f94162eb07c976835c1386
2018-11-13 14:52:01 +07:00
1Il1 27154ce765
util.h: explicitly include required QString header 2018-11-13 16:49:34 +09:00
Ben Woosley 3002d6cf31
Return a status enum from ScanForWalletTransactions
Return the failed block as an out var.

This clarifies the outcome as the prior return value could
be null due to user abort or failure.
2018-11-13 00:04:13 -05:00
Ben Woosley bb24d68650
Make CWallet::ScanForWalletTransactions args and return value const 2018-11-13 00:01:14 -05:00
Ben Woosley 1a9f9f7e5e
Introduce SafeDbt to handle DB_DBT_MALLOC raii-style
This provides additional exception-safety and case handling for the proper
freeing of the associated buffers.
2018-11-12 18:43:52 -05:00
Gregory Sanders f7beb95a1f remove redundant KeyOriginInfo access, already done in CreateSig 2018-11-12 13:17:49 -05:00
Wladimir J. van der Laan 47ed24cf8a
Merge #14356: fix converttopsbt permitsigdata arg, add basic test
88a79cb436 fix converttopsbt permitsigdata arg, add basic test (Gregory Sanders)

Pull request description:

  The final check for extraneous sigdata has a flipped boolean, resulting in incorrect behavior.

  Resolves https://github.com/bitcoin/bitcoin/issues/14355

Tree-SHA512: 5157a74b8ddebd7d836fba96765c4d7ed15a73d4289817353d3566a0f6803bd4bbc3f936735c517c7a83a6cbdb4052b9c61d23f6cc4ad00a6077278cd51adbd4
2018-11-12 19:14:13 +01:00
Gregory Sanders 0fb2e69815 CreateTransaction: Assume minimum p2sh-p2wpkh spend size for unknown change 2018-11-12 13:12:09 -05:00
Gregory Sanders b06483c96a Remove stale comment in CalculateMaximumSignedInputSize 2018-11-12 13:10:54 -05:00