Commit graph

23396 commits

Author SHA1 Message Date
Carl Dong 3f1f03c67a
guix: Spelling fixes 2020-04-02 17:20:03 -04:00
Carl Dong ff821dd2a1
guix: Reinstate make-ssp-fixed-gcc
Unfortunately, gcc is still not smart enough to detect whether or not
mingw-w64 provides ssp, so let's put it back just for mingw-w64.
2020-04-02 17:20:02 -04:00
Carl Dong 360a9e0ad5
guix: Bump time-machine for mingw-w64 patches
This bump will includes a couple of commits which improve the
reproducibility of the mingw-w64 toolchain. Most of which came from
debian. They will be upstreamed as upstream Guix release timeline
allows.
2020-04-02 17:20:01 -04:00
Carl Dong 93e41b7e3b
guix: Use gcc-8 for mingw-w64 instead of 7
We're using mingw-w64 6.0.0, which is paired with gcc-8 in most distros.
2020-04-02 17:20:00 -04:00
Carl Dong ef4f7e4c45
guix: Set the well-known timezone env var 2020-04-02 17:19:59 -04:00
Carl Dong acf4b3b3b5
guix: Make x86_64-w64-mingw32 builds reproducible
- Add "--no-insert-timestamp" LDFLAG for x86_64-w64-mingw32 builds

"The option --no-insert-timestamp can be used to insert a zero value for
the timestamp, this ensuring that binaries produced from identical
sources will compare identically." - ld(1)

- Set "SetDateSave off" in NSIS script

From https://nsis.sourceforge.io/Docs/Chapter4.html#flags

"This command sets the file date/time saving flag which is used by the
File command to determine whether or not to save the last write date and
time of the file, so that it can be restored on installation. Valid
flags are 'on' and 'off'. 'on' is the default."

- Add commented out NSIS options for reproducibility debugging in NSIS
  script

