Commit graph

22443 commits

Author SHA1 Message Date
MarcoFalke 5d0b7f9e3d
Merge #17670: Move events_hasher into RNGState()
8bda0960f9 Move events_hasher into RNGState() (Pieter Wuille)

Pull request description:

  This moves `events_hasher` and `events_mutex` into `RNGState()` in random.cpp. This guarantees (through the existing `GetRNGState()` function) that the mutex is always created before any events are added, even when that happens inside global initializers.

  Fixes the issue reported here: https://github.com/bitcoin/bitcoin/pull/17573#issuecomment-561828251, and includes the annotation from #17666).

ACKs for top commit:
  MarcoFalke:
    re-ACK 8bda0960f9 🥈
  sipsorcery:
    re-ACK 8bda0960f9.

Tree-SHA512: 78702d668764df19e9d61d87d82eca71cceca87d5351b740e13e732a1c18a3d53d7fbaaf63245266da597370bfebec9fa6a4749c15ec5a78dcfe6122c33553ed
2019-12-05 15:55:27 -05:00
MarcoFalke 910a4301b1
Merge #17522: test: Wait until mempool is loaded in wallet_abandonconflict
dddd09eb33 test: Wait until mempool is loaded in wallet_abandonconflict (MarcoFalke)

Pull request description:

  This might or might not fix intermittent issues such as https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/28724018#L4091

  I believe the mempool was not loaded fully after the restart, in which case it was not dumped either on the next restart. Thus, the previous mempool was attempted to be loaded a second time, which succeeded and contained the txs.

ACKs for top commit:
  laanwj:
    ACK dddd09eb33

Tree-SHA512: ab7061f946b5e5388f825dddceadb125f5197b24af3a7fcf1e700235d106a323419a56bfb4d84a2e27442e0de63e540c623b704343d83a98deaab3c02fcbdcbe
2019-12-05 15:52:17 -05:00
Pieter Wuille 8bda0960f9 Move events_hasher into RNGState() 2019-12-05 09:49:11 -08:00
MarcoFalke 11113247c3
depends: Support for S390X targets 2019-12-05 12:12:46 -05:00
Luke Dashjr 989fd539d5 depends: Support for 64-bit POWER targets 2019-12-05 12:06:28 -05:00
Wladimir J. van der Laan 6fff333c9f
Merge #17507: random: mark RandAddPeriodic and SeedPeriodic as noexcept
55b2cb199c random: mark RandAddPeriodic and SeedPeriodic as noexcept (fanquake)
461e547877 doc: correct random.h docs after #17270 (fanquake)

Pull request description:

  The usage of `MilliSleep()` in SeedPeriodic (previously SeedSleep) was
  [removed](d61f2bb076) in #17270, meaning it, and its users can now be marked `noexcept`.

  This also corrects the docs in random.h for some of the changes in #17270.

ACKs for top commit:
  practicalswift:
    ACK 55b2cb199c
  laanwj:
    ACK 55b2cb199c
  sipa:
    ACK 55b2cb199c

Tree-SHA512: 672d369796e7c4f9b4d98dc545e5454999fa1bef373871994a26041d6163c58909e2255e4f820d3ef011679aa3392754eb57477306a89f5fd3d57e2bd7f0811a
2019-12-05 15:14:42 +01:00
fanquake 2359a4790d
depends: don't use OpenGL in Qt on macOS 2019-12-05 09:07:03 -05:00
fanquake ba0cad2702
build: pass -dead_strip_dylibs to ld on macOS
This strips some unused dylibs from bitcoin-qt.

From man ld:
Remove dylibs that are unreachable by the entry point or exported symbols. 
That is, suppresses the generation of load command commands for dylibs 
which supplied no symbols during the link. This option should not be 
used when linking against a dylib which is required at runtime for 
some indirect reason such as the dylib has an important initializer.
2019-12-05 08:41:15 -05:00
practicalswift 1f9d5af4f1 tests: Add initialization order fiasco detection in Travis 2019-12-05 10:54:18 +00:00
willyk b11d35b5e2 Fixed wget call in gitian-build.py 2019-12-05 02:21:09 -08:00
fanquake 5aee0e2163
Merge #17650: util: remove unwanted fields from bitcoin-cli -getinfo
01c8701559 util: remove unwanted fields from bitcoin-cli -getinfo (malevolent)

