Commit Graph

22008 Commits

Author SHA1 Message Date
Russell Yanofsky
52cf68f7ff Refactor: Add GetLegacyScriptPubKeyMan helper
Suggested by João Barbosa <joao.paulo.barbosa@gmail.com>
https://github.com/bitcoin/bitcoin/pull/17260#discussion_r339505236
2019-10-29 12:20:19 -04:00
Sebastian Falbesoner
c1c6c410a6 test: add reason checks for non-standard txs in test_IsStandard 2019-10-29 16:02:19 +01:00
MarcoFalke
6a97e8a060
Merge #17260: Split some CWallet functions into new LegacyScriptPubKeyMan
f201ba59ff Refactor: Split up CWallet and LegacyScriptPubKeyMan and classes (Andrew Chow)
6702048f91 MOVEONLY: Move key handling code out of wallet to keyman file (Andrew Chow)
ab053ec6d1 Move wallet enums to walletutil.h (Andrew Chow)

Pull request description:

  Moves key management functions into a new class LegacyScriptPubKeyMan. First two commits are move-only commits which move stuff out of wallet.{h/cpp} and into newly created scriptpubkeyman.{h/cpp}. Third commit changes several things in CWallet to use LegacyScriptPubKeyMan.

  First step in the wallet boxes refactor. Note that LegacyScriptPubKeyMan and ScriptPubKeyMan cannot be used standalone yet and are still very much tied into CWallet with both accessing functions within each other. This PR is to help reduce review burden.

ACKs for top commit:
  Sjors:
    Code review ACK f201ba5.
  promag:
    Code review ACK f201ba59ff.
  ryanofsky:
    Code review ACK f201ba59ff
  MarcoFalke:
    ACK f201ba59ff

Tree-SHA512: bdc0d8595a06233fe003afcf968a38e0e8cc584a6a89c5bcd05309ac29dca852391802d46763ef81a108d146d0f40c79ea5438e87234ed12b4b8360c9aec94c0
2019-10-29 08:19:23 -04:00
Hennadii Stepanov
f44abe4bed
refactor: Remove addrdb.h dependency from node.h 2019-10-29 11:30:12 +02:00
Jeremy Rubin
a35b6824f3 Add assertion to randrange that input is not 0 2019-10-28 16:42:39 -07:00
Jeremy Rubin
b0c774b48a Add new mempool benchmarks for a complex pool 2019-10-28 15:58:48 -07:00
MarcoFalke
4c1090c882
Merge #17279: refactor: Remove redundant c_str() calls in formatting
c72906dcc1 refactor: Remove redundant c_str() calls in formatting (Wladimir J. van der Laan)

