Commit graph

18973 commits

Author SHA1 Message Date
João Barbosa 5796671e1d qt: Add GUIUtil::bringToFront 2018-11-05 11:21:50 +00:00
Wladimir J. van der Laan 13d98ea0d7
Merge #14647: build: Remove illegal spacing in darwin.mk
63c74d2d3a build: Remove illegal spacing in darwin.mk (Jon Layton)

Pull request description:

  MacOS 10.13.6, `make -v` = `GNU Make 4.2.1  Built for x86_64-apple-darwin17.7.0`

  ```
  cd depends
  make HOST=x86_64-apple-darwin17.7.0
  ```
  Results in error:
  ```
  builders/darwin.mk:1: *** empty variable name.  Stop.
  ```

  This seems to fix it.

Tree-SHA512: 3481b9418571186c123942dc95b12bcaf47acbe2099ddd4524f5bb9dfe203175d7252bb7a1aa8ca5fec82578beeacfa06299472cb9d0d627c61f09486d74756c
2018-11-05 11:43:46 +01:00
Wladimir J. van der Laan bccb4d29a8
Merge #14555: Move util files to directory
2068f089c8 scripted-diff: Move util files to separate directory. (Jim Posen)

Pull request description:

  As discussed [here](https://github.com/bitcoin/bitcoin/pull/14074#issuecomment-429090584), this establishes a `util/` directory to introduce more organizational structure and have a clear place for new util files. It's really not scary to review, it's just one big scripted diff.

Tree-SHA512: 39cf15480d7d35e987b6088d52a857a2d5b1802e36c6b815eb42718d80cd95e669757af9bcc7c04426cd8523662cb1050b8da1e2377d3730672820ed298b894b
2018-11-05 11:34:29 +01:00
Jim Posen 2068f089c8 scripted-diff: Move util files to separate directory.
-BEGIN VERIFY SCRIPT-
mkdir -p src/util
git mv src/util.h src/util/system.h
git mv src/util.cpp src/util/system.cpp
git mv src/utilmemory.h src/util/memory.h
git mv src/utilmoneystr.h src/util/moneystr.h
git mv src/utilmoneystr.cpp src/util/moneystr.cpp
git mv src/utilstrencodings.h src/util/strencodings.h
git mv src/utilstrencodings.cpp src/util/strencodings.cpp
git mv src/utiltime.h src/util/time.h
git mv src/utiltime.cpp src/util/time.cpp

sed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')

sed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
sed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h
sed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
sed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
sed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h

sed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
sed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am
sed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
sed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
sed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am

sed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh
sed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh
sed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
sed -i 's/src\\utilstrencodings\.cpp/src\\util\\strencodings\.cpp/' build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj
-END VERIFY SCRIPT-
2018-11-04 22:46:07 -08:00
Lenny Maiorani 76e13b586f warnings: Compiler warning on memset usage for non-trivial type
Problem:
- IS_TRIVIALLY_CONSTRUCTIBLE macro does not work correctly resulting
  in `memset()` usage to set a non-trivial type to 0 when
  `nontrivial_t` is passed in from the tests.
- Warning reported by GCC when compiling with `--enable-werror`.

Solution:
- Use the standard algorithm `std::fill_n()` and let the compiler
  determine the optimal way of looping or using `memset()`.
2018-11-04 20:50:40 -07:00
MarcoFalke b74078868b
Merge #14410: rpcwallet: 'ischange' field for 'getaddressinfo' RPC
14a06525b2 tests: add test for 'getaddressinfo' RPC result 'ischange' field (whythat)
93d1aa9abc rpcwallet: add 'ischange' field to 'getaddressinfo' response (whythat)

Pull request description:

  Implementation of proposal in #14396.

  This introduces `CWallet::IsChange(CScript&)` method and replaces original `CWallet::IsChange(CTxOut&)` method with overloaded version that delegates to the new method with *txout*'s `scriptPubKey`. In this way `TODO` note from the original method can still be addressed in a single place.

Tree-SHA512: ef5dbc82d76b4b9b2fa6a70abc3385a677c55021f79e187ee2f392ee32bc6b406191f4129acae5c17b0206e72b6712e7e0cad574a4bbd966871c2e656c45e041
2018-11-04 17:23:11 -05:00
Hennadii Stepanov 6b1d2972bf
Remove obj_c for macOS Dock icon menu
Qt `setAsDockMenu()` does this work.
2018-11-04 02:42:18 +02:00
Hennadii Stepanov 2464925e7b
Use Qt signal for macOS Dock icon click event
This moves the Dock icon click reaction code to the common place and
allows some cleanup in obj_c code.

According to the Apple's docs `class_replaceMethod` behaves as
`class_addMethod`, if the method identified by name does not yet exist;
or as `method_setImplementation`, if it does exist.
2018-11-04 02:37:28 +02:00
Jon Layton 63c74d2d3a build: Remove illegal spacing in darwin.mk 2018-11-03 05:03:50 -05:00
MarcoFalke 742ee21349
Merge #14528: travis: Compile once on xenial
fa4bcaf82a travis: Compile once on xenial (MarcoFalke)

Pull request description:

  Currently we only build on bionic (since that is also the current gitian environment). However, building on the current and previous Ubuntu LTS should be supported with only system packages and without depends.

Tree-SHA512: bf5725cfb1be09220510d53010c7b7deb20051a9995e39fe5e83505c63db09ac877a41b896c97b253052fefea58ca0a9b6d9c5962a7ac4b258782c476d6ee7c0
2018-11-02 17:41:07 -04:00
MarcoFalke 750415701c
Merge #14630: test_runner: Remove travis specific code
fa43626611 test_runner: Remove travis specific code (MarcoFalke)

Pull request description:

  The tests are no longer run on travis, but in a docker, developer machines or a windows vm.

  The code was essentially dead for months now. Fix that by explicitly passing in `--ci` to the test runner on our docker and appveyor windows vm.

Tree-SHA512: 5d48693c03e8eb27536658ccf9ba738fe93a72abd4b72c80caac084b5b2cdffa77a1031a671eeefe70b71d63500f55917803d4be54d01849722afdccb700a9e6
2018-11-02 15:05:03 -04:00
MarcoFalke c34c821e4c
Merge #14631: [tests] Move deterministic address import to setup_nodes
3fd7e76f6d [tests] Move deterministic address import to setup_nodes (John Newbery)

Pull request description:

  This requires a small changes to a few tests, but means that
  deterministic addresses will always be imported (unless setup_nodes
  behaviour is explicitly overridden).

  Tidies up the way we import deterministic addresses, requested in review comment here: https://github.com/bitcoin/bitcoin/pull/14468#discussion_r225594586.

Tree-SHA512: 2b32edf500e286c463398487ab1153116a1dc90f64a53614716373311abdc83d8a251fdd8f42d1146b56e308664deaf62952113f66e98bc37f23968096d1a961
2018-11-02 11:41:39 -04:00
MarcoFalke fa43626611
test_runner: Remove travis specific code 2018-11-01 18:03:26 -04:00
Glenn Willen e13fea975d Add regression test for PSBT signing bug #14473 2018-11-01 12:14:21 -07:00
Glenn Willen 565500508a Refactor PSBTInput signing to enforce invariant
Refactor the process of PSBTInput signing to enforce the invariant that
a PSBTInput always has _either_ a witness_utxo or a non_witness_utxo,
never both.

This simplifies the logic of SignPSBTInput slightly, since it no longer
has to deal with the "both" case. When calling it, we now give it, in
order of preference: (1) whichever of the utxo fields was already
present in the PSBT we received, or (2) if neither, the
non_witness_utxo field, which is just a copy of the input transaction,
which we get from the wallet.

SignPSBTInput no longer has to remove one of the two fields; instead, it
will check if we have a witness signature, and if so, it will replace
the non_witness_utxo with the witness_utxo (which is smaller, as it is
just a copy of the output being spent.)

Add PSBTInput::IsSane checks in two more places, which checks for
both utxo fields being present; we will now give an RPC error early on
if we are supplied such a malformed PSBT to fill in.

Also add a check to FillPSBT, to avoid touching any input that is
already signed. (This is now redundant, since we should no longer
potentially harm an already-signed input, but it's harmless.)

fixes #14473
2018-11-01 12:14:21 -07:00
Glenn Willen 0f5bda2bd9 Simplify arguments to SignPSBTInput
Remove redundant arguments to SignPSBTInput -- since it needs several
bits of the PartiallySignedTransaction, pass in a reference instead of
doing it piecemeal. This saves us having to pass in both a PSBTInput and
its index, as well as having to pass in the CTransaction. Also avoid
redundantly passing the sighash_type, which is contained in the
PSBTInput already.
2018-11-01 12:11:24 -07:00
Glenn Willen 53e6fffb8f Add bool PSBTInputSigned
Refactor out a "PSBTInputSigned" function to check if a PSBT is signed,
for use in subsequent commits.

Also improve a related comment.
2018-11-01 12:11:24 -07:00
Glenn Willen 65166d4cf8 New PartiallySignedTransaction constructor from CTransction
New constructor that creates a PartiallySignedTransaction from a
CTransaction, automatically sizing the inputs and outputs vectors for
convenience.
2018-11-01 12:11:24 -07:00
Glenn Willen 4f3f5cb4b1 Remove redundant txConst parameter to FillPSBT 2018-11-01 12:11:24 -07:00
Glenn Willen fe5d22bc67 More concise conversion of CDataStream to string
Use .str() instead of .data() and .size() when converting CDataStream to
a string. Uses std::string, avoiding conversion to a C string.
2018-11-01 12:11:24 -07:00
James O'Beirne d20a9fa13d tests: add tests for invalid P2P messages
E.g., ensure that we can't DoS a node by sending it a bunch of large,
unrecognized messages.
2018-11-01 14:52:49 -04:00
James O'Beirne 62f94d39f8 tests: add P2PConnection.send_raw_message 2018-11-01 14:52:49 -04:00
James O'Beirne 5aa31f6ef2 tests: add utility to assert node memory usage hasn't increased
Adds a utility to get resident set size memory usage for a test
node and a context manager that allows assertions based upon
maximum memory use increase.
2018-11-01 14:52:46 -04:00
Russell Yanofsky 535203075e Avoid using numeric_limits for sequence numbers and lock times
Switches to named constants, because numeric_limits calls can be harder to read
and less portable.

Change was suggested by James O'Beirne <james.obeirne@gmail.com> in
https://github.com/bitcoin/bitcoin/pull/10973#discussion_r213473620

There are no changes in behavior except on some platforms we don't support
(ILP64, IP16L32, I16LP32), where SignalsOptInRBF() and MutateTxAddInput()
functions would now work correctly.
2018-11-01 12:55:39 -04:00
Wladimir J. van der Laan 51e5ef3971
Merge #14377: check that a separator is found for psbt inputs, outputs, and global map
4fb3388db9 check that a separator is found for psbt inputs, outputs, and global map (Andrew Chow)

Pull request description:

  Currently it doesn't make sure that a separator was found so PSBTs missing a trailing separator would still pass. This fixes that and adds a test case for it.

  It really only makes sense to check for the separator for the output maps as if an input or global map was missing a separator, the fields following it would be interpreted as belonging to the previous input or global map. However I have added the check for those two anyways to be consistent.

Tree-SHA512: 50c0c08e201ba02494b369a4d36ddb73e6634eb5a4e4e201c4ef38fd2dbeea2c642b8a04d50c91615da61ecbfade37309e47431368f4b1064539c42015766b50
2018-11-01 17:55:39 +01:00
Hennadii Stepanov bafb921507 Remove duplicated code
The deleted LOC is a dup so far as
`std::numeric_limits<unsigned int>::min()` == 0
2018-11-01 19:55:39 +03:00
Hennadii Stepanov e4dc39b3bc Replace platform dependent type with proper const 2018-11-01 19:55:39 +03:00
John Newbery 3fd7e76f6d [tests] Move deterministic address import to setup_nodes
This requires a small changes to a few tests, but means that
deterministic addresses will always be imported (unless setup_nodes
behaviour is explicitly overridden).
2018-11-01 12:53:49 -04:00
fridokus 086fc83571 Tests: Fix a comment 2018-11-01 17:26:42 +01:00
Andrew Chow 75a4bf699f Update release-process.md to include RC version bumping 2018-11-01 11:32:18 -04:00
Wladimir J. van der Laan 5049f7f7a9
Merge #14625: Make clear function argument case in dev notes
9605bbd315 Make clear function argument case in dev notes (Carl Dong)

Pull request description:

  Rationale:

  For new developers, they might be confused if they see that function arguments are sometimes `camelCase`'d in the codebase. This makes it clear that they _should_ be `snake_case`'d (maybe because no one's gotten to fixing them yet).

Tree-SHA512: 9db16d1fedf9761121844a0865ae3fefea94b5dbdfb36cb18f99cbc73e117f7d798a019f28a1c8bca19772502de2f9ed063f03bd911ffc4d248ec7386cd87d97
2018-11-01 16:31:08 +01:00
Alexey Ivanov 1e0f3c4499
macOS: disable AppNap during sync
Signed-off-by: Alexey Ivanov <alexey.ivanes@gmail.com>
2018-11-01 18:22:06 +03:00
Wladimir J. van der Laan f69d92299d
Merge #14592: doc: Add external interface consistency guarantees
fa77aaa5ad doc: Add external interface consistency guarantees (MarcoFalke)

Pull request description:

  An attempt to clarify our consistency guarantees for developers and users

Tree-SHA512: 8bad6a2bcfd85f0aeeecf3b090332f64c778c69a838a519d11ea83f2cb51929b9f43a7e9b2469567f305a1277206cafe8e65041f1a002dadbe69259d6a0adc18
2018-11-01 16:17:24 +01:00
Wladimir J. van der Laan f6df989842
Merge #14197: [psbt] Convert non-witness UTXOs to witness if witness sig created
862d159d63 Add test for conversion from non-witness to witness UTXO (Pieter Wuille)
f8c1714634 Convert non-witness UTXOs to witness if witness sig created (Andrew Chow)

Pull request description:

  If a witness signature was created when a non-witness UTXO is used, convert the non-witness UTXO to a witness one.

  Port of #14196 to master.

Tree-SHA512: 2235eeb008ffa48e821628032d689e4a83bff6c29b93fa050ab2ee492b0e67b3a30f29a680d4a0e574e05c3a2f9edf0005e161fbe25b7aef2acd034a2424e2f2
2018-11-01 16:09:38 +01:00
Wladimir J. van der Laan 9899e65d84
Merge #14617: FreeBSD: Document Python 3 requirement for 'gmake check'
0a04667613 FreeBSD: Document Python 3 requirement for 'gmake check' (Murray Nesbitt)

Pull request description:

  `doc/build-freebsd.md` doesn't mention that Python 3 is required to run the test suite. Currently, `gmake check` fails without it.

Tree-SHA512: 19117671bf528d335146d821e5cd4108f2f6ae014fb9a6d0030a322b23d1bc5f677e46896b575a7ca78b137315b60e63ad8b03ad695fe0aae3e9f50b060a3561
2018-11-01 16:04:52 +01:00
MarcoFalke 6a095bc5f2
Merge #14569: tests: Print dots by default in functional tests
4bd125fff0 tests: Print dots by default (Chun Kuan Lee)

Pull request description:

  In cron job (https://travis-ci.org/bitcoin/bitcoin/builds/445823485), the functional tests would fail due to silent for 10 mins.

  After applying this patch, we con't see any extra characters printed on screen but also avoid timeout (https://travis-ci.org/ken2812221/bitcoin/builds/445981698)

Tree-SHA512: c0412e171a451b27f9734311c7f063ad3fd7142087ed1e3786b4f303acaebc043f970523d6c2d4ef57ec5857040e2b6f7fd6345304353e7805d76044d317344d
2018-11-01 10:42:19 -04:00
Wladimir J. van der Laan 08a57d51e9
Merge #14593: gui: explicitly disable "Dark Mode" appearance on macOS
cf2f4306fe gui: explicitly disable "Dark Mode" appearance on macOS (fanquake)

Pull request description:

  Bitcoin Core's gui is pretty broken for a someone using macOS in "Dark Mode"; the biggest issue being lots of white text on a white background, leaving most inputs, the rpc console etc unusable.

  This is likely something we'll have to wait for Qt to fix/support, so it's probably easiest to just disable for now, rather than provide a broken UI; see screenshots below. This issue might not have come up much yet, given the issues with the 0.17.0 dmg.

  Apple documentation on "Opting out of Dark Mode" is [here](https://developer.apple.com/documentation/appkit/nsappearancecustomization/choosing_a_specific_appearance_for_your_app).
  > If you need extra time to work on your app's Dark Mode support, you can temporarily opt out by including the NSRequiresAquaSystemAppearance key (with a value of true) in your app’s Info.plist file. Setting this key to true causes the system to ignore the user's preference and always apply a light appearance to your app.

  Related upstream tickets:
  * [Qt Applications are not usable under macOS Mojave with dark theme](https://bugreports.qt.io/browse/QTBUG-68850)
  * [macOS 10.14 Mojave Support](https://bugreports.qt.io/browse/QTBUG-68891)

  Screenshots:
  ![main](https://user-images.githubusercontent.com/863730/47616668-f8769400-dafa-11e8-9ec5-9f184d8210f8.png)
  ![pay to](https://user-images.githubusercontent.com/863730/47616670-fad8ee00-dafa-11e8-876f-c656de0e31c4.png)
  ![qr code - not hilighted](https://user-images.githubusercontent.com/863730/47616671-fdd3de80-dafa-11e8-873f-f7fa3e91c2a0.png)
  ![qr code](https://user-images.githubusercontent.com/863730/47616672-00363880-dafb-11e8-883c-59a084b18120.png)

Tree-SHA512: 01f6f6b1fed0f20937b433adef38ff55ccacce8b4405dd6be67356ee9a470a56b8e511cc79909a39c3091a852f444284e49a8773cf6c037a29669804185ca92d
2018-11-01 14:28:16 +01:00
Wladimir J. van der Laan d38a5092f1
Merge #14600: docs: Clarify commit message guidelines
0e6de3aacb added details about commit messages (Martin Erlandsson)

Pull request description:

  In this small PR, the gist of [this helpful and informative comment from @fanquake](https://github.com/bitcoin/bitcoin/pull/14583#issuecomment-433668211) is added to the official contributing instructions, to help future first-time contributors get their commit messages right.

Tree-SHA512: ca6e9b639e007944314690ef771470f346d6f0ad8aa398abf86e45258bc617334fdbd2ca10ff930d62669a5eca5b507a3ebae11f75971f80f8a44b0bb17ab054
2018-11-01 14:24:56 +01:00
Carl Dong 9605bbd315
Make clear function argument case in dev notes 2018-10-31 17:21:41 -07:00
Hennadii Stepanov 53bb6be3f8
Remove obj_c for macOS Dock icon setting
Qt `setWindowIcon()` does this work.
2018-10-31 20:29:08 +02:00
Wladimir J. van der Laan b312579c69
Merge #14454: Add SegWit support to importmulti
c11875c590 Add segwit address tests for importmulti (MeshCollider)
201451b1ca Make getaddressinfo return solvability (MeshCollider)
1753d217ea Add release notes for importmulti segwit change (MeshCollider)
353c064596 Fix typo in test_framework/blocktools (MeshCollider)
f6ed748cf0 Add SegWit support to importmulti with some ProcessImport cleanup (MeshCollider)

Pull request description:

  Add support for segwit to importmulti, supports P2WSH, P2WPKH, P2SH-P2WPKH, P2SH-P2WSH. Adds a new `witnessscript` parameter which must be used for the witness scripts in the relevant situations.

  Also includes some tests for the various import types.

  ~Also makes the change in #14019 redundant, but cherry-picks the test from that PR to test the behavior (@achow101).~

  Fixes #12253, also addresses the second point in #12703, and fixes #14407

Tree-SHA512: 775a755c524d1c387a99acddd772f677d2073876b72403dcfb92c59f9b405ae13ceedcf4dbd2ee1d7a8db91c494f67ca137161032ee3a2071282eeb411be090a
2018-10-31 17:44:31 +01:00
Murray Nesbitt 0a04667613 FreeBSD: Document Python 3 requirement for 'gmake check' 2018-10-31 02:52:50 -07:00
MarcoFalke fa77aaa5ad
doc: Add external interface consistency guarantees 2018-10-30 16:40:36 -04:00
Andrew Chow 04b0bc7425 build: include rc number in version number 2018-10-30 15:02:26 -04:00
Andrew Chow 895e6bbb22 build: if VERSION_BUILD is non-zero, include it in the package version
When the build number (CLIENT_VERSION_BUILD) is non-zero, we want
to include that in the package version number so the resulting binaries
are named with the correct version.
2018-10-30 14:51:33 -04:00
Harry Moreno 053b6f42d2
align items in contrib init 2018-10-30 14:27:37 -04:00
Hennadii Stepanov a16f44c040
qt: Remove "Pay only required fee" checkbox
The custom fee input box now has a minimum value equal to the minimum
required fee. Before a value below the minimum fee could be entered
which was confusing since the minimum fee would still be paid even
though a lower amount was entered.
2018-10-30 16:31:57 +02:00
Chun Kuan Lee 4bd125fff0 tests: Print dots by default 2018-10-30 21:19:43 +08:00
Hennadii Stepanov 8711cc0c78
qt: Improve BitcoinAmountField class
This adds functions for specifing a min/max value for a
BitcoinAmountField. These options only affect user input, so it's still
possible to use setValue to set values outside of the min/max range. The
existing value will not be changed when calling these functions even if
it's out of range. The min/max range will be reinforced when the field
loses focus.
This also adds `SetAllowEmpty` function which specifies if the field is
allowed to be left empty by the user. If set to false the field will be
set to the minimum allowed value if it's empty when focus is lost.
2018-10-30 14:58:25 +02:00
Martin Erlandsson 0e6de3aacb added details about commit messages 2018-10-30 07:59:10 +01:00