Pull request description:

  Removed the following fields from -getinfo: protocolversion, walletversion and keypoololdest. This change closes #17314 .

ACKs for top commit:
  laanwj:
    ACK 01c8701559
  achow101:
    ACK 01c8701559
  practicalswift:
    ACK 01c8701559 -- diff looks correct

Tree-SHA512: c98f2e8a3fee04d46766f70cb88f4e49e892a4424eff8940a7d48e9e808597b702427225788f984f5c3641591fd8d86acee56774afde1d57a4259c31d971ea08
2019-12-04 14:59:12 -05:00
MarcoFalke fee01bb053
Merge #17517: ci: Bump to clang-8 for asan build to avoid segfaults on ppc64le
fa40e48c50 ci: Remove unparseable lines from supp file for old xenial clang tsan (MarcoFalke)
fa1bfc476c ci: ubsan report_error_type=1 and add suppressions (MarcoFalke)
fa69cef13e test: Print stderr when subprocess fails (MarcoFalke)
2222c30586 test: Use char instead of unsigned char (MarcoFalke)
faa8023ce9 ci: Bump to clang-8 for asan build to avoid segfaults on ppc64le (MarcoFalke)

Pull request description:

  Use clang-8 instead of default clang (which is clang-6 on Bionic) to avoid spurious segfaults when running the ci system on ppc64le

ACKs for top commit:
  practicalswift:
    ACK fa40e48c50 assuming Travis is happy -- diff looks correct :)

Tree-SHA512: f4f26232d3a0ef38da245869340f723d279a3db9823befbc735fb5a00024dae041c7306d7ae55d2488e6f86aa96cdea155b007aefb561fba505141e8dbc717dc
2019-12-04 13:23:16 -05:00
MarcoFalke fa40e48c50
ci: Remove unparseable lines from supp file for old xenial clang tsan 2019-12-04 12:16:52 -05:00
MarcoFalke fa1bfc476c
ci: ubsan report_error_type=1 and add suppressions 2019-12-04 12:16:38 -05:00
MarcoFalke fa69cef13e
test: Print stderr when subprocess fails 2019-12-04 11:25:32 -05:00
MarcoFalke 2222c30586
test: Use char instead of unsigned char 2019-12-04 09:32:19 -05:00
MarcoFalke faa8023ce9
ci: Bump to clang-8 for asan build to avoid segfaults on ppc64le 2019-12-04 09:32:15 -05:00
Wladimir J. van der Laan 41919631d5
Merge #17573: Seed RNG with precision timestamps on receipt of net messages.
02d8c56a18 Seed RNG with precision timestamps on receipt of net messages. (Matt Corallo)

Pull request description:

  See title. Exposes a generic dead-simple "SeedEvent" interface, but currently just used for net messages.

ACKs for top commit:
  sipa:
    utACK 02d8c56a18
  laanwj:
    ACK 02d8c56a18
  meshcollider:
    utACK 02d8c56a18

Tree-SHA512: 28eb39a201ee2b13393c5c64dbf7c1913f3482f095969ef5141bfe549ce77dd63bb5f14738f6eedb296c686ea36014aa157b9c5e8059710a318590f30e9caa14
2019-12-04 13:12:44 +01:00
Wladimir J. van der Laan dcbe024f5e
Merge #17648: doc: rename wallet-tool references to bitcoin-wallet
e7ad4a2f8c doc: rename wallet-tool references to bitcoin-wallet (Wilson Ccasihue S)

Pull request description:

  Fix. text reference to executable bitcoin-wallet instead of wallet-tool, there is not a wallet-tool at bin/ folder.

ACKs for top commit:
  fanquake:
    ACK e7ad4a2f8c - thanks for following up.