Pull request description:

  Our formatter, tinyformat, *never* needs `c_str()` for strings. Still, many places call it redundantly, resulting in longer code and a slight overhead.

  Remove redundant `c_str()` calls for:

  - `strprintf`
  - `LogPrintf`
  - `tfm::format`

  (also, combined with #17095, I think this improves logging in case of unexpected embedded NULL characters)

ACKs for top commit:
  ryanofsky:
    Code review ACK c72906dcc1. Easy to review with `git log -p -n1 --word-diff-regex=. -U0 c72906dcc11a73fa06a0adf97557fa756b551bee`

Tree-SHA512: 9e21e7bed8aaff59b8b8aa11571396ddc265fb29608c2545b1fcdbbb36d65b37eb361db6688dd36035eab0c110f8de255375cfda50df3d9d7708bc092f67fefc
2019-10-28 15:10:06 -04:00
fanquake
dd94cc46e4
contrib: remove accounts from bash completion
Also removes setgenerate
2019-10-28 11:53:40 -04:00
MarcoFalke
cfec3e01b4
Merge #17266: util: Rename DecodeDumpTime to ParseISO8601DateTime
e7b02b54cc Add roundtrip and more tests to ParseISO8601DateTime and FormatISO8601DateTime (Elichai Turkel)
9e2c623be5 Rename DecodeDumpTime to ParseISO8601DateTime and move to time.cpp (Elichai Turkel)

Pull request description:

  As discussed in #17245.

  1. Renamed the function.
  2. Moved it from `rpcdump.cpp` to `time.cpp`.
  3. Added a check if the time is less then epoch return 0 to prevent an overflow.
  4. Added more edge cases tests and a roundtrip test.

ACKs for top commit:
  laanwj:
    ACK e7b02b54cc
  MarcoFalke:
    ACK e7b02b54cc
  promag:
    Code review ACK e7b02b54cc. Moved code is correct, left a comment regarding the test change.

Tree-SHA512: 703c21e09b2aabc992235149e67acba63d9d77a593ec8f6d2fec3eb63a7e5c406d56cbce6c6513ab32fba43367d073d2345f3b589843e3c5fe4f55ea3e00bf29
2019-10-28 10:30:51 -04:00
Russell Yanofsky
362ded410b Avoid using g_rpc_node global in wallet code
Wallet code should use interfaces::Chain and not directly access to node state.

Add a g_rpc_chain replacement global for wallet code to use, and move
g_rpc_node definition to a libbitcoin_server source file so there are link
errors if wallet code tries to access it.
2019-10-28 10:30:51 -04:00
Russell Yanofsky
8922d7f6b7 scripted-diff: Remove g_connman, g_banman globals
-BEGIN VERIFY SCRIPT-
sed -i 's:#include <interfaces/chain.h>:#include <banman.h>\n#include <interfaces/chain.h>\n#include <net.h>\n#include <net_processing.h>:' src/node/context.cpp
sed -i 's/namespace interfaces {/class BanMan;\nclass CConnman;\nclass PeerLogicValidation;\n&/' src/node/context.h
sed -i 's/std::unique_ptr<interfaces::Chain> chain/std::unique_ptr<CConnman> connman;\n    std::unique_ptr<PeerLogicValidation> peer_logic;\n    std::unique_ptr<BanMan> banman;\n    &/' src/node/context.h
sed -i '/std::unique_ptr<[^>]\+> \(g_connman\|g_banman\|peerLogic\);/d' src/banman.h src/net.h src/init.cpp
sed -i 's/g_connman/m_context.connman/g' src/interfaces/node.cpp
sed -i 's/g_banman/m_context.banman/g' src/interfaces/node.cpp
sed -i 's/g_connman/m_node.connman/g' src/interfaces/chain.cpp src/test/setup_common.cpp
sed -i 's/g_banman/m_node.banman/g' src/test/setup_common.cpp
sed -i 's/g_connman/node.connman/g' src/init.cpp src/node/transaction.cpp
sed -i 's/g_banman/node.banman/g' src/init.cpp
sed -i 's/peerLogic/node.peer_logic/g' src/init.cpp
sed -i 's/g_connman/g_rpc_node->connman/g' src/rpc/mining.cpp src/rpc/net.cpp src/rpc/rawtransaction.cpp
sed -i 's/g_banman/g_rpc_node->banman/g' src/rpc/net.cpp
sed -i 's/std::shared_ptr<CWallet> wallet =/node.context()->connman = std::move(test.m_node.connman);\n    &/' src/qt/test/wallettests.cpp
-END VERIFY SCRIPT-
2019-10-28 10:30:51 -04:00
Russell Yanofsky
e6f4f895d5 Pass NodeContext, ConnMan, BanMan references more places
So g_connman and g_banman globals can be removed next commit.
2019-10-28 10:30:51 -04:00
Russell Yanofsky
4d5448c76b MOVEONLY: Move NodeContext struct to node/context.h 2019-10-28 10:30:51 -04:00
Russell Yanofsky
301bd41a2e scripted-diff: Rename InitInterfaces to NodeContext
-BEGIN VERIFY SCRIPT-
s() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; }

s 'struct InitInterfaces'              'struct NodeContext'
s 'InitInterfaces interfaces'          'NodeContext node'
s 'InitInterfaces& interfaces'         'NodeContext\& node'
s 'InitInterfaces m_interfaces'        'NodeContext m_context'
s 'InitInterfaces\* g_rpc_interfaces'  'NodeContext* g_rpc_node'
s 'g_rpc_interfaces = &interfaces'     'g_rpc_node = \&node'
s 'g_rpc_interfaces'                   'g_rpc_node'
s 'm_interfaces'                       'm_context'
s 'interfaces\.chain'                  'node.chain'
s '\(AppInitMain\|Shutdown\|Construct\)(interfaces)' '\1(node)'
s 'init interfaces' 'chain clients'
-END VERIFY SCRIPT-
2019-10-28 10:30:51 -04:00
Adam Jonas
436ad43643 Fix issue with conflicted mempool tx in listsinceblock
listsinceblock now checks that returned transactions are not
conflicting with any transactions that are filtered out by
the given blockhash

