Commit graph

15268 commits

Author SHA1 Message Date
MarcoFalke
faa64af960
fuzz: Add CScriptNum::getint coverage 2020-04-03 09:02:34 +08:00
MarcoFalke
dce6f3b29b
Merge #18383: refactor: Check for overflow when calculating sum of tx outputs
f65c9ad40f Check for overflow when calculating sum of outputs (Elichai Turkel)

Pull request description:

  This was reported by practicalswift here #18046
  The exact order of the if, is important, we first do `!MoneyRange(tx_out.nValue)` to make sure the amount is non-negative. and then `std::numeric_limits<CAmount>::max() - tx_out.nValue < nValueOut` checks that the addition cannot overflow (if we won't check that the amount is positive this check can also overflow! (by doing something like `max - -max`))
  and only then we make sure that the some is also valid `!MoneyRange(nValueOut + tx_out.nValue)`
  if any of these conditions fail we throw.

  the overflowing logic:
  ```
  a + b > max // we want to fail if a+b is more than the maximum -> will overflow
  b > max - a
  max - a < b
  ```

  Closes: #18046

ACKs for top commit:
  MarcoFalke:
    ACK f65c9ad40f, checked that clang with O2 produces identical binaries 💕
  practicalswift:
    ACK f65c9ad40f
  instagibbs:
    utACK f65c9ad40f
  vasild:
    ACK f65c9ad40f modulo `s/assert.h/cassert/`

Tree-SHA512: 512d6cf4762f24c41cf9a38da486b17b19c634fa3f4efbdebfe6608779e96fc3014d5d2d29adb8001e113152c0217bbd5b3900ac4edc7b8abe77f82f36209e33
2020-04-03 06:50:29 +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
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
Wladimir J. van der Laan
740614e3c3 qt: Translations update pre-branch 2020-04-01 12:49:15 +02:00
MarcoFalke
7777703958
doc: Explain new test logging 2020-03-31 17:11:47 -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
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
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
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
Jon Atack
6e0d82c55b
rpc: remove unused getbalances() code 2020-03-28 20:25:53 +01:00
MarcoFalke
6b4f182806
Merge #18444: RPC: Remove final comma for last entry of fixed-size arrays/objects in RPCResult
c34164896c Bugfix: RPC: Remove final comma for last entry of fixed-size Arrays and Objects in RPCResult (Luke Dashjr)

Pull request description:

  JSON doesn't allow a trailing comma in arrays

Top commit has no ACKs.

Tree-SHA512: 761502a05f447afc09c120f13bf23abd2aee83a7f5e5dadaf54c7e1c0c1280d83ee041ca6ca45998fb561e41b32d01067ec52a187c3bcc9d53303ea813bc212c
2020-03-28 15:13:13 -04:00
Wladimir J. van der Laan
1668c80bdc
Merge #18449: util: Remove unused itostr
faaf1cb5b9 util: Replace i64tostr with ToString (MarcoFalke)
fac96fff62 util: Remove unused itostr (MarcoFalke)

Pull request description:

  Currently unused, but if someone really needed to use a helper with this functionality in the future, they could use `ToString`.

ACKs for top commit:
  laanwj:
    ACK faaf1cb5b9
  promag:
    Code review ACK faaf1cb5b9.

Tree-SHA512: 42180c03f51d677f7b69da23c7868bdd88944335fad0752fcc307f2c3e3c69f1cc1b316ac0875bcefb9a69c5d55200d7cf66843ea4c0f0f26baf7a054b96c1bb
2020-03-28 19:26:45 +01:00
Luke Dashjr
c34164896c Bugfix: RPC: Remove final comma for last entry of fixed-size Arrays and Objects in RPCResult
JSON doesn't allow a trailing comma in Arrays/Objects
2020-03-28 17:32:28 +00:00
pierrenn
e980214bc4 serialization: prevent int overflow for big Coin::nHeight 2020-03-28 08:38:07 +09:00
Wladimir J. van der Laan
f2c416bcf5
Merge #16995: Fix gcc 9 warnings
ff9c671b11 refactor: Work around GCC 9 `-Wredundant-move` warning (Russell Yanofsky)
b837b334db net: Fail instead of truncate command name in CMessageHeader (Wladimir J. van der Laan)

Pull request description:

  Fixes all 3 from #16992 (see commits)

  - net: Fail instead of truncate command name in CMessageHeader
  - refactor: Use std::move workaround for unique_ptr upcast only when necessary

ACKs for top commit:
  practicalswift:
    ACK ff9c671b11 -- patch looks correct
  sipa:
    utACK ff9c671b11
  ryanofsky:
    Code review ACK ff9c671b11. Looks good and seems to pass travis, modulo a timeout on one build
  hebasto:
    ACK ff9c671b11, tested on Fedora 31:

Tree-SHA512: 52d8c13aaf0d56f9bc546a98d7f853eae21f7e325b202fdeb2286b19a9a0ee308634c644b039f60ad8043421e382381cbf1bce58d9f807547f928621c7d245d0
2020-03-27 20:04:46 +01:00
João Barbosa
41b0baf43c gui: Handle WalletModel::unload asynchronous
This change prevents deleting a WalletModel instance while it's
being used.
2020-03-27 15:17:35 +00:00
Russell Yanofsky
ab31b9d6fe Fix wallet unload race condition
Currently it's possible for ReleaseWallet to delete the CWallet pointer while
it is processing BlockConnected, etc chain notifications.

To fix this, unregister from notifications earlier in UnloadWallet instead of
ReleaseWallet, and use a new RegisterSharedValidationInterface function to
prevent the CValidationInterface shared_ptr from being deleted until the last
notification is actually finished.
2020-03-27 15:17:35 +00:00
MarcoFalke
faaf1cb5b9
util: Replace i64tostr with ToString 2020-03-27 10:14:08 -04:00
MarcoFalke
fac96fff62
util: Remove unused itostr 2020-03-27 08:59:06 -04:00
fanquake
7eed413e72
Merge #18398: rpc: fix broken RPCExamples for waitforblock(height)
ef35604c9c rpc: fix broken RPCExamples for waitforblock(height) (Sebastian Falbesoner)

Pull request description:

  This PR fixes several broken RPCExamples from the "blockchain" category:
  - `HelpExampleCli` for `waitforblock` (disturbing comma between arguments)
  - `HelpExampleCli` for `waitforblockheight` (disturbing comma between arguments)
  - `HelpExampleRpc` for `waitforblockheight` (disturbing quotation marks around integer argument)

  Note that the CLI example for `waitforblockheight` would also work with the first argument in quotation marks (in contrast to the RPC example), but I removed them as well as they are not needed.

  Outputs for the non-working examples in the master branch:
  ```
  $ ./bitcoin-cli waitforblock "0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862", 1000
  error code: -8
  error message:
  blockhash must be of length 64 (not 65, for '0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862,')
  ```

  ```
  $ ./bitcoin-cli waitforblockheight "100", 1000
  error: Error parsing JSON:100,
  ```

  ```
  $ curl --user __cookie__ --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "waitforblockheight", "params": ["100", 1000]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
  Enter host password for user '__cookie__':
  {"result":null,"error":{"code":-1,"message":"JSON value is not an integer as expected"},"id":"curltest"}
  ```

  Outputs for the fixed examples in the PR branch:
  ```
  $ ./bitcoin-cli waitforblock "0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862" 1000
  {
    "hash": "0000000000000000000910ae4d56120e0ddd55c0552e80ed12dba147abc68080",
    "height": 622416
  }
  ```

  ```
  $ ./bitcoin-cli waitforblockheight 100 1000
  {
    "hash": "0000000000000000000910ae4d56120e0ddd55c0552e80ed12dba147abc68080",
    "height": 622416
  }
  ```

  ```
  $ curl --user __cookie__ --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "waitforblockheight", "params": [100, 1000]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
  Enter host password for user '__cookie__':
  {"result":{"hash":"0000000000000000000910ae4d56120e0ddd55c0552e80ed12dba147abc68080","height":622416},"error":null,"id":"curltest"}
  ```

ACKs for top commit:
  fanquake:
    ACK ef35604c9c

Tree-SHA512: b98c6681d1aa24b3ee3ef4ef450cb630082a9f8695af18f3b6d418e5b0b1e472b787ccf6397cd719b4d5fe0082ea5f1d0ca553c1cc56066ee2d288be34c601e3
2020-03-27 15:24:11 +08:00
Wladimir J. van der Laan
b53af72b82
Merge #18416: util: Limit decimal range of numbers ParseScript accepts
9ab14e4d21 Limit decimal range of numbers ParseScript accepts (pierrenn)

Pull request description:

  Following up on this suggestion : https://github.com/bitcoin/bitcoin/pull/18413#issuecomment-602966490, prevent the output of `atoi64` in the `core_read.cpp:ParseScript` helper to send to `CScriptNum::serialize` values wider than 32-bit.

  Since the `ParseScript` helper is only used by the tool defined in `bitcoin-tx.cpp`, this only prevents users to provide too much unrealistic values.

ACKs for top commit:
  laanwj:
    ACK 9ab14e4d21

Tree-SHA512: ee228269d19d04e8fee0aa7c0ae2bb0a2b437b8e574356e8d9b2279318242057d51fcf39a842aa3afe27408d0f2d5276df245d07a3f4828644a366f80587b666
2020-03-27 08:02:51 +01:00
pierrenn
9ab14e4d21 Limit decimal range of numbers ParseScript accepts 2020-03-27 15:51:05 +09:00
fanquake
54646167db
Merge #18388: Make VerifyWitnessProgram use a Span stack
2b0fcff7f2 Make VerifyWitnessProgram use a Span stack (Pieter Wuille)

Pull request description:

  Here is a follow-up to #18002, again with the goal of simplifying (potential) BIP341 code.

  Instead of passing a begin and end iterator of the initial stack to `ExecuteWitnessScript`, they are turned into a `Span<const valtype>`, representing a span of `valtype`s in memory. This allows `VerifyWitnessProgram` to operate on that span directly, instead of juggling iterators around (which would be exacerbated by #17977 if trying to avoid copying the stack).

ACKs for top commit:
  ajtowns:
    ACK 2b0fcff7f2
  elichai:
    ReACK on the diff 2b0fcff7f2
  instagibbs:
    re-ACK 2b0fcff7f2
  theStack:
    re-ACK 2b0fcff7f2
  Empact:
    ACK 2b0fcff7f2
  jnewbery:
    utACK 2b0fcff7f2

Tree-SHA512: 38eb4ce17f1947674c1c274caa40feb6ea8266bd96134d9cf1bc41e6fbf1114d4dde6c7a9e26e1ca8f3d0155429ef0911cc8ec0c1037d8fe7d6ec7f9e7184e93
2020-03-27 14:49:50 +08:00
MarcoFalke
e3154aacf4
Merge #18445: tests: Add fuzzing harnesses for functions/classes in chain.h and protocol.h
7834c3b9ec tests: Add fuzzing harness for functions/classes in chain.h (practicalswift)
d7930c4326 tests: Add fuzzing harness for functions/classes in protocol.h (practicalswift)

Pull request description:

  Add fuzzing harnesses for functions/classes in `chain.h` and `protocol.h`.

Top commit has no ACKs.

Tree-SHA512: ac2d66bc678ebba0ffbbc42e77806eaf3bb07413ff19219c7a83b171ccd4601e0aa8546ee7ffe8018ca4de12d080f79f693d184cc337c234cde641803279f00c
2020-03-26 20:37:48 -04:00
MarcoFalke
0dc6218c79
Merge #18270: util: Fail to parse whitespace-only strings in ParseMoney(...) (instead of parsing as zero)
100213c5c2 util: Fail to parse space-only strings in ParseMoney(...) (instead of parsing as zero) (practicalswift)

Pull request description:

  Fail to parse whitespace-only strings in `ParseMoney(...)` (instead of parsing as `0`).

  This is a follow-up to #18225 ("util: Fail to parse empty string in `ParseMoney`") which made `ParseMoney("")` fail instead of parsing as `0`.

  Context: https://github.com/bitcoin/bitcoin/pull/18225#issuecomment-592994765

  Current non-test call sites:

  ```
  $ git grep ParseMoney ":(exclude)src/test/"
  src/bitcoin-tx.cpp:    if (!ParseMoney(strValue, value))
  src/init.cpp:        if (!ParseMoney(gArgs.GetArg("-incrementalrelayfee", ""), n))
  src/init.cpp:        if (!ParseMoney(gArgs.GetArg("-minrelaytxfee", ""), n)) {
  src/init.cpp:        if (!ParseMoney(gArgs.GetArg("-blockmintxfee", ""), n))
  src/init.cpp:        if (!ParseMoney(gArgs.GetArg("-dustrelayfee", ""), n))
  src/miner.cpp:    if (gArgs.IsArgSet("-blockmintxfee") && ParseMoney(gArgs.GetArg("-blockmintxfee", ""), n)) {
  src/util/moneystr.cpp:bool ParseMoney(const std::string& str, CAmount& nRet)
  src/util/moneystr.h:NODISCARD bool ParseMoney(const std::string& str, CAmount& nRet);
  src/wallet/wallet.cpp:        if (!ParseMoney(gArgs.GetArg("-mintxfee", ""), n) || 0 == n) {
  src/wallet/wallet.cpp:        if (!ParseMoney(gArgs.GetArg("-fallbackfee", ""), nFeePerK)) {
  src/wallet/wallet.cpp:        if (!ParseMoney(gArgs.GetArg("-discardfee", ""), nFeePerK)) {
  src/wallet/wallet.cpp:        if (!ParseMoney(gArgs.GetArg("-paytxfee", ""), nFeePerK)) {
  src/wallet/wallet.cpp:        if (!ParseMoney(gArgs.GetArg("-maxtxfee", ""), nMaxFee)) {
  ```

ACKs for top commit:
  Empact:
    ACK 100213c5c2
  sipa:
    ACK 100213c5c2
  theStack:
    ACK 100213c5c2

Tree-SHA512: cadfb1ac8276cf54736c3444705f2650e7a08023673aedc729fabe751ae80f6c490fc0945ee38dbfd02c95e4d9853d1e4c84f5d3c310f44eaf3585afec8a4c22
2020-03-26 20:25:55 -04:00
practicalswift
7834c3b9ec tests: Add fuzzing harness for functions/classes in chain.h 2020-03-26 21:21:34 +00:00
practicalswift
d7930c4326 tests: Add fuzzing harness for functions/classes in protocol.h 2020-03-26 21:21:34 +00:00
Wladimir J. van der Laan
694f4cbd78
Merge #18312: wallet: remove deprecated fee bumping by totalFee
c3857c5fcb wallet: remove CreateTotalBumpTransaction() (Jon Atack)
4a0b27bb01 wallet: remove totalfee from createBumpTransaction() (Jon Atack)
e347cfa9a7 rpc: remove deprecated totalFee arg from RPC bumpfee (Jon Atack)
bd05f96d79 test: delete wallet_bumpfee_totalfee_deprecation.py (Jon Atack)
a6d1ab8caa test: update bumpfee testing from totalFee to fee_rate (Jon Atack)

Pull request description:

  Since 0.19, fee-bumping using `totalFee` was deprecated in #15996 and replaced by `fee_rate` in #16727. This changeset removes it.

ACKs for top commit:
  laanwj:
    ACK c3857c5fcb

Tree-SHA512: c1bb15d664baf4d2dea06981f36384af02057d125c51fcbc8640b9d5563532187c7b84aa952f7b575255a88ce383ed4d7495bec920a47b05b6fc0d432dce1f00
2020-03-26 18:34:49 +01:00
Jon Atack
c3857c5fcb
wallet: remove CreateTotalBumpTransaction() 2020-03-26 17:54:23 +01:00
Jon Atack
4a0b27bb01
wallet: remove totalfee from createBumpTransaction() 2020-03-26 17:54:21 +01:00
Jon Atack
e347cfa9a7
rpc: remove deprecated totalFee arg from RPC bumpfee 2020-03-26 17:54:18 +01:00
MarcoFalke
94d3063c93
Merge #18412: script: fix SCRIPT_ERR_SIG_PUSHONLY error string
41ff4992e5 script: fix SCRIPT_ERR_SIG_PUSHONLY error string (Sebastian Falbesoner)

Pull request description:

  Fixes #18411, changing the error message from `"Only non-push operators allowed in signatures"` to `"Only push operators allowed in signatures"`.

ACKs for top commit:
  laanwj:
    ACK 41ff4992e5

Tree-SHA512: 3b75d83e2198d638d599ef6a4a8da986f0158600fe3f89f55b3759554588157acf2b0cba3f6a907164617264e7aee727d6d460b510c8b37ca7728aa79e11ad80
2020-03-26 12:34:27 -04:00
Wladimir J. van der Laan
23991ee53a
Merge #15600: lockedpool: When possible, use madvise to avoid including sensitive information in core dumps
d831831822 lockedpool: When possible, use madvise to avoid including sensitive information in core dumps (Luke Dashjr)

Pull request description:

  If we're mlocking something, it's because it's sensitive information. Therefore, don't include it in core dump files, ~~and unmap it from forked processes~~.

  The return value is not checked because the madvise calls might fail on older kernels as a rule (unsure).

ACKs for top commit:
  practicalswift:
    Code review ACK d831831822 -- patch looks correct
  laanwj:
    ACK d831831822
  jonatack:
    ACK d831831822
  vasild:
    ACK d831831822

Tree-SHA512: 9a6c1fef126a4bbee0698bfed5a01233460fbcc86380d984e80dfbdfbed3744fef74527a8e3439ea226167992cff9d3ffa8f2d4dbd5ae96ebe0c12f3eee0eb9e
2020-03-26 16:56:03 +01:00
fanquake
e99ca783cd
Merge #18429: build: remove double LIBBITCOIN_SERVER from bench-Makefile
1f97b69ba2 build: remove double LIBBITCOIN_SERVER from bench-Makefile (Harris)

Pull request description:

  This PR removes the redundant **LIBBITCOIN_SERVER** linking from bench's Makefile.
  This PR is similar to https://github.com/bitcoin/bitcoin/pull/17910

  Originally, this PR was part of https://github.com/bitcoin/bitcoin/pull/18377, which later got replaced by a better one https://github.com/bitcoin/bitcoin/pull/18397 written by **hebasto**.

ACKs for top commit:
  Empact:
    Code Review ACK 1f97b69ba2
  theStack:
    ACK 1f97b69ba2
  hebasto:
    ACK 1f97b69ba2

Tree-SHA512: e43035262361d4458a7dcfc920445540f19301387814cde1be0539c936fc20da0dcbe49e5ea25385e6d36d9639515b7a4171228223da568d93427e9c32810945
2020-03-26 17:20:28 +08:00
fanquake
d8ce27ff9f
Merge #18397: build: Fix libevent linking for bench_bitcoin binary
cd04286825 build: Fix typo in EVENT_CFLAGS variable (Hennadii Stepanov)
f709ad0c90 build: Fix libevent linking for bench_bitcoin binary (Hennadii Stepanov)

Pull request description:

  This change fixes `libevent` linking error for the `bench_bitcoin` binary.

  This PR is an alternative to #18377.
  Fix #18373.

  Also fixed a typo in `EVENT_CFLAGS` variable noted by **brakmic**.

ACKs for top commit:
  fanquake:
    ACK cd04286825

Tree-SHA512: a62f7457e86b11d3a55d603ea5d83f3a413792e2f28a0c72300e54d12591bd6f0acc1d76a4bd4b591e0223bc6d530e7a4b9a8b939fe2fdbf2dddfda5b1b537be
2020-03-26 16:22:24 +08:00