Tree-SHA512: aed41b08947728a4ff3a97a62858ee7c86e2e5d57dcbbd0aab492dae3d8a548bb60541924e68cf3a0aa3d53d7db0012b489462b466919cd83f05b2aa88b7fff7
2019-12-04 11:00:40 +01:00
malevolent 01c8701559 util: remove unwanted fields from bitcoin-cli -getinfo
In accordance with #17314, Removing noisy fields from -getinfo. Fields removed: protocolversion, walletversion and keypoololdest. In addition to changing bitcoin-cli -getinfo, there is another change to test/functional/interface_bitcoin_cli.py. This change deletes tests that utilize removed -getinfo calls.
2019-12-04 06:48:53 +00:00
fanquake bd44711e1b build: pass -dead_strip_dylibs to ld on macOS
This strips some unused dylibs from bitcoin-qt.

From man ld:
Remove dylibs that are unreachable by the entry point or exported symbols. 
That is, suppresses the generation of load command commands for dylibs 
which supplied no symbols during the link. This option should not be 
used when linking against a dylib which is required at runtime for 
some indirect reason such as the dylib has an important initializer.
2019-12-03 17:50:30 -05:00
fanquake bce44089db
Merge #17547: build: Fix configure report about qr
651c636f9e build: Fix configure report about qr (Hennadii Stepanov)

Pull request description:

  On master (b7bc9b8330):
  ```
  $ apt list libqrencode-dev
  Listing... Done
  libqrencode-dev/bionic 3.4.4-1build1 amd64
  $ ./configure | grep -i qr
  checking for QR... no
  checking whether to build GUI with support for QR codes... no
      with qr     = auto
  ```

  With this PR:
  ```
  $ apt list libqrencode-dev
  Listing... Done
  libqrencode-dev/bionic 3.4.4-1build1 amd64
  $ ./configure | grep -i qr
  checking for QR... no
  checking whether to build GUI with support for QR codes... no
      with qr     = no
  ```

ACKs for top commit:
  laanwj:
    Concept and light code review ACK 651c636f9e
  fanquake:
    ACK 651c636f9e

Tree-SHA512: 8959b1c7da5b28d06affcdd27ff4e455f1f7d9c8363dbde8ef07aaf79139ec8bc7ce25610b28e1d90c7e168573ee90ac9ab359bf10c667d0254507f8a880a935
2019-12-03 16:35:50 -05:00
fanquake c8becb8280
depends: add ability to skip building qrencode 2019-12-03 15:16:04 -05:00
MarcoFalke e354db7877
Merge #17637: script: Add Keyserver to verify-commits README
bd6a243075 script: Add Keyserver to verify-commits README (Emil Engler)