Co-Authored-By: Michael Chrostowski <michael.chrostowski@gmail.com>
2019-10-28 10:26:46 -04:00
fanquake
1ab6c1267e
Merge #16986: doc: Doxygen-friendly CuckooCache comments
7aad3b68e7 doc: Doxygen-friendly CuckooCache comments (Jon Layton)

Pull request description:

  Similar theme to #16947.

  - `invalid`, `contains` now appear in Doxygen docs
  - `setup` refers to correct argument name `b`
  - Argument references in `code blocks `
  - Lists markdown conformant, uniform line endings

  Tested with `make docs`

ACKs for top commit:
  laanwj:
    ACK 7aad3b68e7
  practicalswift:
    ACK 7aad3b68e7

Tree-SHA512: 70b38c10e534bad9c6ffcd88cc7a4797644afba5956d47a6c7cc655fcd5857a91f315d6da60e28ce9678d420ed4a51e22267eb8b89e26002b99cad63373dd349
2019-10-28 09:26:44 -04:00
fanquake
badca85e2c
Merge #16202: p2p: Refactor network message deserialization
ed2dc5e48a Add override/final modifiers to V1TransportDeserializer (Pieter Wuille)
f342a5e61a Make resetting implicit in TransportDeserializer::Read() (Pieter Wuille)
6a91499496 Remove oversized message detection from log and interface (Pieter Wuille)
b0e10ff4df Force CNetMessage::m_recv to use std::move (Jonas Schnelli)
efecb74677 Use adapter pattern for the network deserializer (Jonas Schnelli)
1a5c656c31 Remove transport protocol knowhow from CNetMessage / net processing (Jonas Schnelli)
6294ecdb8b Refactor: split network transport deserializing from message container (Jonas Schnelli)

Pull request description:

  **This refactors the network message deserialization.**

  * It transforms the `CNetMessage` into a transport protocol agnostic message container.
  * A new class `TransportDeserializer` (unique pointer of `CNode`)  is introduced, handling the network buffer reading and the decomposing to a `CNetMessage`
  * **No behavioral changes** (in terms of disconnecting, punishing)
  * Moves the checksum finalizing into the `SocketHandler` thread (finalizing was in `ProcessMessages` before)

  The **optional last commit** makes the `TransportDeserializer` following an adapter pattern (polymorphic interface) to make it easier to later add a V2 transport protocol deserializer.

  Intentionally not touching the sending part.

  Pre-Requirement for BIP324 (v2 message transport protocol).
  Replacement for #14046 and inspired by a [comment](https://github.com/bitcoin/bitcoin/pull/14046#issuecomment-431528330) from sipa

ACKs for top commit:
  promag:
    Code review ACK ed2dc5e48a.
  marcinja:
    Code review ACK ed2dc5e48a
  ryanofsky:
    Code review ACK ed2dc5e48a. 4 cleanup commits added since last review. Unaddressed comments:
  ariard:
    Code review and tested ACK ed2dc5e.

Tree-SHA512: bab8d87464e2e8742529e488ddcdc8650f0c2025c9130913df00a0b17ecdb9a525061cbbbd0de0251b76bf75a8edb72e3ad0dbf5b79e26f2ad05d61b4e4ded6d
2019-10-28 09:15:59 -04:00
Wladimir J. van der Laan
f8cc2b967b
Merge #17267: bench: Fix negative values and zero for -evals flag
3bb0a4674f bench: Fix negative values and zero for -evals flag (nijynot)