- Make ZIPs deterministic by reseting file modification times to
  SOURCE_DATE_EPOCH using touch(1) (Reference:
  https://reproducible-builds.org/docs/archives/)
2020-04-02 17:19:57 -04:00
Carl Dong c4cce00eac
guix: Remove dead links from README. 2020-04-02 17:19:56 -04:00
Carl Dong df953a4c9a
guix: Appease shellcheck. 2020-04-02 17:19:55 -04:00
Carl Dong 91897c95e1
guix: Improve guix-build.sh documentation 2020-04-02 17:19:54 -04:00
Carl Dong 570d769c6c
guix: Build support for Windows 2020-04-02 17:19:53 -04:00
MarcoFalke 0d71395848
Merge #18464: doc: block-relay-only vs blocksonly
fa6e01f2a1 doc: block-relay-only is not blocksonly (MarcoFalke)

Pull request description:

  Those are different concepts, see https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.19.0.1.md#p2p-changes for the block-relay-only nodes.

ACKs for top commit:
  jonatack:
    ACK fa6e01f
  hebasto:
    ACK fa6e01f2a1

Tree-SHA512: 6de2c81201b62ed59e504a3a6f164068600182e1bbf63eda7f9db3160507bdba091c13882ee0e75e713f0832bfaf5973a86eba3b94588d5b72196f05ae0a9c9a
2020-04-03 05:06:23 +08:00
MarcoFalke ff53433fe4
Merge #18494: test: replace (send_message + sync_with_ping) with send_and_ping
6112a20982 test: replace (send_message + sync_with_ping) with send_and_ping (Jon Atack)

Pull request description:

  This is a follow-up to faf1d04731 yesterday.

ACKs for top commit:
  vasild:
    utACK 6112a20
  MarcoFalke:
    ACK 6112a20982 🎞

Tree-SHA512: 749644ac9a1ef0e1aa6c3ac5e899eb3fa7fb9c0909352f922a80412df2bc0e539692a7757af550eff4d4914cbe57b0c75ce3948f569acc7a52852e91a55ad457
2020-04-03 02:12:46 +08:00
Wladimir J. van der Laan b83565625e
Merge #18500: chainparams: Bump assumed valid hash
222253e37d chainparams: Bump assumed valid hash (MarcoFalke)

Pull request description:

  See https://github.com/bitcoin/bitcoin/blob/master/doc/release-process.md#before-branch-off

ACKs for top commit:
  fanquake:
    ACK 222253e37d - matches output on my node. Also have 3.8GB for the chainstate dir. If anyone wants to know what commands they should run / what to check; I have some docs on [assumevalid updates](https://github.com/fanquake/core-review/blob/master/update-assumevalid.md).
  elichai:
    ACK 222253e37d
  theStack:
    ACK 222253e37d
  instagibbs:
    ACK 222253e37d all mainnet params, did not check testnet

Tree-SHA512: 856e75f0c6663ab478768d80618f11ac109ef30058661f58ed7f2a3a615dd5fb8f8d648c996eff77949036c1633119085b25cd4c25250a0850c943c02cddf3d7
2020-04-02 15:43:49 +02:00
Wladimir J. van der Laan 6bdd515ccf
Merge #16923: wallet: Handle duplicate fileid exception
9eefc6e92f gui: Delete progress dialog instead of hidding it (João Barbosa)
ee9e88ba27 wallet: Handle duplicate fileid exception (João Barbosa)

Pull request description:

  Handle the duplicate fileid exception thrown at `CheckUniqueFileid` in tow cases:
   - when duplicate wallets are set on the command line - catch in `LoadWallets`;
   - when a duplicate wallet is loaded dynamically - catch in `LoadWallet`.

  Fixes #16776.

ACKs for top commit:
  jonatack:
    Re-ACK 9eefc6e92f no change since last review 68e0ff0e1f530c942721aab49cf67ffc07104628
  hebasto:
    re-ACK 9eefc6e92f

Tree-SHA512: 46e3c1cd6708b54e2d1c4973a74c8d5428822e04cecbc147cf200eb034efa385e867bd749c7c639020e83c9813fae8fed64a851bdd99abf60c33b07e0363f5d5
2020-04-02 15:07:55 +02:00
Wladimir J. van der Laan 5c1ba3a10a
Merge #18358: util: fix compilation with mingw-w64 7.0.0
a46484c8b3 build: Detect gmtime_* definitions via configure (Ben Woosley)

Pull request description:

  Something has changed in the mingw-w64 headers such that we
  no-longer compile when using 7.0.0.

  ```bash
  util/time.cpp: In function 'std::__cxx11::string FormatISO8601DateTime(int64_t)':
  util/time.cpp:84:9: error: 'gmtime_r' was not declared in this scope
       if (gmtime_r(&time_val, &ts) == nullptr) {
           ^~~~~~~~
  util/time.cpp: In function 'std::__cxx11::string FormatISO8601Date(int64_t)':
  util/time.cpp:97:9: error: 'gmtime_r' was not declared in this scope
       if (gmtime_r(&time_val, &ts) == nullptr) {
  ```

  Looking at time.h, it seems that `gmtime_r()` is only available when
  `_POSIX_C_SOURCE` is defined. This must have been the case for 6.0.0
  (which we compile fine using), but no-longer seems to be for 7.0.0?

  I've checked that adding `-D_POSIX_C_SOURCE=200112L` to our compile
  flags does fix the issue above.

  However, an alternative solution seems to be to just use `gmtime_s()`
  instead, when compiling with `mingw-w64`, as `gmtime_r()` [just wraps
  `gmtime_s()` anyways](7c03b11bf1/mingw-w64-headers/crt/time.h (L284)).

  I've tested this change crosss-compiling on Debian Bullseye ([mingw-w64 7.0.0](https://packages.debian.org/source/bullseye/mingw-w64))
  and Buster ([mingw-w64 6.0.0](https://packages.debian.org/source/buster/mingw-w64)).

ACKs for top commit:
  laanwj:
    ACK a46484c8b3

Tree-SHA512: 7cf1a81060b9625d64de40b77341d74704cc8ae1358d25d7e2909685dc83a7a9762260d72e47806e9f0a5cbabf88d0239ec9e0fd0ebd3731b1d206b075f43a63
2020-04-02 12:47:13 +02:00
Ben Woosley a46484c8b3
build: Detect gmtime_* definitions via configure
This improves the portability of the codebase and fixes compilation
with mingw-w64 7.0+.

Co-authored-by: fanquake <fanquake@gmail.com>
2020-04-02 12:31:54 +08:00
MarcoFalke 222253e37d
chainparams: Bump assumed valid hash 2020-04-02 05:34:47 +08:00
Jon Atack 6112a20982
test: replace (send_message + sync_with_ping) with send_and_ping 2020-04-01 17:30:02 +02:00
Wladimir J. van der Laan 41fa2926d8
Merge #18492: qt: Translations update pre-branch
740614e3c3 qt: Translations update pre-branch (Wladimir J. van der Laan)

Pull request description:

  Update translations from transifex before the 0.20 branch-off. As we don't have translations for the master branch (only for release versions), this is the last opportunity (for this release) to get up to date translations on master.

ACKs for top commit:
  elichai:
    utACK 740614e3c3
  fanquake:
    ACK 740614e3c3

Tree-SHA512: 108b82bac967009cab2257d77f0fbc38d18497ffdfe34b06aba35a1894b9b7ebff8ba4671219f4e20ebc42f984ed9ef65c5d41d21ac08dadfef798474f0b2b3b
2020-04-01 14:11:23 +02:00
Wladimir J. van der Laan 740614e3c3 qt: Translations update pre-branch 2020-04-01 12:49:15 +02:00
fanquake b97e3a7349
Merge #18477: ci: Use Focal for fuzzers
faa9491870 ci: Use Focal for fuzzers (MarcoFalke)

Pull request description:

  This gives us access to clang-10, as well as a newer version of valgrind

ACKs for top commit:
  fanquake:
    ACK faa9491870 - [Clang 10](https://packages.ubuntu.com/focal/clang) and [valgrind 3.15](https://packages.ubuntu.com/focal/valgrind).
  practicalswift:
    ACK faa9491870 -- diff looks correct & contemporary clang is better than vintage clang

Tree-SHA512: 0e67232673434c0309db79c1054e3e981115083585945967e346f4d58792635832100f89911428aab928155e44e5f401207a023681ae008fdb5280cf02c4d427
2020-04-01 15:00:22 +08:00
MarcoFalke 67a72466e1
Merge #18247: test: Wait for both veracks in add_p2p_connection
faf1d04731 test: Remove redundant sync_with_ping after add_p2p_connection (MarcoFalke)
fa90647045 test: Wait for both veracks in add_p2p_connection (MarcoFalke)

Pull request description:

  This fixes the race in p2p_blocksonly

  E.g. https://travis-ci.org/MarcoFalke/bitcoin-core/jobs/657038844#L4500

  ```
   ...
   test  2020-03-01T20:58:28.825000Z TestFramework.mininode (DEBUG): Closed connection to: 127.0.0.1:11828
   node0 2020-03-01T20:58:28.825642Z [net] disconnecting peer=0
   node0 2020-03-01T20:58:28.825826Z [net] Cleared nodestate for peer=0
   node0 2020-03-01T20:58:28.875835Z [http] Received a POST request for / from 127.0.0.1:53448
   node0 2020-03-01T20:58:28.876067Z [httpworker.0] ThreadRPCServer method=getmempoolinfo user=__cookie__
   test  2020-03-01T20:58:28.877000Z TestFramework.mininode (DEBUG): Connecting to Bitcoin Node: 127.0.0.1:11828
   test  2020-03-01T20:58:28.878000Z TestFramework.mininode (DEBUG): Connected & Listening: 127.0.0.1:11828
   test  2020-03-01T20:58:28.878000Z TestFramework.mininode (DEBUG): Send message to 127.0.0.1:11828: msg_version(nVersion=70014 nServices=9 nTime=Sun Mar  1 20:58:28 2020 addrTo=CAddress(nServices=1 ip=127.0.0.1 port=11828) addrFrom=CAddress(nServices=1 ip=0.0.0.0 port=0) nNonce=0x164D5DEB952A4A0B strSubVer=b'/python-mininode-tester:0.0.3/' nStartingHeight=-1 nRelay=1)
   node0 2020-03-01T20:58:28.883808Z [net] Added connection peer=1
   node0 2020-03-01T20:58:28.883950Z [net] connection from 127.0.0.1:33798 accepted
   node0 2020-03-01T20:58:28.884300Z [msghand] received: version (116 bytes) peer=1
   node0 2020-03-01T20:58:28.884483Z [msghand] sending version (114 bytes) peer=1
   node0 2020-03-01T20:58:28.884700Z [msghand] send version message: version 70015, blocks=200, us=[::]:0, peer=1
   node0 2020-03-01T20:58:28.884765Z [msghand] sending verack (0 bytes) peer=1
   test  2020-03-01T20:58:28.885000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_version(nVersion=70015 nServices=1033 nTime=Sun Mar  1 20:58:28 2020 addrTo=CAddress(nServices=0 ip=0.0.0.0 port=0) addrFrom=CAddress(nServices=1033 ip=0.0.0.0 port=0) nNonce=0x4A0F2F4C549B3399 strSubVer=b'/Satoshi:0.19.99(testnode0)/' nStartingHeight=200 nRelay=0)
   test  2020-03-01T20:58:28.885000Z TestFramework.mininode (DEBUG): Send message to 127.0.0.1:11828: msg_verack()
   test  2020-03-01T20:58:28.885000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_verack()
   node0 2020-03-01T20:58:28.885004Z [msghand] receive version message: /python-mininode-tester:0.0.3/: version 70014, blocks=-1, us=127.0.0.1:11828, peer=1
   test  2020-03-01T20:58:28.886000Z TestFramework (INFO): Check that txs from rpc are not rejected and relayed to other peers
   node0 2020-03-01T20:58:28.886556Z [http] Received a POST request for / from 127.0.0.1:53448
   node0 2020-03-01T20:58:28.886783Z [httpworker.1] ThreadRPCServer method=getpeerinfo user=__cookie__
   node0 2020-03-01T20:58:28.889032Z [http] Received a POST request for / from 127.0.0.1:53448
   node0 2020-03-01T20:58:28.889294Z [httpworker.2] ThreadRPCServer method=testmempoolaccept user=__cookie__
   node0 2020-03-01T20:58:28.891655Z [http] Received a POST request for / from 127.0.0.1:53448
   node0 2020-03-01T20:58:28.891963Z [httpworker.3] ThreadRPCServer method=sendrawtransaction user=__cookie__
   node0 2020-03-01T20:58:28.893115Z [httpworker.3] Enqueuing TransactionAddedToMempool: txid=af34fc5ff9ea8babbd4083fbb79ffd2ad5aff1d6def803c07ca5aeed880bd60f wtxid=af34fc5ff9ea8babbd4083fbb79ffd2ad5aff1d6def803c07ca5aeed880bd60f
   node0 2020-03-01T20:58:28.893443Z [scheduler] TransactionAddedToMempool: txid=af34fc5ff9ea8babbd4083fbb79ffd2ad5aff1d6def803c07ca5aeed880bd60f wtxid=af34fc5ff9ea8babbd4083fbb79ffd2ad5aff1d6def803c07ca5aeed880bd60f
   node0 2020-03-01T20:58:28.894814Z [msghand] received: verack (0 bytes) peer=1
   node0 2020-03-01T20:58:28.894937Z [msghand] sending sendheaders (0 bytes) peer=1
   node0 2020-03-01T20:58:28.895087Z [msghand] sending sendcmpct (9 bytes) peer=1
   node0 2020-03-01T20:58:28.895235Z [msghand] sending sendcmpct (9 bytes) peer=1
   node0 2020-03-01T20:58:28.895430Z [msghand] sending ping (8 bytes) peer=1
   node0 2020-03-01T20:58:28.895896Z [msghand] initial getheaders (199) to peer=1 (startheight:-1)
   test  2020-03-01T20:58:28.896000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_sendheaders()
   node0 2020-03-01T20:58:28.896016Z [msghand] sending getheaders (645 bytes) peer=1
   node0 2020-03-01T20:58:28.896607Z [msghand] sending feefilter (8 bytes) peer=1
   test  2020-03-01T20:58:28.897000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_sendcmpct(announce=False, version=2)
   test  2020-03-01T20:58:28.897000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_sendcmpct(announce=False, version=1)
   test  2020-03-01T20:58:28.897000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_ping(nonce=f735096062d217b5)
   test  2020-03-01T20:58:28.897000Z TestFramework.mininode (DEBUG): Send message to 127.0.0.1:11828: msg_pong(nonce=f735096062d217b5)
   test  2020-03-01T20:58:28.897000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_getheaders(locator=CBlockLocator(nVersion=70014 vHave=[48924041037103782797700918670732352379567180837453042168545380831411841797392, 28010422273815860773972769588722664110955084223364219183119416607410792753789, 5954376895683677137597080246740451260829355661937599865380797589540815086241, 14500403275336359851183244421245184901482464358719551678581030092830439955257, 17853919108052771837249729512111680264864054213441538187113939176285784834878, 28843166929059356839755035875664073555480989477... (msg truncated)
   test  2020-03-01T20:58:28.897000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_feefilter(feerate=000003e8)
   node0 2020-03-01T20:58:28.898144Z [msghand] received: pong (8 bytes) peer=1
   node0 2020-03-01T20:59:28.338539Z [scheduler] Feeding 13446 bytes of dynamic environment data into RNG
   test  2020-03-01T20:59:28.908000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
                                             def test_function():
                                                 assert self.is_connected
                                                 if not self.last_message.get('tx'):
                                                     return False
                                                 return self.last_message['tx'].tx.rehash() == txid
                                     '''
   test  2020-03-01T20:59:28.908000Z TestFramework (ERROR): Assertion failed
                                     Traceback (most recent call last):
                                       File "/home/travis/build/MarcoFalke/bitcoin-core/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 112, in main
                                         self.run_test()
                                       File "/home/travis/build/MarcoFalke/bitcoin-core/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_blocksonly.py", line 57, in run_test
                                         self.nodes[0].p2p.wait_for_tx(txid)
                                       File "/home/travis/build/MarcoFalke/bitcoin-core/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/mininode.py", line 369, in wait_for_tx
                                         wait_until(test_function, timeout=timeout, lock=mininode_lock)
                                       File "/home/travis/build/MarcoFalke/bitcoin-core/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/util.py", line 234, in wait_until
                                         raise AssertionError("Predicate {} not true after {} seconds".format(predicate_source, timeout))
                                     AssertionError: Predicate ''''
                                             def test_function():
                                                 assert self.is_connected
                                                 if not self.last_message.get('tx'):
                                                     return False
                                                 return self.last_message['tx'].tx.rehash() == txid
                                     ''' not true after 60 seconds

ACKs for top commit:
  jonatack:
    ACK faf1d04

Tree-SHA512: 3b1a38a5c87d11c610eee0988f0c4af9bfcd978df9ac718ef611f663df2fd4a0eb04e077df5e940d15971bb2f22328fb6021cacccb6902f1e527f288ad2c4a2c
2020-04-01 05:08:41 +02:00
MarcoFalke eb773f1063
Merge #18486: doc: Explain new test logging
7777703958 doc: Explain new test logging (MarcoFalke)

Pull request description:

  Explain logging added in #18472 and #16975

ACKs for top commit:
  jonatack:
    ACK 7777703

Tree-SHA512: 3a0aa7bab32a6753d8894d29cf82604b044b23e512102dd275b717eefda3c2212dbf43ea7e9155267350dd9f3bc5badba2eb660152db3efeab30a04f52126c95
2020-04-01 05:06:55 +02:00
MarcoFalke 7777703958
doc: Explain new test logging 2020-03-31 17:11:47 -04:00
MarcoFalke faf1d04731
test: Remove redundant sync_with_ping after add_p2p_connection
Also replace the two-line (send_message + sync_with_ping) with the one-line send_and_ping
2020-03-31 17:03:24 -04:00
MarcoFalke fa90647045
test: Wait for both veracks in add_p2p_connection 2020-03-31 17:03:03 -04:00
MarcoFalke d2db25233c
Merge #18474: test: check that peer is connected when calling sync_*
fac3716b09 test: check that peer is connected when calling sync_* (MarcoFalke)

Pull request description:

  Without a connection there is no way to sync, so we can fail early and don't have to wait for the timeout

ACKs for top commit:
  jonatack:
    ACK fac3716b09

Tree-SHA512: 12f771473c23e152dae4bfb201fadb2c3530cf439de64fea07d048734614543080a5d05c9c36e6e398c6a69c8279f609d34706599571814172a11bcfbea4a3b9
2020-03-31 16:35:03 -04:00
MarcoFalke 72ef366564
Merge #18472: test: Remove unsafe BOOST_TEST_MESSAGE
fa3cc0bfc4 test: Remove unsafe BOOST_TEST_MESSAGE (MarcoFalke)

Pull request description:

  Fixes #17987

  Can be tested with

  ```
  ./src/test/test_bitcoin -l test_suite  -- DEBUG_LOG_OUT

ACKs for top commit:
  fjahr:
    tested ACK fa3cc0bfc4
  mzumsande:
    Tested ACK fa3cc0bfc4

Tree-SHA512: f63b110d77882cd7c0d7574ff6c9c948db8febb3400ecdac45164746b587b0fa223463041801271b3959267ddc1d9a4a67ba76939e242e7dd2f92a2834a400a0
2020-03-31 15:39:15 -04:00
MarcoFalke d52ba21dff
Merge #18481: test: add BIP37 'filterclear' test to p2p_filter.py
0055922958 test: add BIP37 'filterclear' test to p2p_filter.py (Sebastian Falbesoner)

Pull request description:

  Integrates the message type `filterclear` to the test framework and adds a simple test to `p2p_filter.py`, checking that arbitrary txs get relayed again after deleting the filter.

ACKs for top commit:
  naumenkogs:
    utACK 0055922958

Tree-SHA512: fe64e99a526865770707d8077b9968d3923f248045ec7fa56cd380dba85ac77a71a473d244ef3aede2fc0d287b8d7c6bc0156b6033b0c949c2058cc08e255697
2020-03-31 09:36:02 -04:00
João Barbosa 9eefc6e92f gui: Delete progress dialog instead of hidding it 2020-03-31 14:23:43 +01:00
João Barbosa ee9e88ba27 wallet: Handle duplicate fileid exception 2020-03-31 14:23:43 +01:00
Wladimir J. van der Laan 9a2b5f22c1
Merge #18338: Fix wallet unload race condition
41b0baf43c gui: Handle WalletModel::unload asynchronous (João Barbosa)
ab31b9d6fe Fix wallet unload race condition (Russell Yanofsky)

Pull request description:

  This PR consists in two fixes. The first fixes a concurrency issues with `boost::signals2`. The second fixes a wallet model destruction while it's being used.

  From boost signal documentation at https://www.boost.org/doc/libs/1_72_0/doc/html/signals2/thread-safety.html:

  > When a signal is invoked by calling signal::operator(), the invocation first acquires a lock on the signal's mutex. Then it obtains a handle to the signal's slot list and combiner. Next it releases the signal's mutex, before invoking the combiner to iterate through the slot list.

  This means that `UnregisterValidationInterface` doesn't prevent more calls to that interface. The fix consists in capturing the `shared_ptr<CValidationInterface>` in each internal slot.

  The GUI bug is fixed by using a `Qt::QueuedConnection` in the `WalletModel::unload` connection.

ACKs for top commit:
  ryanofsky:
    Code review ACK 41b0baf43c. Only change is moving assert as suggested
  hebasto:
    ACK 41b0baf43c, tested on Linux Mint 19.3.

Tree-SHA512: 4f712d8de65bc1214411831250de5dc0a9fd505fb84da5baf9f2cc4d551bc3abffc061616f00afe43dba7525af2cd96c9b54aeead9383145e3b8801f25d85f50
2020-03-31 15:07:06 +02:00
Wladimir J. van der Laan f2880e21ef
Merge #18160: gui: Avoid Wallet::GetBalance in WalletModel::pollBalanceChanged
0933a37078 gui: Avoid Wallet::GetBalance in WalletModel::pollBalanceChanged (João Barbosa)

Pull request description:

  Each 250ms the slot `WalletModel::pollBalanceChanged` is called which, at worst case, calls `Wallet::GetBalance`. This is a waste of resources since most of the time there aren't new transactions or new blocks. Fix this by early checking if cache is dirty or not.

  The actual balance computation can still hang the GUI thread but that is tracked in #16874 and should be fixed with a solution similar to #17135.

ACKs for top commit:
  hebasto:
    ACK 0933a37078, I have not tested the code, but I have reviewed it and it looks OK, I agree it can be merged.
  jonasschnelli:
    utACK 0933a37078
  instagibbs:
    ACK 0933a37078
  ryanofsky:
    Code review ACK 0933a37078, but I would prefer (not strongly) for #17905 to be merged first. This PR can be simpler if it is based on #17905, so tryGetBalances can just be left alone instead of changing into to a more complicated tryGetBalancesIfNeeded function, and then getting changed back later when we want to optimize it out.
  jonatack:
    ACK 0933a37078 based primarily on code review, despite a lot of manual testing with a large 177MB wallet.

Tree-SHA512: 18db35bf33a7577666658c8cb0b57308c8474baa5ea95bf1468cd8531a69857d8915584f6ac505874717aa6aabeb1b506ac77630f8acdb6651afab89275e38a1
2020-03-31 14:23:30 +02:00
Sebastian Falbesoner 0055922958 test: add BIP37 'filterclear' test to p2p_filter.py 2020-03-31 11:14:48 +02:00
MarcoFalke 965c0c37d5
Merge #18420: test: listsinceblock block height checks
83e1d92413 test: listsinceblock block height checks (Jon Atack)

Pull request description:

  This is the second commit of #17535.

  This PR extends a listsinceblock test to check the new transaction 'blockheight' field recently added in #17437. It also cleans up code in the test function without changing or removing existing checks.

ACKs for top commit:
  fjahr:
    tested ACK 83e1d92413
  ryanofsky:
    Code review ACK 83e1d92413. Nice test improvements!

Tree-SHA512: 92874b49a3bc0236500495f32dfcf683e1971ca3d4c51702c69ed4ce7dfce21273754f02f93d1243d73793701d9fdf49e14b149477cd249cbbd9e4e8d5bd49f8
2020-03-30 19:06:43 -04:00
MarcoFalke faa9491870
ci: Use Focal for fuzzers 2020-03-30 18:57:59 -04:00
MarcoFalke fac3716b09
test: check that peer is connected when calling sync_* 2020-03-30 15:51:05 -04:00
MarcoFalke 7e1fc03b18
Merge #18334: test: Add basic test for BIP 37
fa15699969 test: Add basic test for BIP 37 (MarcoFalke)

Pull request description:

  This does not add full coverage, but should be a good start and can be extended in the future. Currently, none of the BIP 37 p2p code has test coverage.

ACKs for top commit:
  practicalswift:
    Code review ACK fa15699969 -- more testing coverage is better than less testing coverage

Tree-SHA512: d52e8be79240dffb769105c087ae0ae9305d599282546e4ca7379c4c7add2dbcd668265b46670aa07c357638044cf0f61a6fab7dba8971dd0f80c8f99768686e
2020-03-30 15:28:02 -04:00
MarcoFalke fa3cc0bfc4
test: Remove unsafe BOOST_TEST_MESSAGE 2020-03-30 15:18:42 -04:00
fanquake 6a11d9e330
Merge #18433: serialization: prevent int overflow for big Coin::nHeight
e980214bc4 serialization: prevent int overflow for big Coin::nHeight (pierrenn)

Pull request description:

  This is an attempt to fix fuzzer issues 1,2,8 reported by practicalswift here : https://github.com/bitcoin/bitcoin/issues/18046

  The fuzzer harness doesn't prevent deserialization of unrealistic high values for `Coin::nHeight`.  In the [provided examples](https://github.com/bitcoin/bitcoin/issues/18046), we have :
  - `blockundo_deserialize` : the varint `0x8DD88DD700` is deserialized as `3944983552` in `Coin::nHeight` (`TxInOutFormatter::Unser`)
  - `coins_deserialize` : the varint `0x8DD5D5EC40` is deserialized as `3939874496` similarly
  - `txundo_deserialize`: the varint `0x8DCD828F01` is deserialized as `3921725441` in `Coin::nHeight` (`Coin::Unserialize`)

  Since `Coin::nHeight` is 31 bit long, multiplying a large value by 2 triggers the fuzzer.

  AFAIK those values are unrealistic (~70k years for the smallest..). I've looked a bit a reducing the range of values the fuzzer can deserialize, but this seems to be too much code change for not much.

  Hence this PR chooses to static cast `nHeight` when re-serializing; it seems to be the less intrusive/safest way to prevent the fuzzer output.

  Another more "upstream" approach would be to limit `Coin::nHeight` values to something more realistic, e.g. `0xFFFFFFF` (~5k years) :

  de3a30bab2/src/undo.h (L39) and de3a30bab2/src/coins.h (L71)

  Thanks !

  NB: i was also not sure about the component/area to prefix the PR/commit with.. ?

ACKs for top commit:
  practicalswift:
    ACK e980214bc4 -- patch looks correct
  promag:
    ACK e980214bc4.
  sipa:
    utACK e980214bc4
  MarcoFalke:
    re-ACK e980214bc4 🎑
  ryanofsky:
    Code review ACK e980214bc4. Just removed ternary ? 1 : 0 and replaced / 2 with >> 1 since last review

Tree-SHA512: 905fc9e5e52a6857abee4a1c863751767835965804bb8c39474f27a120f65399ff4ba7a49ef1da0ba565379f8c12095bd384b6c492cf06776f01b2db68d522b8
2020-03-30 22:16:12 +08:00
MarcoFalke fa6e01f2a1
doc: block-relay-only is not blocksonly
Co-Authored-By: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2020-03-30 09:09:12 -04:00
MarcoFalke 5f9cd62f33
Merge #18455: tests: Add fuzzing harness for functions/classes in flatfile.h, merkleblock.h, random.h, serialize.h and span.h
11a520f679 tests: Add fuzzing harness for functions/classes in random.h (practicalswift)
64d277bbbc tests: Add fuzzing harness for LimitedString (serialize.h) (practicalswift)
f205cf7fef tests: Add fuzzing harness for functions/classes in span.h (practicalswift)
9718f38f54 tests: Add fuzzing harness for functions/classes in merkleblock.h (practicalswift)
a16ea051f9 tests: Add fuzzing harness for functions/classes in flatfile.h (practicalswift)

Pull request description:

  * Add fuzzing harness for functions/classes in `flatfile.h`
  * Add fuzzing harness for functions/classes in `merkleblock.h`
  * Add fuzzing harness for functions/classes in `span.h`
  * Add fuzzing harness for `LimitedString` (`serialize.h`)
  * Add fuzzing harness for functions/classes in `random.h`

Top commit has no ACKs.

Tree-SHA512: 6f7e0f946f1062d51216990cde9672b4e896335152548ace3d8711e4969c3e3c8566d01d915b72adcda5c1caa9c2e34da6b7473b55a229f5b77239d3b0ba4b67
2020-03-29 10:32:05 -04:00
practicalswift 11a520f679 tests: Add fuzzing harness for functions/classes in random.h 2020-03-29 13:17:04 +00:00
practicalswift 64d277bbbc tests: Add fuzzing harness for LimitedString (serialize.h) 2020-03-29 13:17:04 +00:00
practicalswift f205cf7fef tests: Add fuzzing harness for functions/classes in span.h 2020-03-29 13:17:04 +00:00
practicalswift 9718f38f54 tests: Add fuzzing harness for functions/classes in merkleblock.h 2020-03-29 13:17:04 +00:00
practicalswift a16ea051f9 tests: Add fuzzing harness for functions/classes in flatfile.h 2020-03-29 13:17:04 +00:00
MarcoFalke 6cfb3dbbdb
Merge #18391: doc: Update init and reduce-traffic docs for -blocksonly
621e86ee8d Update -blocksonly documentation (glowang)

Pull request description:

  When -blocksonly is set to 1, it interacts with the -walletbroadcast
  parameter and sets it to 0.

  This behavior is not captured by the current documentation, which
  claims that -blocksonly does not impact any wallet transactions at
  all.

  Fixes #17294

ACKs for top commit:
  MarcoFalke:
    ACK 621e86ee8d

Tree-SHA512: f47bfb40a196c23e62505e1d4f79094011ac7c21fc9b920fad60cdadb5c4f48e993be1f015e26e568ce329967c24848fd7b665a6cffd3881f4cfcd2fd0081ed8
2020-03-29 08:15:55 -04:00
glowang 621e86ee8d Update -blocksonly documentation
When -blocksonly is set to 1, it interacts with the -walletbroadcast
parameter and sets it to 0 if it has not been set already.This behavior
is not captured by the current documentation, which claims that -blocksonly
does not impact any wallet transactions.

Update the max number of outgoing peers from 8 to 10, due to the
addition of two -blocksonly peers.
2020-03-29 05:12:30 -07:00
MarcoFalke 27a82d347e
Merge #18459: rpc: remove unused getbalances() code
6e0d82c55b rpc: remove unused getbalances() code (Jon Atack)

Pull request description:

  This line from 999931cf8f appears to be extraneous and replaced 2 lines after by `UniValue balances{UniValue::VOBJ};`.

ACKs for top commit:
  Empact:
    ACK 6e0d82c55b
  hebasto:
    ACK 6e0d82c55b, the `obj` local variable is not used until the end of the scope.

Tree-SHA512: a220ca9cda091e78144d9b7fbe4bf90e8338d6e8c8dc7bea27a8e62f3a8ac1d983ad12a48a0a3366b2d8b9586878dfc69c1ec34bf846b34c91e42cda48a59850
2020-03-28 17:09:52 -04:00