Pull request description:

  When I use the option with the default keyserver on `gpg (GnuPG) 2.2.12` from the Debian repositories only the keys from meshcollider and fanquake are actually found. Using the ubuntu keyserver works without any problems and all keys are getting found.
  As this keyserver is also suggested on [https://bitcoincore.org/en/download/](), it would be good to have a common keyserver.

ACKs for top commit:
  laanwj:
    ACK bd6a243075, better to be explicit here

Tree-SHA512: d4127c42490390bed4e0074ebb1f8a6cc983f96bbea0ec1da011a93bed325a7f465ed9936e4bc2ef7c4b2e4501a2868d00b67ceb7bf85f2a902db9c6173a6c61
2019-12-03 13:41:56 -05:00
MarcoFalke 54b12e425b
Merge #17555: test: add unit test for non-standard txs with wrong nVersion
76303f65f9 test: add unit test for non-standard txs with wrong nVersion (Dominik Spicher)

Pull request description:

  Takes care of one of the missing cases of #17394: nVersion must be within the allowed range.

ACKs for top commit:
  instagibbs:
    ACK 76303f65f9

Tree-SHA512: 94464f781cf70a5616f7cea2014ae0a97a338c34411cc989c60389de2ce00368374811db78c919bda30e0ebf341fb830998a5e97c124dd8afc8feb726cedfd3a
2019-12-03 13:22:36 -05:00
MarcoFalke 1fdaa04ceb
Merge #17641: Add unit test for leveldb creation with unicode path
70ed2ab7ef Add unit test for DB creation with unicode path (Aaron Clauson)

Pull request description:

  An issue arose when attempting to switch back to the main repo version of leveldb when the bitcoin data directory uses a unicode path. The leveldb windows file IO wrapper was using the *A ANSI win32 calls instead of the Unicode *W ones. This unit test will catch if the path created by leveldb doesn't match what we're expecting. For more info see https://github.com/google/leveldb/issues/755.

ACKs for top commit:
  laanwj:
    ACK 70ed2ab7ef

Tree-SHA512: fc6dbd3aa26a439016e63e8d4d931f218ce99094fc7887a13b54562ad4133047020288ecbcd622a8309f422ee1eda5df50bcb8c8e44442af36ed57b22c069004
2019-12-03 11:06:59 -05:00
MarcoFalke 1705f1949a
Merge #17549: ci: misc cleanups
fad88e6f86 ci: Remove use of cd (MarcoFalke)
fa2941bbf4 ci: Remove unmaintained extended_lint (MarcoFalke)
fa04187528 scripted-diff: Use ci DEPENDS_DIR, remove BASE_BUILD_DIR (MarcoFalke)
fa0656d1eb ci: Add DEPENDS_DIR variable, Add documentation for folders (MarcoFalke)
faeeca87b6 scripted-diff: Move various folders to ci scratch dir (MarcoFalke)

Pull request description:

  Some minor cleanups:

  * Remove unused and unmaintained extended_lint to avoid ci bottlenecks and waste of CPU
  * Move all folders that hold temporary ci files to the ci scratch dir (except for the build dirs)
  * Add some documentation to folders and remove the `BASE_BUILD_DIR` alias for the root directory
  * Fixes #17178 by removing `cd`

Top commit has no ACKs.

Tree-SHA512: f6eb9d47ab98c08af59a79c2a4bf62fc331f0f6f3174909a28f2c2f48b0234423da5aee876225d2e188619b71b008d882a20d29a7aca68248039ea5080be5af5
2019-12-03 11:02:06 -05:00
MarcoFalke 69ca6cdd66
Merge #17599: ci: Run functional tests on s390x
fabd71076c ci: Print free disk space (MarcoFalke)
fad9fdbea5 test: Properly deserialize integers in little-endian (MarcoFalke)
fa94fc10c8 ci: Run functional tests on s390x (MarcoFalke)

Pull request description:

Top commit has no ACKs.

Tree-SHA512: 98ba77eb56f283131fdaeb393fda86cc308f1bf9781e1e0e5736b8d616528dc8ff2e494d55ba107c138083025c66a59e382fcfa9962d4349a5fd6cbbc52484c3
2019-12-03 10:34:11 -05:00
MarcoFalke 2b6575d989
Merge #17643: wallet: Fix origfee return for bumpfee with feerate arg
02afb0c550 Fix origfee return for bumpfee with feerate arg (Gregory Sanders)

Pull request description:

  fixes https://github.com/bitcoin/bitcoin/issues/17642 and adds a simple test that would have caught it

ACKs for top commit:
  achow101:
    ACK 02afb0c550

Tree-SHA512: 303e392e05407f204dffe360689b5bb5dc77fd462dd0e489bc0b6c8f94f89ab7fe2bd8cb47e4dc6dc5c23a619826d15f3bf6b02b2c8e96402fbb51953c462e2d
2019-12-03 10:25:34 -05:00
Wilson Ccasihue S e7ad4a2f8c doc: rename wallet-tool references to bitcoin-wallet 2019-12-02 12:06:35 -05:00
Andrew Chow 886f1731be Key pool: Fix omitted pre-split count in GetKeyPoolSize
This is a bugfix: https://github.com/bitcoin/bitcoin/pull/16341#discussion_r330669214
2019-12-02 11:57:46 -05:00
Andrew Chow 386a994b85 Key pool: Change ReturnDestination interface to take address instead of key
In order for ScriptPubKeyMan to be generic and work with future
ScriptPubKeyMans, ScriptPubKeyMan::ReturnDestination is changed to
take a CTxDestination instead of a CPubKey. Since LegacyScriptPubKeyMan
still deals with keys internally, a new map m_reserved_key_to_index is
added in order to track the keypool indexes that have been reserved.

The CPubKey argument of KeepDestination is also  removed so that it is
more generic. Instead of taking a CPubKey or a CTxDestination, we just use
the nIndex given to find the pubkey.
2019-12-02 11:57:46 -05:00
Andrew Chow ba41aa4969 Key pool: Move LearnRelated and GetDestination calls
Addresses are determined by LegacyScriptPubKeyMan::GetReservedDestination
instead of ReserveDestination::GetReservedDestination as other ScriptPubKeyMan
implementations may construct addresses differently

This does not change behavior.
2019-12-02 11:57:20 -05:00
fanquake 35eda631ed
Merge #17634: qt: Fix comparison function signature
98fbd1cdff Use correct C++11 header for std::swap() (Hennadii Stepanov)
b66861e2e5 Fix comparison function signature (Hennadii Stepanov)

Pull request description:

  This PR fixes build on CentOS 7 with GCC 4.8.5:

  ```
  ...
  In file included from /usr/include/c++/4.8.2/algorithm:62:0,
                   from ./serialize.h:11,
                   from ./qt/sendcoinsrecipient.h:13,
                   from ./qt/recentrequeststablemodel.h:8,
                   from qt/recentrequeststablemodel.cpp:5:
  /usr/include/c++/4.8.2/bits/stl_algo.h: In instantiation of ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&, _Compare) [with _RandomAccessIterator = QList<RecentRequestEntry>::iterator; _Tp = RecentRequestEntry; _Compare = RecentRequestEntryLessThan]’:
  /usr/include/c++/4.8.2/bits/stl_algo.h:2296:78:   required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = QList<RecentRequestEntry>::iterator; _Compare = RecentRequestEntryLessThan]’
  /usr/include/c++/4.8.2/bits/stl_algo.h:2337:62:   required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = QList<RecentRequestEntry>::iterator; _Size = int; _Compare = RecentRequestEntryLessThan]’
  /usr/include/c++/4.8.2/bits/stl_algo.h:5499:44:   required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = QList<RecentRequestEntry>::iterator; _Compare = RecentRequestEntryLessThan]’
  qt/recentrequeststablemodel.cpp:208:82:   required from here
  /usr/include/c++/4.8.2/bits/stl_algo.h:2263:35: error: no match for call to ‘(RecentRequestEntryLessThan) (RecentRequestEntry&, const RecentRequestEntry&)’
      while (__comp(*__first, __pivot))
                                     ^
  In file included from qt/recentrequeststablemodel.cpp:5:0:
  ./qt/recentrequeststablemodel.h:43:7: note: candidate is:
   class RecentRequestEntryLessThan
         ^
  qt/recentrequeststablemodel.cpp:217:6: note: bool RecentRequestEntryLessThan::operator()(RecentRequestEntry&, RecentRequestEntry&) const
   bool RecentRequestEntryLessThan::operator()(RecentRequestEntry &left, RecentRequestEntry &right) const
        ^
  qt/recentrequeststablemodel.cpp:217:6: note:   no known conversion for argument 2 from ‘const RecentRequestEntry’ to ‘RecentRequestEntry&’
  In file included from /usr/include/c++/4.8.2/algorithm:62:0,
                   from ./serialize.h:11,
                   from ./qt/sendcoinsrecipient.h:13,
                   from ./qt/recentrequeststablemodel.h:8,
                   from qt/recentrequeststablemodel.cpp:5:
  /usr/include/c++/4.8.2/bits/stl_algo.h:2266:34: error: no match for call to ‘(RecentRequestEntryLessThan) (const RecentRequestEntry&, RecentRequestEntry&)’
      while (__comp(__pivot, *__last))
                                    ^
  In file included from qt/recentrequeststablemodel.cpp:5:0:
  ./qt/recentrequeststablemodel.h:43:7: note: candidate is:
   class RecentRequestEntryLessThan
         ^
  qt/recentrequeststablemodel.cpp:217:6: note: bool RecentRequestEntryLessThan::operator()(RecentRequestEntry&, RecentRequestEntry&) const
   bool RecentRequestEntryLessThan::operator()(RecentRequestEntry &left, RecentRequestEntry &right) const
        ^
  qt/recentrequeststablemodel.cpp:217:6: note:   no known conversion for argument 1 from ‘const RecentRequestEntry’ to ‘RecentRequestEntry&’
    CXX      qt/qt_libbitcoinqt_a-sendcoinsentry.o
  make[2]: *** [qt/qt_libbitcoinqt_a-recentrequeststablemodel.o] Error 1
  ```

  Also for `std::swap()` header `<algorithm>` is replaced with `<utility>` one.
  Refs:
  - [`std::swap()`](https://en.cppreference.com/w/cpp/algorithm/swap)
  - [standard library header `<utility>`](https://en.cppreference.com/w/cpp/header/utility)

ACKs for top commit:
  promag:
    Code review ACK 98fbd1cdff.
  jonasschnelli:
    utACK 98fbd1cdff
  fanquake:
    ACK 98fbd1cdff

Tree-SHA512: 91324490c1bdb98f186d233418e7e72ae7bee507876e94fb8c038bee031cea9e1046900f21156da4b7c33abcd726796867b124c4132d9ae3759877e90a8527db
2019-12-02 11:24:52 -05:00
Gregory Sanders 02afb0c550 Fix origfee return for bumpfee with feerate arg 2019-12-01 20:54:16 -05:00
practicalswift 5db506ba59 tests: Add option --valgrind to run nodes under valgrind in the functional tests 2019-12-01 19:53:30 +00:00
fanquake 19698ac6bc
Merge #17568: wallet: fix when sufficient preset inputs and subtractFeeFromOutputs
eadd1304c8 tests: Add a test for funding with sufficient preset inputs and subtractFeeFromOutputs (Andrew Chow)
ff330badd4 Default to bnb_used = false as there are many cases where BnB is not used (Andrew Chow)

Pull request description:

  #17290 introduced a bug where, when we had preset inputs that covered the amount being sent and subtractFeeFrromOutputs was being used, transaction funding would result in a `Fee exceeds maximum configured by -maxtxfee` error. This was happening because we weren't setting `bnb_used = false` when the preset inputs were used as it should have been. This resulted in a too high fee because the change would go to fees accidentally.

  Apparently this particular case doesn't have a test, so I've added one as well.

ACKs for top commit:
  Sjors:
    ACK eadd130. I can't get this new test to fail on macOS (without this PR). It passes whether or not I compile with `--enable-debug`. It does fail on Ubuntu. Yay undefined behavior... Anyway, it's a useful test.
  fanquake:
    ACK eadd1304c8
  instagibbs:
    utACK eadd1304c8

Tree-SHA512: 7286c321f78666eea558cc591174630d210263594df41cab1065417510591ee514ade0e1d0cec8af09a785757da68de82592b013e8fe8d4966cec3254368706e
2019-12-01 12:23:44 -05:00
fanquake 2ecb7e1556
Merge #17521: depends: only use D-Bus with Qt on linux
6fdf5dab26 depends: only use dbus with qt on linux (fanquake)

Pull request description:

  Since #8210 we've been passing `-dbus-runtime` when configuring Qt, however D-Bus isn't used on macOS or Windows. So rather than blanket passing `-dbus-runtime`, only use D-Bus when building for linux, and disable it for Windows and macOS. This also saves some time building qt in depends (for windows or macOS).

  This gist contains a diff of the symbols in a macOS bitcoin-qt after applying this change: https://gist.github.com/fanquake/317e5c9c7d1b5e37a0c1ce8001af18c4.

ACKs for top commit:
  laanwj:
    ACK 6fdf5dab26

Tree-SHA512: 7c7df6036f27dae6adb807edf94cd26b4dafa3728976d219a68f7388b6477777b35acebd507320e4469c9f2fcf016b311c82e0b12d50546cb5ab66a1e955e464
2019-11-30 23:16:48 -05:00
Aaron Clauson 70ed2ab7ef
Add unit test for DB creation with unicode path
An issue arose when attempting to switch back to the main repo version of leveldb when the bitcoin data directory uses a unicode path. The leveldb windows file IO wrapper was using the *A ANSI win32 calls instead of the Unicode *W ones. This unit test will catch if the path created by leveldb doesn't match what we're expecting. For more info see https://github.com/google/leveldb/issues/755.
2019-11-30 21:31:46 +00:00
Emil Engler bd6a243075
script: Add Keyserver to verify-commits README 2019-11-30 04:41:06 +01:00
Hennadii Stepanov 98fbd1cdff
Use correct C++11 header for std::swap() 2019-11-29 21:23:25 +02:00
Hennadii Stepanov b66861e2e5
Fix comparison function signature
This commit fixes build on CentOS 7 with GCC 4.8.5
2019-11-29 21:11:00 +02:00
Samuel Dobson abb30de63f
Merge #17587: gui: show watch-only balance in send screen
4a96e459d7 [gui] send: show watch-only balance in send screen (Sjors Provoost)
2689c8fd71 [test] qt: add send screen balance test (Sjors Provoost)

Pull request description:

  Now that we can create a PSBT from a watch-only wallet (#16944), we should also display the watch-only balance on the send screen.

  Before:
  <img width="1008" alt="before" src="https://user-images.githubusercontent.com/10217/69533384-030e9180-0f78-11ea-9748-c32c957e822e.png">

  After:
  <img width="1009" alt="Schermafbeelding 2019-11-26 om 11 44 17" src="https://user-images.githubusercontent.com/10217/69622879-19811f80-1042-11ea-8279-091012f39b38.png">

  I added a test to check the balance on the send screen, but it only covers regular wallets. A better would add a watch-only only wallet.

ACKs for top commit:
  meshcollider:
    utACK 4a96e459d7
  jb55:
    utACK 4a96e459d7
  promag:
    reACK 4a96e45, rebased and label change since last review.
  instagibbs:
    code review and light test ACK 4a96e459d7

Tree-SHA512: 4213549888bd309f72bdbba1453218f4a2b07e809100d786a3791897c75468f9092b06fe4b971942b1c228aa75ee7c04971f262ca9a478b42756e056eb534620
2019-11-29 23:16:08 +13:00
Wladimir J. van der Laan 114e89e596
Merge #17624: net: Fix an uninitialized read in ProcessMessage(…, "tx", …) when receiving a transaction we already have
73b96c94cb net: Fix uninitialized read in ProcessMessage(...) (practicalswift)

Pull request description:

  Fix an uninitialized read in `ProcessMessage(…, "tx", …)` when receiving a transaction we already have.

  The uninitialized value is read and used on [L2526 in the case of `AlreadyHave(inv) == true`](d8a66626d6/src/net_processing.cpp (L2494-L2526)).

  Proof of concept being run against a `bitcoind` built with MemorySanitizer (`-fsanitize=memory`):

  ```
  $ ./p2p-uninit-read-in-conditional-poc.py
  Usage: ./p2p-uninit-read-in-conditional-poc.py <dstaddr> <dstport> <net>
  $ bitcoind -regtest &
  $ ./p2p-uninit-read-in-conditional-poc.py 127.0.0.1 18444 regtest
  SUMMARY: MemorySanitizer: use-of-uninitialized-value
  [1]+  Exit 77                 bitcoind -regtest
  $
  ```

  Proof of concept being run against a `bitcoind` running under Valgrind (`valgrind --exit-on-first-error`):

  ```
  $ valgrind -q --exit-on-first-error=yes --error-exitcode=1 bitcoind -regtest &
  $ ./p2p-uninit-read-in-conditional-poc.py 127.0.0.1 18444 regtest
  ==27351== Conditional jump or move depends on uninitialised value(s)
  [1]+  Exit 1                  valgrind -q --exit-on-first-error=yes --error-exitcode=1 bitcoind -regtest
  $
  ```

  Proof of concept script:

  ```
  #!/usr/bin/env python3

  import sys

  from test_framework.mininode import NetworkThread
  from test_framework.mininode import P2PDataStore
  from test_framework.messages import CTransaction, CTxIn, CTxOut, msg_tx

  def send_duplicate_tx(dstaddr="127.0.0.1", dstport=18444, net="regtest"):
      network_thread = NetworkThread()
      network_thread.start()

      node = P2PDataStore()
      node.peer_connect(dstaddr=dstaddr, dstport=dstport, net=net)()
      node.wait_for_verack()

      tx = CTransaction()
      tx.vin.append(CTxIn())
      tx.vout.append(CTxOut())
      node.send_message(msg_tx(tx))
      node.send_message(msg_tx(tx))
      node.peer_disconnect()
      network_thread.close()

  if __name__ == "__main__":
      if len(sys.argv) != 4:
          print("Usage: {} <dstaddr> <dstport> <net>".format(sys.argv[0]))
          sys.exit(0)
      send_duplicate_tx(sys.argv[1], int(sys.argv[2]), sys.argv[3])
  ```

  Note that the transaction in the proof of concept is the simplest possible, but really any transaction can be used. It does not have to be a valid transaction.

  This bug was introduced in #15921 ("validation: Tidy up ValidationState interface") which was merged in to `master` 28 days ago.

  Luckily this bug was caught before being part of any Bitcoin Core release :)

ACKs for top commit:
  jnewbery:
    utACK 73b96c94cb
  laanwj:
    ACK 73b96c94cb, thanks for discovering and reporting this before it ended up in a release.

Tree-SHA512: 7ce6b8f260bcdd9b2ec4ff4b941a891bbef578acf4456df33b7a8d42b248237ec4949e65e2445b24851d1639b10681c701ad500b1c0b776ff050ef8c3812c795
2019-11-28 12:58:56 +01:00
Wladimir J. van der Laan 23cecd6cd5
Merge #17604: util: make ScheduleBatchPriority advisory only
d2a3a5cadb util: make ScheduleBatchPriority advisory only (fanquake)

Pull request description:

ACKs for top commit:
  laanwj:
    ACK d2a3a5cadb

Tree-SHA512: 14e44360bc6b0c0bfd794cb8a744af7d64fb01aa5602fdb392d6c54799a721ef04426e8379b157dd40f2a33c0b6a5248b09d59c865c453ff1f6e3abbafff524e
2019-11-28 12:49:32 +01:00
Wladimir J. van der Laan 1f59885d27
Merge #17361: script: Lint Gitian descriptors with ShellCheck
17f81e9648 script: Enable SC2001 rule for Gitian scripts (Hennadii Stepanov)
61bb21b418 script: Enable SC2155 rule for Gitian scripts (Hennadii Stepanov)
577682d9e8 script: Enable SC2006 rule for Gitian scripts (Hennadii Stepanov)
14aded46df script: Lint Gitian descriptors with ShellCheck (Hennadii Stepanov)

Pull request description:

  This PR extracts shell scripts from Gitian descriptors (`contrib/gitian-descriptors/`) and checks for ShellCheck warnings as any other one.

  Some non-controversial warnings are fixed.

ACKs for top commit:
  practicalswift:
    ACK 17f81e9648 -- diff looks correct

Tree-SHA512: bdfa3d35bbb65ff634c90835d75c3df63e958b558599771d21366724f5cf64da83a68957d926e926a99c3704b9529e96a17697dc8d9ff3adf7154d9cb1999a8d
2019-11-28 10:18:22 +01:00
practicalswift 73b96c94cb net: Fix uninitialized read in ProcessMessage(...) 2019-11-27 21:27:56 +00:00
Hennadii Stepanov 17f81e9648
script: Enable SC2001 rule for Gitian scripts 2019-11-27 19:27:56 +02:00
Hennadii Stepanov 61bb21b418
script: Enable SC2155 rule for Gitian scripts
Also pwd command is replaced with $PWD variable everywhere for
consistency.
2019-11-27 19:25:29 +02:00
Andrew Chow eadd1304c8 tests: Add a test for funding with sufficient preset inputs and subtractFeeFromOutputs 2019-11-26 13:02:46 -05:00