Pull request description:

  This PR makes `bench_bitcoin -evals=0` evaluate at once and throws when `-evals` is a negative integer.

  ---

  Currently when you run `bench_bitcoin -evals=0`, it'll get stuck at
  ```
  # Benchmark, evals, iterations, total, min, max, median
  ```
  . This is not intuitively expected and should instead evaluate instantly as it's set to zero. Negative integers for `-evals` does not make sense either and should throw if set.

ACKs for top commit:
  laanwj:
    ACK 3bb0a4674f

Tree-SHA512: 03cd4c7c55134c7ffd8cdb6ee993551ce41061a73e13c3c047247af9df1fd7ed07d798272b643ec864099036922aaadbdcd2b798d710406f48df60b9d5448c26
2019-10-28 14:14:11 +01:00
Wladimir J. van der Laan
f3b51eb935 Fix occurences of c_str() used with size() to data()
Using `data()` better communicates the intent here.

Also, depending on how `c_str()` is implemented, this fixes undefined
behavior: The part of the string after the first NULL character might
have undefined contents.
2019-10-28 13:41:45 +01:00
Wladimir J. van der Laan
c72906dcc1 refactor: Remove redundant c_str() calls in formatting
Our formatter, tinyformat, *never* needs `c_str()` for strings.
Remove redundant `c_str()` calls for:

- `strprintf`
- `LogPrintf`
- `tfm::format`
2019-10-28 13:31:33 +01:00
nijynot
3bb0a4674f bench: Fix negative values and zero for -evals flag 2019-10-28 13:07:38 +01:00
Wladimir J. van der Laan
a25945318f
Merge #17250: Avoid unused call to GuessVerificationProgress in NotifyHeaderTip
fa398091b7 Avoid unused call to GuessVerificationProgress in NotifyHeaderTip (MarcoFalke)

Pull request description:

  `GuessVerificationProgress` for a header (not a block) is always 0 because the number of txs in the block can not be determined from the header alone. Anyway, this result was never used, so we can optimize this call by hardcoding 0.

  This is the next commit in a series of changes toward removing nChainTx (see #14863, #13875)

ACKs for top commit:
  promag:
    Code review ACK fa398091b7, missed that.
  laanwj:
    ACK fa398091b7

Tree-SHA512: 11016f8dbb1af1cf75241948d1ad35eac0c79d1311cd0db8c6ec806df2a9e3dc5f998dbd66ccbad5d84564e6cec7fe21ce7a2a13c2b34c746e2d3b31aa1db53a
2019-10-28 12:55:04 +01:00
Wladimir J. van der Laan
9ae468a6d5
Merge #17192: util: Add CHECK_NONFATAL and use it in src/rpc
faeb666536 util: Add CHECK_NONFATAL and use it in src/rpc (MarcoFalke)

Pull request description:

  Fixes #17181

  Currently, we use `assert` in RPC code to document logic and code assumptions. However, it seems a bit extreme to abort all of Bitcoin Core on an assert failure in one of the RPC threads. I suggest to replace all `assert`s with a macro `CHECK_NONFATAL(condition)` that throws a runtime error when the condition evaluates to `false`. That runtime error will then be returned to the rpc caller and will include instructions to report the error to our issue tracker.

ACKs for top commit:
  practicalswift:
    ACK faeb666536
  laanwj:
    ACK faeb666536
  ryanofsky:
    Code review ACK faeb666536

Tree-SHA512: 9b748715a5e0767ac11f1324a95a3a6ec672a0e0658013492219223bda83ce4b1b447fd8183bbb235f7df5ef7dddda7666ad569544b4d61cc65f232ca7a800ec
2019-10-28 12:00:36 +01:00
practicalswift
9cae3d5e94 tests: Add fuzzer initialization (hold ECCVerifyHandle) 2019-10-27 21:22:24 +00:00
Elichai Turkel
e7b02b54cc
Add roundtrip and more tests to ParseISO8601DateTime and FormatISO8601DateTime 2019-10-27 01:00:13 +03:00
Elichai Turkel
9e2c623be5
Rename DecodeDumpTime to ParseISO8601DateTime and move to time.cpp 2019-10-27 01:00:05 +03:00
Wladimir J. van der Laan
be50469217
Merge #17257: gui: disable font antialiasing for QR image address
e156b9d8b9 gui: disable font antialiasing for QR image address (fanquake)

Pull request description:

  The address text inside the QR code is currently fairly blurry / unreadable. Explicitly disabling font antialiasing improves that somewhat.

  master (693e40090a):
  ![macOS_master](https://user-images.githubusercontent.com/863730/67591414-644e0580-f72b-11e9-8399-2cd0584e7d62.png)

  PR (e156b9d8b9):
  ![macOS_pr](https://user-images.githubusercontent.com/863730/67591424-6dd76d80-f72b-11e9-86b6-b3911f8e07e6.png)

ACKs for top commit:
  laanwj:
    ACK e156b9d8b9

Tree-SHA512: 32aeb2ffe8164a1006f80e76c6e413fcb88e32ced42d2b2af69cca908bd32673f3e379184be917f1870864b940db943e7f46a7ecb0779343d5d129b381660c38
2019-10-26 13:06:18 +02:00
Wladimir J. van der Laan
9bd109b78d
Merge #17120: gui: Fix start timer from non QThread
a8f5026d6d gui: Fix start timer from non QThread (João Barbosa)

Pull request description:

  Fixes #16296.

ACKs for top commit:
  laanwj:
    code review ACK a8f5026d6d

Tree-SHA512: d7b05ac88e188de16cbbe80cb2f773b7976ee07ee876ac94a93f9351856c4f3a9d66a531d3f3748d2dccff8c8d77d9d8227433069ed5909c32be2efeaa32f655
2019-10-26 13:00:16 +02:00
Wladimir J. van der Laan
3f875744cb
Merge #17249: rpc: Add missing deque include to fix build
a592913022 http: add missing header bootlegged by boost < 1.72 (Jan Beich)

Pull request description:

  Regressed by boostorg/filesystem@9a14c37d6f. See [error log](https://github.com/bitcoin/bitcoin/files/3772177/bitcoin-0.18.1.log).

  ```c++
  httpserver.cpp:74:10: error: no template named 'deque' in namespace 'std'
      std::deque<std::unique_ptr<WorkItem>> queue;
      ~~~~~^
  ```

ACKs for top commit:
  laanwj:
    ACK a592913022

Tree-SHA512: fb0aee6a698c7aaa6a73baad7adc4f891be573af0d3cf6f4f59bc825afe5c0bc439c668077ff1990a6135522a0533a1a867430eebad28f0ade93fd79a95e179b
2019-10-26 12:05:04 +02:00
Wladimir J. van der Laan
e9f73b839a
Merge #17135: gui: Make polling in ClientModel asynchronous
6b6be41c36 gui: Make polling in ClientModel asynchronous (João Barbosa)

Pull request description:

  After #14193 `ClientModel::updateTimer` can take some time, as such the GUI hangs, like #17112.

  Fixes this by polling in a background thread and updating the GUI asynchronously.

ACKs for top commit:
  laanwj:
    ACK 6b6be41c36
  Sjors:
    Code review re-ACK 6b6be41; only replaced the scary cast with `{ timer->start(); }`

Tree-SHA512: fd98b0c6535441aee3ee03c48b58b4b1f9bdd172ec6b8150da883022f719df34cabfd4c133412bf410e7f709f7bf1e9ef16dca05ef1f3689d526ceaeee51de38
2019-10-26 11:49:51 +02:00
Wladimir J. van der Laan
d91af4768c
Merge #17165: Remove BIP70 support
8c6081a884 compat: remove bswap_* check on macOS (fanquake)
2cba35ab38 build: skip building OpenSSL lib_ssl (fanquake)
45a2d3c552 build: remove OpenSSL from Qt build (fanquake)
befbc40eb5 build: remove EVP_MD_CTX_new detection (fanquake)
fcee10c2d0 build: remove SSL lib detection (fanquake)
c7f30dbca8 gui: Update BIP70 support message (fanquake)
a3e810326d build: remove BIP70 entries from macOS Info.plist (fanquake)
72fe13a58d gui: remove payment request file handling from OpenURI dialog (fanquake)
3548e4aac7 Remove BIP70 Support (fanquake)
1cb9a4e28c docs: remove protobuf from docs (fanquake)
67328bb7ca build: remove protobuf from depends (fanquake)

Pull request description:

  This removes [BIP70](https://github.com/bitcoin/bips/blob/master/bip-0070.mediawiki) support. It also removes OpenSSL linking from Qt and building OpenSSLs `lib_ssl` in depends, as well as SSL lib detection from the build system. It's something that I'd optimistically like to do for `0.20.0`.

ACKs for top commit:
  laanwj:
    Code review ACK 8c6081a884
  MarcoFalke:
    ACK 8c6081a884
  fjahr:
    ACK 8c6081a

Tree-SHA512: 9dd9153afa4eca1a795f983e5b31f5fee9fa9a064c2a95d2f98810689add3ad0bf221c4608282299e66e4d1ec31cd556d4b16eea55de7912c3b9931f64735883
2019-10-26 11:35:45 +02:00
Andrew Chow
f201ba59ff Refactor: Split up CWallet and LegacyScriptPubKeyMan and classes
This moves CWallet members and methods dealing with keys to a new
LegacyScriptPubKeyMan class, and updates calling code to reference the new
class instead of CWallet.

Most of the changes are simple text replacements and variable substitutions
easily verified with:

    git log -p -n1 -U0 --word-diff-regex=.

The only nontrivial chunk of code added is the new LegacyScriptPubKeyMan class
declaration, but this code isn't new and is just selectively copied and moved
from the previous CWallet class declaration. This can be verified with:

    git log -p -n1 --color-moved=dimmed_zebra src/wallet/scriptpubkeyman.h src/wallet/wallet.h

or

    git diff HEAD~1:src/wallet/wallet.h HEAD:src/wallet/scriptpubkeyman.h

This commit does not change behavior.
2019-10-25 19:20:24 -04:00
Andrew Chow
6702048f91 MOVEONLY: Move key handling code out of wallet to keyman file
Start moving wallet and ismine code to scriptpubkeyman.h, scriptpubkeyman.cpp

The easiest way to review this commit is to run:

   git log -p -n1 --color-moved=dimmed_zebra

And check that everything is a move (other than includes and copyrights comments).

This commit is move-only and doesn't change code or affect behavior.
2019-10-25 19:20:24 -04:00
Andrew Chow
ab053ec6d1 Move wallet enums to walletutil.h 2019-10-25 19:20:24 -04:00
User
a552e8477c added asserts to check m_addr_known when it's used 2019-10-25 16:28:14 -04:00
fanquake
25d7e2e781
Merge #17251: net: SocketHandler logs peer id for close and disconnect
04dbdd613f [net] SocketHandler: log peer id for close and disconnect (Sjors Provoost)

Pull request description:

  When combined with `-logips` this makes it easier to diagnose disconnects.

  To test on macOS, find a connection you want to disrupt:

  ```
  lsof -nP -iTCP:8333 -sTCP:ESTABLISHED
  ```

  To shut it down gracefully you can use tcpkill or this Python script: https://github.com/google/tcp_killer

  The log should say:

  ```
  2019-10-25T13:26:55Z socket closed for peer=1
  2019-10-25T13:26:55Z disconnecting peer=1
  2019-10-25T13:26:55Z Cleared nodestate for peer=1
  ```

  To shut it down ungracefully I made a patch to the above script, adding a `-force` argument. _Careful, this may result in data corruption_. Then the log should say:

  ```
  2019-10-25T13:39:57Z socket select error Bad file descriptor (9)
  2019-10-25T13:39:57Z socket recv error for peer=0: Bad file descriptor (9)
  2019-10-25T13:39:57Z disconnecting peer=0
  2019-10-25T13:39:57Z Socket close failed: 35. Error: Bad file descriptor (9)
  2019-10-25T13:39:57Z Cleared nodestate for peer=0
  ```

ACKs for top commit:
  MarcoFalke:
    unsigned ACK 04dbdd613f
  TheBlueMatt:
    unsigned ACK 04dbdd613f LGTM!
  theuni:
    unsigned ACK 04dbdd613f.

Tree-SHA512: 415313908484f97ffe11a48b4ed6afab3ab0be660c788adb9ad975f88b69aa1cfd5ccbe5859350cdf19ef8fde191fd530fb22cef34e70638defdc9f3d761c71d
2019-10-25 15:07:58 -04:00
Sjors Provoost
04dbdd613f
[net] SocketHandler: log peer id for close and disconnect 2019-10-25 20:05:30 +02:00
fanquake
e156b9d8b9
gui: disable font antialiasing for QR image address
More info available here: https://doc.qt.io/qt-5/qfont.html#StyleStrategy-enum
2019-10-25 13:20:32 -04:00
kodslav
5710dadf9b test: fix script_p2sh_tests OP_PUSHBACK2/4 missing
Fixes commit 6b25f29a91 where opcodes where lost in translation.
2019-10-25 12:13:19 -04:00
MarcoFalke
693e40090a
Merge #17083: tests: Add fuzzing harness for various CScript related functions
dc2fdb9907 tests: Add fuzzing harness for various CScript related functions (practicalswift)

Pull request description:

  Add fuzzing harness for various `CScript` related functions.

  **Testing this PR**

  Run:

  ```
  $ CC=clang CXX=clang++ ./configure --enable-fuzz --with-sanitizers=address,fuzzer,undefined
  $ make
  $ src/test/fuzz/script
  …
  # And to to quickly verify that the relevant code regions are triggered, that the
  # fuzzing throughput seems reasonable, etc.
  $ contrib/devtools/test_fuzzing_harnesses.sh '^script$'
  ```

  `test_fuzzing_harnesses.sh` can be found in PR #17000.

Top commit has no ACKs.

Tree-SHA512: a0c5dca3b64ae177020b2ca299a29015d70755231b6bf01edbfc67c8aac90c44b1b4d57350c3aebef6e031108e6ae8e5fa0987c67707831c314f5d3090e0cee8
2019-10-25 11:05:56 -04:00
João Barbosa
6b6be41c36 gui: Make polling in ClientModel asynchronous
With this change polling runs in a different thread to prevent
disturbing the event loop.
2019-10-25 14:53:37 +01:00
MarcoFalke
fa398091b7
Avoid unused call to GuessVerificationProgress in NotifyHeaderTip 2019-10-25 09:12:15 -04:00
Jan Beich
a592913022 http: add missing header bootlegged by boost < 1.72
httpserver.cpp:74:10: error: no template named 'deque' in namespace 'std'
    std::deque<std::unique_ptr<WorkItem>> queue;
    ~~~~~^
2019-10-25 13:11:09 +00:00
fanquake
48cb468ce3
Merge #17242: refactor: Remove unused cacheSigStore from CheckInputsFromMempooAndCache
0a433fc876 [validation] Remove unused cacheSigStore from CheckInputsFromMempoolAndCache (John Newbery)

Pull request description:

  CheckInputsFromMempoolAndCache() is only called in one place, and
  cacheSigStore is set to true in that call site. Remove the argument
  entirely.

  Also improve commenting.

ACKs for top commit:
  MarcoFalke:
    unsigned ACK 0a433fc876 Comment looks good
  jamesob:
    ACK 0a433fc876
  laanwj:
    ACK 0a433fc876
  fanquake:
    ACK 0a433fc876. Checked that `CheckInputsFromMempoolAndCache` is only called once, in `MemPoolAccept::ConsensusScriptChecks`, and that `cacheSigStore` is true.

Tree-SHA512: e4b4d2550e35df55c8f8fa4c539174cc2d3728112ddb937cb2ff759d8630a01566b5ec42a70a82e33994e6586f5a457a75a59f64b15d27c65331c723cbb097af
2019-10-25 08:14:11 -04:00
Wladimir J. van der Laan
37855ec9df
Merge #17220: tests: Add unit testing for the CompressScript function
b05ec410f2 Add unit testing for the CompressScript functions (marcaiaf)

Pull request description:

  Salvaging #15104 which adds unit tests for CompressScript function in `compressor.cpp`

  Tested following cases for the CScript:
    - CKeyID
    - CScriptID
    - Uncompressed CPubKey (of size: 65)
    - Compressed CPubKey (of size: 32)

ACKs for top commit:
  theStack:
    ACK b05ec410f2

Tree-SHA512: 7e23ace39383122802dfe5f7d38190d772f5db4045a67b7a9bd4c06797a17e0cdc41d6fac92d448057eb7df50172155dc824587c16c68c79fd1a4de37b772001
2019-10-25 13:55:58 +02:00
Wladimir J. van der Laan
90ed98ae9a
Merge #17080: consensus: Explain why fCheckDuplicateInputs can not be skipped and remove it
fa92813407 consensus: Explain why fCheckDuplicateInputs can not be skipped and remove it (MarcoFalke)

Pull request description:

  As a follow up to CVE-2018-17144, this removes the unused `fCheckDuplicateInputs` parameter and explains why the test can not be disabled. Apart from protecting against a dumb accident in the future, this should document the logic in the code. There is a technical write-up that explains how the underlying coins database behaves if this test is skipped: https://bitcoincore.org/en/2018/09/20/notice/#technical-details. However, it does not explicitly mention why the test can not be skipped. I hope my code comment does that.

ACKs for top commit:
  jnewbery:
    ACK fa92813407
  amitiuttarwar:
    utACK fa92813407
  Empact:
    Code review ACK fa92813407
  promag:
    ACK fa92813407.

Tree-SHA512: fc1ef670f1a467c543b84f704b9bd8cc7a59a9f707be048bd9b4e85fe70830702aa560a880efa2c840bb43818ab44dfdc611104df04db2ddc14ff92f46bfb28e
2019-10-25 13:47:28 +02:00
Wladimir J. van der Laan
366753e46e
Merge #17231: depends: fix boost mac cross build with clang 9+
50037e97d1 depends: fix boost mac cross build with clang 9+ (Cory Fields)

Pull request description:

  The ancient "darwin-4.9.1" profile has long been used to match against clang, which prior to version 9, reported 4.9.1 as its version when invoking "clang++ -dumpversion". Presumably this was a historical compatibility quirk related to Apple's switch from gcc to clang.

  This was "fixed" in clang 9.0, so that -dumpversion reports the real version. Unfortunately that had the side-effect of breaking the (brittle) boost compiler detection.

  Move to the seemingly more-correct "clang-darwin" profile, which passes the checks and builds correctly.

  Also switch to using ar rather than libtool for archiving, as it's what the clang-darwin profile expects to be using.

  Note that because this is using a different profile, some of the final command-line arguments end up changing. Those changes look sane at a glance.

ACKs for top commit:
  fanquake:
    ACK 50037e97d1 - tested on on macOS, will wait for the gitian build.

Tree-SHA512: eac1f353513a445add6fbece7fc78dd3dbdde5e2219bfb7739b82f40bb14de449667a94d2e303d43c67d9b38e7ceb0ba5f0d8fe20b40be2017b1ca0875467c2c
2019-10-25 12:03:01 +02:00
practicalswift
dc2fdb9907 tests: Add fuzzing harness for various CScript related functions 2019-10-25 08:28:13 +00:00
MarcoFalke
fafa064d2a
ci: Remove ccache requirement on the host
ccache is only needed to create the cache dir on the host, if it didn't
already exist. The same can be achieved with mkdir, so just use that
instead.
2019-10-24 18:37:38 -04:00
MarcoFalke
fce7c75422
Merge #16851: Continue relaying transactions after they expire from mapRelay
168b781fe7 Continue relaying transactions after they expire from mapRelay (Anthony Towns)

Pull request description:

  This change allows peers to request transactions even after they've expired from mapRelay and even if they're not doing mempool requests. This is intended to allow for CPFP of old transactions -- if parent tx P wasn't relayed due to low fees, then a higher fee rate child C is relayed, peers will currently request the parent P, but we prior to this patch, we will not relay it due to it not being in mapRelay.

ACKs for top commit:
  MarcoFalke:
    re-ACK 168b781fe7 (only change is comment fixup)
  sdaftuar:
    re-ACK 168b781fe7
  sipa:
    ACK 168b781fe7

Tree-SHA512: b206666dd1450cd0a161ae55fd1a7eda2c3d226842ba27d91fe463b551fd924b65b92551b14d6786692e15cf9a9a989666550dfc980b48ab0f8d4ca305bc7762
2019-10-24 17:50:42 -04:00