Commit graph

12769 commits

Author SHA1 Message Date
MarcoFalke 11e1ac3ae0
Merge #14436: doc: add comment explaining recentRejects-DoS behavior
b191c7dfb7 doc: add comment explaining recentRejects-DoS behavior (James O'Beirne)

Pull request description:

  When we receive invalid txs for the first time, we mark the sender as
  misbehaving. If we receive the same tx before a new block is seen, we *don't*
  punish the second sender (in the same way we do the original sender). It wasn't
  initially clear to me that this is intentional, so add a clarifying comment.

Tree-SHA512: d12c674db137ed3ad83e0b941bffe6ddcd2982238048742afa574a4235881f0e58cfc0a4a576a0503e74c5c5240c270b9520fa30221e8b43a371fb3e0b37066b
2018-11-07 14:59:35 -05:00
Gregory Sanders 7afddfa8ce importmulti: Don't add internal addresses to address book 2018-11-07 14:43:14 -05:00
MarcoFalke fa4da3c058
[doc] conf: Remove deprecated options from docs, Other cleanup
* conf: Remove deprecated options from docs
* Remove only mention of MIT/X11
* Link to developer notes in README.md
2018-11-07 13:30:03 -05:00
MarcoFalke e8d490f27e
Merge #14636: Avoid using numeric_limits for sequence numbers and lock times
535203075e Avoid using numeric_limits for sequence numbers and lock times (Russell Yanofsky)
bafb921507 Remove duplicated code (Hennadii Stepanov)
e4dc39b3bc Replace platform dependent type with proper const (Hennadii Stepanov)

Pull request description:

  Switches to named constants, because numeric_limits calls can be harder to read and less portable.

  Change was suggested by jamesob in https://github.com/bitcoin/bitcoin/pull/10973#discussion_r213473620

  There are no changes in behavior except on some platforms we don't support (ILP64, IP16L32, I16LP32), where `SignalsOptInRBF` and `MutateTxAddInput` functions would now work correctly.

Tree-SHA512: 3f5c6393c260551f65a0edfba55ef7eb3625232eec8d85b1457f26e144aa0b90c7ef5f44b2fd2f7d9be3c3bcb301030a9f5473c21b3bac566cc59b8c8780737c
2018-11-07 11:15:22 -05:00
Jim Posen c30620983d blockfilter: Additional constructors for BlockFilter. 2018-11-06 09:12:54 -08:00
Jim Posen 20b812993a blockfilter: Refactor GCS params into struct. 2018-11-06 09:12:54 -08:00
practicalswift 587924f000 Use IsSpace(...) instead of boost::is_space 2018-11-06 17:32:13 +01:00
practicalswift c5fd143edb Use ToLower(...) instead of std::tolower 2018-11-06 17:32:13 +01:00
practicalswift e70cc8983c Use IsDigit(...) instead of std::isdigit 2018-11-06 17:32:08 +01:00
Russell Yanofsky 081accb875 Pass chain locked variables where needed
This commit does not change behavior. All it does is pass new function
parameters.

It is easiest to review this change with:

    git log -p -n1 -U0 --word-diff-regex=.
2018-11-06 11:44:40 -04:00
Russell Yanofsky 79d579f4e1 Remove uses of cs_main in wallet code
This commit does not change behavior.

It is easiest to review this change with:

    git log -p -n1 -U0
2018-11-06 11:44:40 -04:00
Russell Yanofsky ea961c3d72 Remove direct node->wallet calls in init.cpp
Route calls during node initialization and shutdown that would happen between a
node process and wallet processes through the serializable `Chain::Client`
interface, rather than `WalletInitInterface` which is now simpler and only
deals with early initialization and parameter interaction.

This commit mostly does not change behavior. The only change is that the
"Wallet disabled!" and "No wallet support compiled in!" messages are now logged
earlier during startup.
2018-11-06 11:44:40 -04:00
Russell Yanofsky 8db11dd0b1 Pass chain and client variables where needed
This commit does not change behavior. All it does is pass new function
parameters.

It is easiest to review this change with:

    git log -p -n1 -U0 --word-diff-regex=.
2018-11-06 11:44:40 -04:00
Russell Yanofsky 7e2e62cf7c Add skeleton chain and client classes
This commit does not change behavior. It just adds new skeleton classes that
don't do anything and aren't instantiated yet.
2018-11-06 11:44:40 -04:00
Wladimir J. van der Laan 880bc728b4
Merge #14074: Use std::unordered_set instead of set in blockfilter interface
fef5adcc33 blockfilter: Use unordered_set instead of set in blockfilter. (Jim Posen)
4fb789e9b2 Extract CSipHasher to it's own file in crypto/ directory. (Jim Posen)

Pull request description:

  Use `std::unordered_set` (hash set) instead of `std::set` (tree set) in blockfilter interface, as suggested by @ryanofsky in #12254. This may result in a very minor speedup, but I haven't measured.

  This moves `CSipHasher` to it's own file `crypto/siphash.h`, so that it can be used in the libbitcoin_util library without including `hash.{h,cpp}`. I'm open to other suggestions on solving this issue if people would prefer to leave CSipHasher where it is.

Tree-SHA512: 593d1abda771e45f2860d5334272980d20df0b81925a402bb9ee875e17595c2517c0d8ac9c579218b84bbf66e15b49418241c1fe9f9265719bcd2377b0cd0d88
2018-11-06 15:36:20 +01:00
Chun Kuan Lee 15c93f075a wallet: Add trailing wallet.dat when detecting duplicate wallet if it's a directory. 2018-11-06 08:28:02 +08:00
Russell Yanofsky c456fbd8df Refactor: Move m_db pointers into BerkeleyDatabase
This is a refactoring change that doesn't affect behavior. The motivation
behind the change is give BerkeleyEnvironment objects access to
BerkeleyDatabase objects so it will be possible to simplify the duplicate
wallet check and more reliably avoid opening the same databases twice.
2018-11-06 08:28:02 +08:00
MeshCollider 13fe258e91 Error if rpcpassword in conf contains a hash character 2018-11-06 12:35:07 +13:00
Jim Posen fef5adcc33 blockfilter: Use unordered_set instead of set in blockfilter. 2018-11-05 09:30:56 -08:00
Jim Posen 4fb789e9b2 Extract CSipHasher to it's own file in crypto/ directory.
This is a move-only commit with the exception of changes to includes.
2018-11-05 09:25:15 -08:00
practicalswift 9cc0230cfc Add NODISCARD to all {Decode,Parse}[...](...) functions returning bool. Sort includes. 2018-11-05 17:03:11 +01:00
practicalswift 579497e77a tests: Explicitly ignore the return value of DecodeBase58(...) 2018-11-05 16:52:59 +01:00
practicalswift 145fe95ec7 tests: Check return value of ParseParameters(...) 2018-11-05 16:52:59 +01:00
practicalswift 7c5bc2a523 miner: Default to DEFAULT_BLOCK_MIN_TX_FEE if unable to parse -blockmintxfee 2018-11-05 16:52:59 +01:00
ken2812221 b6022149ec
trivial: Don't translate in help text 2018-11-05 23:23:28 +08:00
MarcoFalke 73a8408bc3
Merge #14092: tests: Dry run bench_bitcoin as part "make check" to allow for quick identification of assertion/sanitizer failures in benchmarking code
dfef0df840 tests: Dry run bench_bitcoin (-evals=1 -scaling=0: <1 second running time) as part "make check" to allow for quick identification of assertion/sanitizer failures in benchmarking code (practicalswift)
00c6306a61 Remove RUN_BENCH logic (practicalswift)

Pull request description:

  Dry run `bench_bitcoin` (`-evals=1 -scaling=0`: <1 second running time) as part `make check` to allow for quick identification of assertion/sanitizer failures or crashes in benchmarking code.

  This is already tested in Travis but it is nice to have it locally too. The cost is near zero.

Tree-SHA512: 1f51b86b34bf97f75785f2694891d80f1bfb3e050211e6f6c35d8d9bc80c75bdebaa5ebfa51855ac0cf76d8773c3026bc576f60d0227afb0e646d728b83abde7
2018-11-05 09:31:01 -05:00
Wladimir J. van der Laan dac2caa371
Merge #14060: ZMQ: add options to configure outbound message high water mark, aka SNDHWM
a4edb168b6 ZMQ: add options to configure outbound message high water mark, aka SNDHWM (mruddy)

Pull request description:

  ZMQ: add options to configure outbound message high water mark, aka SNDHWM

  This is my attempt at https://github.com/bitcoin/bitcoin/pull/13315

Tree-SHA512: a4cc3bcf179776899261a97c8c4f31f35d1d8950fd71a09a79c5c064879b38e600b26824c89c4091d941502ed5b0255390882f7d44baf9e6dc49d685a86e8edb
2018-11-05 13:45:41 +01:00
practicalswift ab8c6f24d2 Add SAFE_CHARS[SAFE_CHARS_URI]: Chars allowed in URIs (RFC 3986) 2018-11-05 13:27:04 +01:00
practicalswift 991248649b rpc: Make HTTP RPC debug logging more informative 2018-11-05 13:27:02 +01:00
Wladimir J. van der Laan 15a219ff8e
Merge #14628: Trivial: Rename misleading 'defaultPort' to 'rpc_port'
4ed730802f scripted-diff: Rename misleading 'defaultPort' to 'http_port' (Murray Nesbitt)

Pull request description:

  `defaultPort` in `HTTPBindAddresses()` is misleadingly named. `defaultPort ` suggests a constant, not something that might be overridden by `-rpcport`.

Tree-SHA512: f6ae8bdc2b4a4f503e44df9efdec32c854d2dede87714399f53791d50cce6bc41c46b01d1583cfc0e3e4777c244e1c74443fa39d9da50a45e53af265b74a17d1
2018-11-05 13:18:35 +01:00
Wladimir J. van der Laan 46eb2755d4
Merge #14350: Add WalletLocation class
65f3672f3b wallet: Refactor to use WalletLocation (João Barbosa)
01a4c095c8 wallet: Add WalletLocation utility class (João Barbosa)

Pull request description:

  Advantages of this change:
   - avoid resolving wallet absolute path and name repetitively and in multiple places;
   - avoid calling `GetWalletDir` in multiple places;
   - extract these details from the actual wallet implementation.

  The `WalletLocation` class can be a way to represent a wallet not yet loaded that exists in the wallet directory.

Tree-SHA512: 71ec09786e038499710e7acafe92d66ab9883fc894964e267443ae9c10a6872a10995c3987a169c436a4e793dae96b28fb97bd7f78483c4b72ac930fa23f8686
2018-11-05 13:17:03 +01:00
Murray Nesbitt 4ed730802f scripted-diff: Rename misleading 'defaultPort' to 'http_port'
-BEGIN VERIFY SCRIPT-
sed -i -e 's/\<defaultPort\>/http_port/g' src/httpserver.cpp
-END VERIFY SCRIPT-
2018-11-05 04:01:47 -08:00
Wladimir J. van der Laan 69d574ac6c
Merge #14554: qt: Remove unused adjustedTime parameter
04972fefd1 Remove unused `adjustedTime` parameter (Hennadii Stepanov)

Pull request description:

  After merging #13622 the `adjustedTime` parameter in the `updateStatus` function is unused.

Tree-SHA512: 1d0e03e7343f076ee0032fb721f8ba50571d579958001aab372a43e45b4de24c2bf3bd18c245071cbd69f61ef38182e19666c6f936d55c9085b73c848ba62626
2018-11-05 12:50:11 +01:00
Hennadii Stepanov 60ae463a68
Fix bitcoin-qt -version output formatting 2018-11-05 13:37:48 +02:00
João Barbosa 0a656f85a9 qt: All tray menu actions call showNormalIfMinimized 2018-11-05 11:21:50 +00:00
João Barbosa 6fc21aca6d qt: Use GUIUtil::bringToFront where possible 2018-11-05 11:21:50 +00:00
João Barbosa 5796671e1d qt: Add GUIUtil::bringToFront 2018-11-05 11:21:50 +00:00
Wladimir J. van der Laan bccb4d29a8
Merge #14555: Move util files to directory
2068f089c8 scripted-diff: Move util files to separate directory. (Jim Posen)

Pull request description:

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

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

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

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

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

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

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

Pull request description:

  Implementation of proposal in #14396.

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

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

According to the Apple's docs `class_replaceMethod` behaves as
`class_addMethod`, if the method identified by name does not yet exist;
or as `method_setImplementation`, if it does exist.
2018-11-04 02:37:28 +02:00
Glenn Willen 565500508a Refactor PSBTInput signing to enforce invariant
Refactor the process of PSBTInput signing to enforce the invariant that
a PSBTInput always has _either_ a witness_utxo or a non_witness_utxo,
never both.

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

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

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

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

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

Also improve a related comment.
2018-11-01 12:11:24 -07:00
Glenn Willen 65166d4cf8 New PartiallySignedTransaction constructor from CTransction
New constructor that creates a PartiallySignedTransaction from a
CTransaction, automatically sizing the inputs and outputs vectors for
convenience.
2018-11-01 12:11:24 -07:00
Glenn Willen 4f3f5cb4b1 Remove redundant txConst parameter to FillPSBT 2018-11-01 12:11:24 -07:00
Glenn Willen fe5d22bc67 More concise conversion of CDataStream to string
Use .str() instead of .data() and .size() when converting CDataStream to
a string. Uses std::string, avoiding conversion to a C string.
2018-11-01 12:11:24 -07:00
Russell Yanofsky 535203075e Avoid using numeric_limits for sequence numbers and lock times
Switches to named constants, because numeric_limits calls can be harder to read
and less portable.

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

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

Pull request description:

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

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

Tree-SHA512: 50c0c08e201ba02494b369a4d36ddb73e6634eb5a4e4e201c4ef38fd2dbeea2c642b8a04d50c91615da61ecbfade37309e47431368f4b1064539c42015766b50
2018-11-01 17:55:39 +01:00
Hennadii Stepanov bafb921507 Remove duplicated code
The deleted LOC is a dup so far as
`std::numeric_limits<unsigned int>::min()` == 0
2018-11-01 19:55:39 +03:00
Hennadii Stepanov e4dc39b3bc Replace platform dependent type with proper const 2018-11-01 19:55:39 +03:00
Alexey Ivanov 1e0f3c4499
macOS: disable AppNap during sync
Signed-off-by: Alexey Ivanov <alexey.ivanes@gmail.com>
2018-11-01 18:22:06 +03:00
Wladimir J. van der Laan f6df989842
Merge #14197: [psbt] Convert non-witness UTXOs to witness if witness sig created
862d159d63 Add test for conversion from non-witness to witness UTXO (Pieter Wuille)
f8c1714634 Convert non-witness UTXOs to witness if witness sig created (Andrew Chow)

Pull request description:

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

  Port of #14196 to master.

Tree-SHA512: 2235eeb008ffa48e821628032d689e4a83bff6c29b93fa050ab2ee492b0e67b3a30f29a680d4a0e574e05c3a2f9edf0005e161fbe25b7aef2acd034a2424e2f2
2018-11-01 16:09:38 +01:00
Hennadii Stepanov 53bb6be3f8
Remove obj_c for macOS Dock icon setting
Qt `setWindowIcon()` does this work.
2018-10-31 20:29:08 +02:00
Wladimir J. van der Laan b312579c69
Merge #14454: Add SegWit support to importmulti
c11875c590 Add segwit address tests for importmulti (MeshCollider)
201451b1ca Make getaddressinfo return solvability (MeshCollider)
1753d217ea Add release notes for importmulti segwit change (MeshCollider)
353c064596 Fix typo in test_framework/blocktools (MeshCollider)
f6ed748cf0 Add SegWit support to importmulti with some ProcessImport cleanup (MeshCollider)

Pull request description:

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

  Also includes some tests for the various import types.

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

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

Tree-SHA512: 775a755c524d1c387a99acddd772f677d2073876b72403dcfb92c59f9b405ae13ceedcf4dbd2ee1d7a8db91c494f67ca137161032ee3a2071282eeb411be090a
2018-10-31 17:44:31 +01:00
Hennadii Stepanov a16f44c040
qt: Remove "Pay only required fee" checkbox
The custom fee input box now has a minimum value equal to the minimum
required fee. Before a value below the minimum fee could be entered
which was confusing since the minimum fee would still be paid even
though a lower amount was entered.
2018-10-30 16:31:57 +02:00
Hennadii Stepanov 8711cc0c78
qt: Improve BitcoinAmountField class
This adds functions for specifing a min/max value for a
BitcoinAmountField. These options only affect user input, so it's still
possible to use setValue to set values outside of the min/max range. The
existing value will not be changed when calling these functions even if
it's out of range. The min/max range will be reinforced when the field
loses focus.
This also adds `SetAllowEmpty` function which specifies if the field is
allowed to be left empty by the user. If set to false the field will be
set to the minimum allowed value if it's empty when focus is lost.
2018-10-30 14:58:25 +02:00
Luke Dashjr d8bf1071cf Bugfix: RPC: Add address_type named param for createmultisig 2018-10-28 22:42:36 +00:00
MarcoFalke f1e2f2a859
Merge #14585: refactor: remove usage of locale dependent std::isspace
15db77f4dd Don't rely on locale dependent functions in base_blob<BITS>::SetHex(...) (uint256), DecodeBase58(...), ParseMoney(...) and ParseHex(...) (practicalswift)

Pull request description:

  Don't rely on locale dependent function `std::isspace` in `base_blob<BITS>::SetHex(...)` (uint256), `DecodeBase58(...)`, `ParseMoney(...)` and `ParseHex(...)`.

  Rationale:

  ```
  $ uname -s
  Darwin
  $ cat poc.cpp
  #include <iostream>
  #include <locale>

  int main(void) {
      setlocale(LC_ALL, "");
      std::cout << std::isspace(133) << ' ' << std::isspace(154) << ' ' << std::isspace(160);
      std::cout << '\n';
  }
  $ clang++ -o poc poc.cpp
  $ ./poc
  1 0 1
  $ LC_ALL=en_US ./poc
  1 0 1
  $ LC_ALL=C ./poc
  0 0 0
  $ LC_ALL=ru_RU.KOI8-R ./poc # an "interesting" locale
  0 1 0
  ```

Tree-SHA512: 4eafb267342b8a777da6cca07c353afd1f90f3fc1d91e01f526f1b384a2b97c1da25b7bd7dfc300655182a4eaec6a4bea855a45723ab53c750a734b60e1e3c9f
2018-10-28 06:49:07 -04:00
Hennadii Stepanov 04972fefd1
Remove unused adjustedTime parameter
qt: After merging #13622 the `adjustedTime` is not used any more in
wallet related functions.
2018-10-28 09:04:10 +02:00
MarcoFalke efaf2d85e3
Merge #13783: validation: Pass tx pool reference into CheckSequenceLocks
fa511e8dad Pass tx pool reference into CheckSequenceLocks (MarcoFalke)

Pull request description:

  `CheckSequenceLocks` is called from ATMP and the member function `CTxMemPool::removeForReorg` without passing in the tx pool object that is used in those function's scope and instead using the global `::mempool` instance.

  This fix should be refactoring only, since currently there is only one (global) tx pool in normal operation. Though, it fixes hard to track down issues in future settings where more than one mempool exists at a time. (E.g. for tests, rpc or p2p tx relay purposes)

Tree-SHA512: f0804588c7d29bb6ff05ec14f22a16422b89ab31ae714f38cd07f811d7dc7907bfd14e799c4c1c3121144ff22711019bbe9212b39e2fd4531936a4119950fa49
2018-10-27 10:39:44 -04:00
practicalswift 15db77f4dd Don't rely on locale dependent functions in base_blob<BITS>::SetHex(...) (uint256), DecodeBase58(...), ParseMoney(...) and ParseHex(...) 2018-10-26 19:42:58 +02:00
Pieter Wuille 9b2a25b13f Add tests for InferDescriptor and Descriptor::IsSolvable 2018-10-26 10:21:05 -07:00
Pieter Wuille 225bf3e3b0 Add Descriptor::IsSolvable() to distinguish addr/raw from others 2018-10-26 10:21:05 -07:00
Pieter Wuille 4d78bd93b5 Add support for inferring descriptors from scripts 2018-10-26 10:21:05 -07:00
MarcoFalke ae85c8d28b
Merge #14568: build: Fix Qt link order for Windows build
fbaccbf00c build: Fix Qt link order for Windows build (Chun Kuan Lee)

Pull request description:

  See https://github.com/bitcoin/bitcoin/pull/14451#issuecomment-432874893

Tree-SHA512: 819e68dc750297a74d04aa1ad3dae64072b66df718d36b950bd9430c9fca1771c611af934df23954f81b83bd89f96ea76c20cbf17db1364b988a6c34c43fb631
2018-10-26 07:46:31 -04:00
Wladimir J. van der Laan d50c996a14
Merge #14561: Remove fs::relative call and fix listwalletdir tests
ed2e18398b Remove fs::relative call and fix listwalletdir tests (João Barbosa)

Pull request description:

  The implementation of `fs::relative` resolves symlinks which is not intended
  in ListWalletDir. The replacement does what is required, and `listwalletdir` RPC
  tests are fixed accordingly.

  Also, `fs::recursive_directory_iterator` iteration is fixed to build with boost 1.47.

  Based on #14559

Tree-SHA512: 1da516226073f195285d10d9d9648c90cce0158c5d1eb9c31217bb4abb575cd37f07c00787c5a850554d6120bbc5a3cbc5cb47d4488b32ac6bcb52bc1882d600
2018-10-26 13:25:35 +02:00
Wladimir J. van der Laan 9d4541508b
Merge #14518: rpc: Always throw in getblockstats if -txindex is required
3be209d103 rpc: Always throw in getblockstats if -txindex is required (João Barbosa)

Pull request description:

  Previously blocks with only the coinbase transaction didn't cause
  the RPC error even if the requested stats required -txindex and
  it wasn't enabled.

  Fixes #14499.

Tree-SHA512: d3a6402889e3ce7199632e79eba66d7d471ff7de5c564d35312e2340cc6d84ef544a8172548fbc2eedf5e637b56dc57bbf7a9815ab798c7f226755f897fd8f3e
2018-10-26 13:21:17 +02:00
João Barbosa ed2e18398b Remove fs::relative call and fix listwalletdir tests
The implementation of fs::relative resolves symlinks which is not intended
in ListWalletDir. The replacement does what is required, and listwalletdir
tests are fixed accordingly.

Also, building with boost 1.47 required 2 changes:
 - replace fs::relative with an alternative implementation;
 - fix fs::recursive_directory_iterator iteration.
2018-10-25 15:33:56 +01:00
Chun Kuan Lee fbaccbf00c build: Fix Qt link order for Windows build 2018-10-25 20:14:48 +08:00
João Barbosa 65f3672f3b wallet: Refactor to use WalletLocation 2018-10-25 12:33:26 +01:00
João Barbosa 01a4c095c8 wallet: Add WalletLocation utility class 2018-10-25 11:53:17 +01:00
MeshCollider 201451b1ca Make getaddressinfo return solvability 2018-10-25 09:30:57 +13:00
MeshCollider f6ed748cf0 Add SegWit support to importmulti with some ProcessImport cleanup 2018-10-25 09:30:56 +13:00
Wladimir J. van der Laan 2b88f67e0b
Merge #14320: [bugfix] wallet: Fix duplicate fileid detection
4ea77320c5 tests: add test case for loading copied wallet twice (Chun Kuan Lee)
2d796faf62 wallet: Fix duplicate fileid (Chun Kuan Lee)

Pull request description:

  The implementation in current master can not detect if the file ID is duplicate with flushed `BerkeleyEnvironment`. This PR would store the file ID in a global variable `g_fileids` and release it when the `BerkeleyDatabase` close. So it won't have to rely on a `Db*`.

  Fix #14304

Tree-SHA512: 0632254b696bb4c671b5e2e5781e9012df54ba3c6ab0f919d9f6d31f374d3b0f8bd968b90b537884ac8c3d2906afdd58c2ce258666263464c7dbd636960b0e8f
2018-10-24 17:37:32 +02:00
Chun Kuan Lee 2d796faf62 wallet: Fix duplicate fileid 2018-10-24 23:08:16 +08:00
Wladimir J. van der Laan a74ed3a05b
Merge #14453: rpc: Fix wallet unload during walletpassphrase timeout
8907df9e02 qa: Ensure wallet unload during walletpassphrase timeout (João Barbosa)
321decffa1 rpc: Fix wallet unload during walletpassphrase timeout (João Barbosa)

Pull request description:

  Replaces the raw wallet pointer in the `RPCRunLater` callback with a `std::weak_ptr` to check if the wallet is not expired.

  To test:
  ```
  bitcoind -regtest
  bitcoin-cli -regtest encryptwallet foobar
  bitcoin-cli -regtest walletpassphrase foobar 5 && bitcoin-cli -regtest unloadwallet ""
  ```

  Fixes #14452.

Tree-SHA512: 311e839234f5fb7955ab5412a2cfc1903ee7132ea56a8ab992ede3614586834886bd65192b76531ae0aa3a526b38e70ca2e1cdbabe52995906ff97b49d93c268
2018-10-24 16:44:43 +02:00
Wladimir J. van der Laan 9886590116
Merge #14451: Add BIP70 deprecation warning and allow building GUI without BIP70 support
48439b3c10 Don't link SSL_LIBS with GUI unless BIP70 is enabled (James Hilliard)
fbb643d2a5 Add BIP70 deprecation warning (James Hilliard)
38b98507cd qt: cleanup: Move BIP70 functions together in paymentserver (Wladimir J. van der Laan)
9dcf6c0dfe build: Add --disable-bip70 configure option (Wladimir J. van der Laan)

Pull request description:

  This is based off of #11622 and adds a deprecation warning when a BIP70 URL is used.

  Rational:

  - BIP70 increases attack surface in multiple ways and is difficult for third party wallets to implement in a secure manner
  - Very few merchants use the standard BIP70 variant supported by Bitcoin Core
  - The one major payment processor that doesn't support BIP21 and currently uses a customized non-standard version of BIP70 has indicated that "Unfortunately the original BIP70 is not useful for us."

Tree-SHA512: 1e16ee8d2cdac9499f751ee7b50d058278150f9e38a87a47ddb5105dd0353cdedabe462903f54ead6209b249b249fe5e6a10d29631531be27400f2f69c25b9b9
2018-10-24 16:29:50 +02:00
Wladimir J. van der Laan 2e15fa16cd
Merge #12842: Prevent concurrent savemempool
585b47cfe1 rpc: Prevent concurrent savemempool (João Barbosa)

Pull request description:

  Follow up of #12172, this change prevents calling `savemempool` RPC concurrently.

Tree-SHA512: 4759a7107658a9794f5c6ab7e3e3002276abadd64996010be67a2791914d284db6fe0377c071a8d6a42387bfb0178f219b73aeec077ce5c4fe5c634a30b3e081
2018-10-24 15:20:33 +02:00
MarcoFalke 9dda5fdf64
Merge #14296: [wallet] Remove addwitnessaddress
2b91e42ece [docs] Add release note for removing getwitnessaddress (John Newbery)
ebec90ac97 [wallet] Remove deprecated addwitnessaddress RPC method (John Newbery)
07e3f585ab [test] Remove deprecated addwitnessaddress from feature_segwit.py (John Newbery)
82f2fa03a5 [test] Remove deprecated addwitnessaddress from wallet_bumpfee.py (John Newbery)
9d7ee187a3 [test] Remove deprecated addwitnessaddress from p2p_compactblocks.py (John Newbery)
3cf77f0b3e [tests] Remove deprecated addwitnessaddress call from wallet_dump.py (John Newbery)
bdefc9705d [tests] Remove deprecated addwitnessaddress call from feature_nulldummy (John Newbery)
67d7d67cf3 [test] Fix flake8 warnings in tests (John Newbery)

Pull request description:

  Fully removes the `addwitnessaddress` RPC method, which was deprecated in V0.17

Tree-SHA512: 8fa8a2a721a81262fbdedbe1cef031e6a07aa6abbc9760dbc62738fc4f688b44bd737d0f3cdb1aec046866a6395befbfecde0f34e76a99e11d3cf566cad1d0de
2018-10-24 08:09:48 -04:00
MarcoFalke e895fdc9fc
Merge #11634: wallet: Add missing cs_wallet/cs_KeyStore locks to wallet
69e7ee2dd8 Add GUARDED_BY(cs_wallet) for setExternalKeyPool, mapKeyMetadata, m_script_metadata and setLockedCoins (practicalswift)
37b2538c2d Add GUARDED_BY(cs_wallet) for encrypted_batch, nWalletMaxVersion, m_max_keypool_index and nOrderPosNext (practicalswift)
dee42927c9 wallet: Add Clang thread safety analysis annotations (practicalswift)
1c7e25db0c wallet: Add missing locks (practicalswift)

Pull request description:

  Add missing wallet locks:

  * Calling the function `GetConflicts(...)` requires holding the mutex `cs_wallet`
  * Calling the function `IsSpent(...)` requires holding the mutex `cs_wallet`
  * Accessing the variables `mapKeys` and `mapCryptedKeys` requires holding the mutex `cs_KeyStore`
  * Accessing the variable `nTimeFirstKey` requires holding the mutex `cs_wallet`
  * Accessing the variable `mapWallet` requires holding the mutex `cs_wallet`
  * Accessing the variable `nTimeFirstKey` requires holding the mutex `cs_wallet`

Tree-SHA512: 8a7b9a4e1f2147e77c04b817617a06304a2e2159148d3eb3514a3c09c41d77ef7e773df6e63880ad9acc026e00690f72d0c51f3f86279177f672d477423accca
2018-10-24 05:01:29 -04:00
MarcoFalke 5473e255f6
Merge #14444: Add compile time checking for cs_main locks which we assert at run time
0089905361 Add compile time checking for cs_main locks which we assert at run time (practicalswift)

Pull request description:

  Assert locking requirements at compile-time (`EXCLUSIVE_LOCKS_REQUIRED(foo)`) instead of at run-time (`AssertLockHeld(…)`).

Tree-SHA512: f4965ebf4bb5dbf5e7ed738cacf82c0f6cd55134fb968860bf84a84e29806485617f223910bb8c5461213f1829b0137c64ba1f6d6a2008b3cac3bb3a28df9324
2018-10-23 20:33:07 -04:00
MarcoFalke 94cf1ec948
Merge #14417: Fix listreceivedbyaddress not taking address as a string
d4d70eda33 Fix listreceivedbyaddress not taking address as a string (Eric Scrivner)

Pull request description:

  Fixes #14173. Add the patch in #14173 and include a regression test.

Tree-SHA512: 5a9794e0c43e90d18c899841afbaf15eb9129d7d2f6570fccf0a1793697fe170d224c3c3995b1a35c536fac19819042823d9e3bd23b019d0f03434499243d2f5
2018-10-23 19:04:10 -04:00
MarcoFalke 3668bb335c
Merge #14468: [wallet] Deprecate generate RPC method
ab9aca2bdf [rpc] add 'getnewaddress' hint to 'generatetoaddress' help text. (John Newbery)
c9f02955b2 [wallet] Deprecate the generate RPC method (John Newbery)
aab81720de [tests] Add generate method to TestNode (John Newbery)
c269209336 [tests] Small fixups before deprecating generate (John Newbery)

Pull request description:

  Deprecates the `generate` RPC method.

  For concept discussion, see #14299.

  Fixes #14299.

Tree-SHA512: 16a3b8b742932e4f0476c06b23de07a34d9d215b41d9272c1c9d1e39966b0c2406f17c5ab3cc568947620c08171ebe5eb74fd7ed4b62151363e305ee2937cc80
2018-10-23 18:15:21 -04:00
John Newbery ab9aca2bdf [rpc] add 'getnewaddress' hint to 'generatetoaddress' help text. 2018-10-23 08:32:00 -04:00
James Hilliard 48439b3c10 Don't link SSL_LIBS with GUI unless BIP70 is enabled 2018-10-22 04:10:40 -06:00
James Hilliard fbb643d2a5 Add BIP70 deprecation warning 2018-10-22 04:10:40 -06:00
Wladimir J. van der Laan 38b98507cd qt: cleanup: Move BIP70 functions together in paymentserver
Reduces the number of separate `#ifdefs` spans.
2018-10-22 04:03:17 -06:00
Pieter Wuille ff37459abc Add tests for key origin support 2018-10-20 20:29:02 -07:00
Pieter Wuille 2c6281f180 Add key origin support to descriptors 2018-10-20 20:29:02 -07:00
MarcoFalke 75795603dd
Merge #13909: validation: Pass chainparams in AcceptToMemoryPoolWorker(...)
97ddc6026b validation: Pass chainparams in AcceptToMemoryPoolWorker(...) (practicalswift)

Pull request description:

  Remove unused `CChainParams` argument in `AcceptToMemoryPoolWorker(...)`.

  After the merge of #13527 ("policy: Remove promiscuousmempoolflags") yesterday the `CChainParams` argument is no longer used in `AcceptToMemoryPoolWorker(...)`.

Tree-SHA512: f1bab4498b64f0ab5230b8172f860df8fa8a302e4ee7385be4ba9c65a37cbc3ef640df78348c477169b9414e5c6a160a0b6471a11f4bb27921500ec208ef5340
2018-10-20 21:17:53 -03:00
Wladimir J. van der Laan 96c409c919
Merge #14527: qa: Revert "Make qt wallet test compatible with qt4"
fadffae17f Revert "Make qt wallet test compatible with qt4" (MarcoFalke)

Pull request description:

  This removes the file added in #10098

Tree-SHA512: 4aa887ec02aec943f3d74f469c935acf57e43ddbea6f979bb37d3a14670571fa2276cf578e8978de92b5854d8b462f24e5e0addfb27b92fbedf90726eb5d985e
2018-10-20 14:02:02 +02:00
João Barbosa 585b47cfe1 rpc: Prevent concurrent savemempool 2018-10-20 11:12:20 +01:00
MarcoFalke fadffae17f
Revert "Make qt wallet test compatible with qt4"
This reverts commit e9a64615c8.
2018-10-20 05:34:53 -03:00
Pieter Wuille 91482e5bf2
Merge #14460: tests: Improve 'CAmount' tests
29ed2d64f6 Improve CAmount tests (Hennadii Stepanov)

Pull request description:

  This provides:
    - more `MoneyRange` tests;
    - new `CFeeRate` constructor tests with zero byte size;
    - explicit using of the `CAmount` type.

Tree-SHA512: ca0ad6ccb37909a2a5c11034dc07b316a84c32fb40c6f8b6cfc28ebec72a1de157f31d22e767ae80d70ed06d7296f23870cc5ed0689f34a754ae763d50e23d43
2018-10-19 19:23:43 -07:00
Pieter Wuille e754c6e331
Merge #14011: Disable wallet and address book Qt tests on macOS minimal platform
a3197c5294 Disable wallet and address book Qt tests on macOS minimal platform (Russell Yanofsky)

Pull request description:

  macOS minimal platform is frequently broken, and these are currently failing with Qt 5.11.1.

  The tests do pass when run on the full cocoa platform (with `test_bitcoin-qt -platform cocoa`).

  Stack trace from test crash: https://gist.github.com/ryanofsky/3401fb63c52d13d5585e7fc777361f1e

Tree-SHA512: a05644ef15d75ea7d7f85ea804c6a5fe78e4e7358b189cbab639d9f7dc46163a35f77f7a2b4ae2fd6be5b9fb22898386b4d88069d5ee8d5fdbd995157c6f0846
2018-10-19 19:14:07 -07:00
Pieter Wuille dc1e54206d
Merge #14474: bitcoin-tx: Use constant for n pubkeys check
1f01fe0257 bitcoin-tx: Use constant for n pubkeys check (Antoine Le Calvez)

Pull request description:

  Use the constant for the maximum number of public keys in a multisig script defined in script/script.h instead of hardcoding it.

Tree-SHA512: 83e6c46df907944d0d993159955e402784415536d61fdb5a5becba2b042e37ad2a291b27301c1b169416cb71c823a571d82257512cd4a64848a27a24c875fcc6
2018-10-19 19:02:41 -07:00
Pieter Wuille b2863c0685
Merge #14426: utils: Fix broken Windows filelock
369244f654 utils: Fix broken Windows filelock (Chun Kuan Lee)

Pull request description:

  Fix broken filelock on Windows, also add a test for this. It's a regression introduced by #13862.

Tree-SHA512: 15665b1930cf39ec71f3ab07def8e2897659f6fd4d2de749d63a5a8ec920e4a04282f12bc262f242b1b3d14d2dd9fa191ddbcf16a46fb927b5b2b14d9f6b5d01
2018-10-19 18:59:47 -07:00
Pieter Wuille b14db5abab
Merge #14513: Avoid 1 << 31 (UB) in calculation of SEQUENCE_LOCKTIME_DISABLE_FLAG
bc60c615a5 Avoid 1 << 31 (UB) in calculation of SEQUENCE_LOCKTIME_DISABLE_FLAG (practicalswift)

Pull request description:

  Avoid `1 << 31` (UB) in calculation of `SEQUENCE_LOCKTIME_DISABLE_FLAG`.

  Context: https://github.com/bitcoin/bitcoin/pull/14510#issuecomment-431153707

Tree-SHA512: bdb4a913c6a82ff1a455ba67d3351f6408ff4116574329361644b483fea96b801fdc5c5659233856b591cd3a46ec669d3b5b438553e4240d7099c560eae2e2ae
2018-10-19 18:52:42 -07:00
Chun Kuan Lee cb53b825c2 scripted-diff: Replace boost::bind with std::bind
-BEGIN VERIFY SCRIPT-
for j in $(seq 1 5)
do
    sed -i "s/ _${j}/ std::placeholders::_${j}/g" $(git grep --name-only " _${j}" -- '*.cpp' '*.h')
done
sed -i "s/boost::bind/std::bind/g" $(git grep --name-only boost::bind -- '*.cpp' '*.h')
sed -i "s/boost::ref/std::ref/g" $(git grep --name-only boost::ref -- '*.cpp' '*.h')
sed -i '/boost\/bind/d' $(git grep --name-only boost/bind)
-END VERIFY SCRIPT-
2018-10-20 02:29:59 +08:00
Chun Kuan Lee 2196c51821 refactor: Use boost::scoped_connection in signal/slot, also prefer range-based loop instead of std::transform 2018-10-20 02:29:35 +08:00
João Barbosa 3be209d103 rpc: Always throw in getblockstats if -txindex is required
Previously blocks with only the coinbase transaction didn't cause
the RPC error even if the requested stats required -txindex and
it wasn't enabled.
2018-10-19 15:28:41 +01:00
mruddy a4edb168b6 ZMQ: add options to configure outbound message high water mark, aka SNDHWM 2018-10-19 07:36:13 -04:00
Wladimir J. van der Laan 8eb2cd1dda
Merge #14291: wallet: Add ListWalletDir utility function
d56a068935 docs: Add release notes for listwalletdir RPC (João Barbosa)
0cb3cad166 qa: Add tests for listwalletdir RPC (João Barbosa)
cc3377360c rpc: Add listwalletdir RPC (João Barbosa)
d1b03b8e5f interfaces: Add getWalletDir and listWalletDir to Node (João Barbosa)
fc4db35bfd wallet: Add ListWalletDir utility (João Barbosa)

Pull request description:

  `ListWalletDir` returns all available wallets in the current wallet directory.

  Based on MeshCollider work in pull #11485.

Tree-SHA512: 5843e3dbd1e0449f55bb8ea7c241a536078ff6ffcaad88ce5fcf8963971d48c78600fbc4f44919523b8a92329d5d8a5f567a3e0ccb0270fdd27366e19603a716
2018-10-19 01:01:17 +02:00
João Barbosa 321decffa1 rpc: Fix wallet unload during walletpassphrase timeout 2018-10-18 23:33:36 +01:00
João Barbosa cc3377360c rpc: Add listwalletdir RPC 2018-10-18 23:26:06 +01:00
João Barbosa d1b03b8e5f interfaces: Add getWalletDir and listWalletDir to Node 2018-10-18 23:26:06 +01:00
João Barbosa fc4db35bfd wallet: Add ListWalletDir utility
ListWalletDir returns all available wallets in the current wallet directory.

Based on MeshCollider work in pull #11485.
2018-10-18 23:26:06 +01:00
John Newbery c9f02955b2 [wallet] Deprecate the generate RPC method 2018-10-18 17:46:48 -04:00
practicalswift bc60c615a5 Avoid 1 << 31 (UB) in calculation of SEQUENCE_LOCKTIME_DISABLE_FLAG 2018-10-18 23:14:20 +02:00
Wladimir J. van der Laan 3715b2489e
Merge #14510: Avoid triggering undefined behaviour in base_uint<BITS>::bits()
96f6dc9fc5 Avoid triggering undefined behaviour in base_uint<BITS>::bits() (practicalswift)

Pull request description:

  Avoid triggering undefined behaviour in `base_uint<BITS>::bits()`.

  `1 << 31` is undefined behaviour in C++11.

  Given the reasonable assumption of `sizeof(int) * CHAR_BIT == 32`.

Tree-SHA512: 995fa38e71c8921873139ecf1b7dd54178555219af3be60d07290f379439ddd8479e3963c6f3cae8178efb61063a0f9add6cba82a5578d13888597b5bcd54f22
2018-10-18 22:55:44 +02:00
Chun Kuan Lee 369244f654 utils: Fix broken Windows filelock 2018-10-19 02:29:25 +08:00
Wladimir J. van der Laan fe23553edd
Merge #14374: qt: Add "Blocksdir" to Debug window
2ab9140c92 Add tooltips for both datadir and blocksdir (Hennadii Stepanov)
3045704502 Add "Blocksdir" to Debug window (Hennadii Stepanov)

Pull request description:

  To get the current `blocksdir` is valuable for debug purposes after
  merging #12653.

  ![screenshot from 2018-10-02 23-16-52](https://user-images.githubusercontent.com/32963518/46374770-2ef6f580-c69a-11e8-85c2-44a49fa36b28.png)

Tree-SHA512: a93f2c00ee19cf6acb499d3bd9bccf4be8ef01c53c44d917ad401aa4797db02cbccb71a9c24e05262ea09345e15f9299381367fdc6951f21dd3788a4a58d2132
2018-10-18 12:31:20 +02:00
Wladimir J. van der Laan 32c5f188d4
Merge #14177: qt: Set C locale for amountWidget
b0510d78ae Set C locale for amountWidget (Hennadii Stepanov)

Pull request description:

  Fix #13873

Tree-SHA512: ef26b35ef83c3a87ebd90650f6d833b00a24f6c114b68fe01acd4a14d1f5bdec066f438eb7781c1e55c32640838c54e00b8f082c390639ade8d9a58830833d4a
2018-10-18 12:26:16 +02:00
practicalswift 96f6dc9fc5 Avoid triggering undefined behaviour in base_uint<BITS>::bits() 2018-10-18 11:17:05 +02:00
Wladimir J. van der Laan d98777f302
Merge #14146: wallet: Remove trailing separators from -walletdir arg
2d471636eb wallet: Remove trailing separators from -walletdir arg (Pierre Rochard)
ea3009ee94 wallet: Add walletdir arg unit tests (Pierre Rochard)

Pull request description:

  If a user passes in a path with a trailing separator as the `walletdir`, multiple BerkeleyEnvironments may be created in the same directory which can lead to data corruption.

  Discovered while reviewing https://github.com/bitcoin/bitcoin/pull/12493#issuecomment-417147646

Tree-SHA512: f2bbf1749d904fd3f326b88f2ead58c8386034355910906d7faea155d518642e9cd4ceb3cae272f2d9d8feb61f126523e1c97502799d24e4315bb53e49fd7c09
2018-10-18 10:58:59 +02:00
Wladimir J. van der Laan 9c5f0d542d
Merge #13878: utils: Add fstream wrapper to allow to pass unicode filename on Windows
43c7fbb1e7 Make MSVC compiler read the source code using utf-8 (Chun Kuan Lee)
f86a571edb tests: Add test case for std::ios_base::ate (Chun Kuan Lee)
a554cc901a Move boost/std fstream to fsbridge (Chun Kuan Lee)
86eb3b3f1a utils: Add fsbridge fstream function wrapper (Chun Kuan Lee)

Pull request description:

  If compiled with mingw, use glibc++ extension `stdio_filebuf` to open the file by `FILE*` instead of filename.

  In other condition, we can use boost::fstream.

Tree-SHA512: b5dbd83e347fb9b2a0c8b1c2c7bd71a272e839ec0617883b2a0ec12506ae9e825373cf6e95b9bcc91d7edc85bf51580a7716b56a9ecaad776bc3ae61638cb3da
2018-10-18 10:36:51 +02:00
Wladimir J. van der Laan 041224a75c
Merge #14472: [doc] getblocktemplate: use SegWit in example
d562027079 [doc] getblocktemplate: use SegWit in example (Sjors Provoost)

Pull request description:

  Make it less likely for new miners to accidentally mine non-SegWit blocks.

  Suggest backport to 0.17 so the docs on bitcoincore.org get updated at the next minor release.

Tree-SHA512: fc8c51690559d3e64d03c0eec433c75e5581d616d36b529e16f89ff2433457386feba7ef3b0d22f245d3f725183a2204fef7ee13e25cb92b945ab61f99068dee
2018-10-18 09:54:33 +02:00
Jonas Schnelli 816fab9cca
Merge #14450: qt: Fix QCompleter popup regression
081cc02a9 Fix QCompleter popup regression (Hennadii Stepanov)

Pull request description:

  The PR #8129 has introduced a regression with the `QCompleter` popup in the Debug window.

  How to reproduce:

  1.  open the Debug window;
  2.  go to the 'Console' tab;
  3.  start writing some RPC command and try to pick it from the list using arrow keys, press Enter.

  Note that the popup used to display completions is not being closed. To close it they should mouse click somewhere outside of the popup.

  The wrong behaviour of the `QCompleter` popup is observed on Linux Mint 19 and Windows 10.
  This PR fixes this regression.

  Refs:

  - #7613
  - #7772
  - #8129

Tree-SHA512: f3ba8d08e1c07619d4ef307544306b57be43e4e726770976cf0c2af95082bd66e2eefe8aabb9a3fad0601cd9e6e4dea0459b6a63eba512023234feb308484655
2018-10-17 20:25:35 +02:00
James O'Beirne b191c7dfb7 doc: add comment explaining recentRejects-DoS behavior
When we receive invalid txs for the first time, we mark the sender as
misbehaving. If we receive the same tx before a new block is seen, we *don't*
punish the second sender (in the same way we do the original sender). It wasn't
initially clear to me that this is intentional, so add a clarifying comment.
2018-10-16 13:04:42 -04:00
Wladimir J. van der Laan 23419e4c49
Merge #14335: net: refactor: cleanup ThreadSocketHandler
032488e6e7 Move SocketHandler logic to private method. (Patrick Strateman)
2af9cff11a Move InactivityCheck logic to private method. (Patrick Strateman)
7479b63d91 Move DisconnectNodes logic to private method. (Patrick Strateman)
edb5350c32 Move NotifyNumConnectionsChanged logic to private method. (Patrick Strateman)

Pull request description:

  Working towards using poll() on unix like systems.

  A number of small changes designed to separate the actual socket handling from the rest of the logic in ThreadSocketHandler.

  This is a simpler version of #14147

Tree-SHA512: 72f35c8ef7649019dcbfe19537d8c9f7e3d0fc5854dc691a70c5573352230fc31c3f55565820c632e9b8cb3c55b878bed19e0ad9423100762197ac35967d8067
2018-10-16 17:20:34 +02:00
Wladimir J. van der Laan 2468471e13
Merge #14403: qt: Revert "Force TLS1.0+ for SSL connections"
7d173c4cd1 qt: Revert "Force TLS1.0+ for SSL connections" (Tim Ruffing)

Pull request description:

  This reverts commit 15e26a6a9a, whose
  purpose was to tweak the Qt configuration to force TLS, i.e., to
  disable SSLv3, in Qt versions >= 5.5. However, the default behavior
  of Qt >= 5.4 is to disable SSLv3 anyway [1], so the configuration
  tweak is redundant.

  With Qt 5.11.2, the configuration tweak is not only redundant but in
  fact provokes a deadlock due to a bug in Qt 5.11.2. Since the deadlock
  occurs at the early startup stage of bitcoin-qt, it renders bitcoin-qt
  entirely non-functional when compiled against Qt 5.11.2 (and maybe
  other Qt versions).

  Fixes #14359.

  [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3fd2d9eff8c1f948306ee5fbfe364ccded1c4b84

Tree-SHA512: 9dd86557b8d265dfa56592924778a736590f2e6a0b2acf77d4f9f4200206a9edaa79b144b0085ea59ac0cc1bc66d9740402fd02f9298ff74c8d6f526f3f725d6
2018-10-16 07:04:22 +02:00
Wladimir J. van der Laan 9bd3ff430b
Merge #14383: qt: Clean system tray icon menu for '-disablewallet' mode
36323e2ac6 Clean systray icon menu for -disablewallet mode (Hennadii Stepanov)

Pull request description:

  There is a `Debug window` leftover in the system tray icon menu after #3392 merging.
  This PR makes both the app menu and the systray icon menu consistent.

Tree-SHA512: c9ef58785fe2a54bc6f778140a16001748ed8c46da948656822b86fdc2e224203cd467857f71d00ce56fc73ff2590c46d8c234a54c261c1141d83039de6fee1e
2018-10-16 06:54:07 +02:00
Jonas Schnelli 2a2cac7873
Merge #14424: Stop requiring imported pubkey to sign non-PKH schemes
2f6b466ae Stop requiring imported pubkey to sign non-PKH schemes (Pieter Wuille)

Pull request description:

  ...

  This is a fix for #14415

Tree-SHA512: 113b4ddfbdfcce7dbaa15c565ac7ec68d16127aa4d47628e0801f2437cbe369e0fa8beb0de191d43dcb2f8cbb6f1bf8d79a5db0f4e352f38fe7280124475710a
2018-10-15 12:50:02 +02:00
Chun Kuan Lee b7df96f456 refactor: Drop boost::this_thread::interruption_point and boost::thread_interrupted in main thread 2018-10-15 10:32:43 +08:00
Eric Scrivner d4d70eda33 Fix listreceivedbyaddress not taking address as a string
Fixes #14173. Add the patch in #14173 and include a regression test.
2018-10-14 09:48:06 -07:00
whythat 93d1aa9abc rpcwallet: add 'ischange' field to 'getaddressinfo' response 2018-10-13 19:30:13 +03:00
Hennadii Stepanov 081cc02a98
Fix QCompleter popup regression
The PR #8129 has introduced a regression with the QCompleter popup in
the Debug window.

How to reproduce:
  1) open the Debug window;
  2) go to the 'Console' tab;
  3) start writing some rpc command and try to pick it from the list
using arrow keys, press Enter.
Note that the popup used to display completions is not being closed. To
close it they should mouse click somewhere outside of the popup.
2018-10-13 14:19:38 +03:00
Antoine Le Calvez 1f01fe0257 bitcoin-tx: Use constant for n pubkeys check
Use the constant for the maximum number of public keys in a multisig
script defined in script/script.h instead of hardcoding it.
2018-10-13 10:55:51 +01:00
Sjors Provoost d562027079
[doc] getblocktemplate: use SegWit in example 2018-10-13 17:15:08 +09:00
Hennadii Stepanov 29ed2d64f6
Improve CAmount tests
This provides:
  - more `MoneyRange` tests;
  - new `CFeeRate` constructor tests with zero byte size;
  - explicit using of the `CAmount` type.
2018-10-10 23:27:51 +03:00
practicalswift 0089905361 Add compile time checking for cs_main locks which we assert at run time 2018-10-10 11:28:43 +02:00
MarcoFalke be992701b0
Merge #14373: Consistency fixes for RPC descriptions
b8edb9810a [rpc] Descriptions: Textual consistency fixes (Jon Layton)

Pull request description:

Tree-SHA512: fa22ddac94e95672579cc84309f1c3ea3a2dbf762e45a8ae9c121c4c5188bf8c19ff9458d49dd7ef760c3ae4226487612a2954e9a1a0e8b720116afeb718b46b
2018-10-10 00:59:57 -03:00
James O'Beirne a48e44bd4f Fix CLEAN_BITCOIN_TEST to remove .log files for all BITCOIN_TESTS files 2018-10-09 22:31:51 -04:00
Jordan Baczuk 0c69ff6171 clarify rpcwallet flag url change 2018-10-09 13:49:07 -06:00
Jon Layton b8edb9810a [rpc] Descriptions: Textual consistency fixes
'Must be one of' should always end in a ':'

'hex encoded' is now always 'hex-encoded'

Remove redundant '(defaults to CONSERVATIVE)' text from estimatesmartfee

Consistent spacing for options '( verbose )' and '( verbosity )'

'BIP125 replaceable' is now always 'BIP125-replaceable'

JSON-RPC example is now always 'As a JSON-RPC call'
2018-10-09 08:42:19 -05:00
practicalswift 69e7ee2dd8 Add GUARDED_BY(cs_wallet) for setExternalKeyPool, mapKeyMetadata, m_script_metadata and setLockedCoins 2018-10-09 15:04:26 +02:00
practicalswift 37b2538c2d Add GUARDED_BY(cs_wallet) for encrypted_batch, nWalletMaxVersion, m_max_keypool_index and nOrderPosNext
* AddKeyPubKeyWithDB(...) reads encrypted_batch which potentially races with write in the same method.
* IncOrderPosNext(...) reads nOrderPosNext which potentially races with write in BlockDisconnected(...).
* LoadKeyPool(...) reads m_max_keypool_index which potentially races with write in BlockDisconnected(...).
* LoadMinVersion(...) reads nWalletMaxVersion which potentially races with write in BlockDisconnected(...).
2018-10-09 12:12:27 +02:00
practicalswift dee42927c9 wallet: Add Clang thread safety analysis annotations 2018-10-09 11:58:32 +02:00
practicalswift 1c7e25db0c wallet: Add missing locks 2018-10-09 11:58:32 +02:00
Tim Ruffing 7d173c4cd1 qt: Revert "Force TLS1.0+ for SSL connections"
This reverts commit 15e26a6a9a, whose
purpose was to tweak the Qt configuration to force TLS, i.e., to
disable SSLv3, in Qt versions >= 5.5. However, the default behavior
of Qt >= 5.4 is to disable SSLv3 anyway [1], so the configuration
tweak is redundant.

With Qt 5.11.2, the configuration tweak is not only redundant but in
fact provokes a deadlock (#14359) due to Qt 5.11.2 being incompatible
with OpenSSL 1.1.1 [2]. Since the deadlock occurs at the early startup
stage of bitcoin-qt, it renders bitcoin-qt entirely non-functional
when compiled against OpenSSL 1.1.1 and Qt 5.11.2 (and possible future
combinations of OpenSSL and Qt versions).

This commit fixes #14359 by removing the redundant code.

[1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3fd2d9eff8c1f948306ee5fbfe364ccded1c4b84
[2] https://bugreports.qt.io/browse/QTBUG-70956
2018-10-09 11:54:05 +02:00
Wladimir J. van der Laan 9dcf6c0dfe build: Add --disable-bip70 configure option
This patch adds a --disable-bip70 configure option that disables BIP70
payment request support. When disabled, this removes the dependency of
the GUI on OpenSSL and Protobuf.
2018-10-09 03:36:14 -06:00
MarcoFalke 1d1417430c
Merge #13115: addrman: Add Clang thread safety annotations for variables guarded by CAddrMan.cs
3e9f6c821b Add missing locks and locking annotations for CAddrMan (practicalswift)

Pull request description:

  * Add Clang thread safety annotations for variables guarded by `CAddrMan.cs `
  * Add missing `CAddrMan.cs ` locks

Tree-SHA512: c78d56d56eb63a4469333c04c95317545a8f97d5e3a36ff2699ee4a91a6433d416221eed6c5ff168e1e31f6936c2ae101a4c60b635f2b2309f40e3d66a727322
2018-10-09 00:54:30 -03:00
practicalswift 3e9f6c821b Add missing locks and locking annotations for CAddrMan 2018-10-08 17:19:25 +02:00
Hennadii Stepanov 2ab9140c92
Add tooltips for both datadir and blocksdir 2018-10-08 13:33:29 +03:00
MarcoFalke da32bd80bf
Merge #14253: Build: during 'make clean', remove some files that are currently missed.
3f5ac27205 Include some files currently missed by 'make distclean'. (murrayn)

Pull request description:

  `make clean` currently leaves behind some cache and test log files that should be removed.

Tree-SHA512: a1877e776e24232f6dd1468d7f392ea0bd1e93fdd975e623897d48c4b23a080a2e84ebb199f5482abd6b8c9ddd036850325e7b7ed07e2f9fe7a32f83cc99da4a
2018-10-08 04:32:48 -03:00
MarcoFalke 35e12e336b
Merge #14428: docs: Fix macOS files description in qt/README.md
0bd64dc6d6 Fix macOS files description (Hennadii Stepanov)

Pull request description:

Tree-SHA512: 9547bda4e2bcd2c823b6c344e8d34ebc24770b2926bbec0f5c11f192407386cddf5daaa4fc154f769df708319262ead72e699dab211afa5762a2def6203445fe
2018-10-08 02:54:56 -03:00
Pieter Wuille 2f6b466aeb Stop requiring imported pubkey to sign non-PKH schemes 2018-10-07 22:15:27 -07:00
MarcoFalke 2a747337ae
Merge #14398: tests: Don't access out of bounds array index: array[sizeof(array)]
b09c81454e Don't access out of bounds array entry array[sizeof(array)] (Ben Woosley)

Pull request description:

  Split from #13525

Tree-SHA512: bf44609fc5d497cd1894b85dce33a55977b3e0f3d03b986333a85967c1f3aa89089461f830939072bbb4d2477ccce26b9caeb627215bfb86a331f58d3466a4bd
2018-10-07 23:34:50 -03:00
MarcoFalke 60a61611f6
Merge #13883: utils: Convert Windows args to utf-8 string
380c843217 utils: Convert Windows args to utf-8 string (Chun Kuan Lee)

Pull request description:

  Create a new class `WinCmdLineArgs` when building for Windows. It converts all command line arguments to utf8 string.

Tree-SHA512: f098520fd123a8a452bc84a55dc8c0b88f0c475410efe57f2ccc393f86c396eed59ea1575ddc1b920323792e390fdb092061d80cdcd9b682f0ac79a22a22ff82
2018-10-07 22:47:17 -03:00
Hennadii Stepanov 0bd64dc6d6
Fix macOS files description 2018-10-08 00:41:40 +03:00
Hennadii Stepanov 36323e2ac6
Clean systray icon menu for -disablewallet mode
Ref #3392
2018-10-06 02:46:45 +03:00
Hennadii Stepanov 3045704502
Add "Blocksdir" to Debug window
To get the current blocksdir is valuable for debug purposes after
merging #12653.
2018-10-06 00:07:05 +03:00
marcoagner a6b5ec18ff
rpc: creates possibility to preserve labels on importprivkey
- changes importprivkey behavior to overwrite existent label if one
is passed and keep existing ones if no label is passed

- tests behavior of importprivkey on existing address labels and
different same key destination
2018-10-05 13:33:21 +01:00
Ben Woosley b09c81454e
Don't access out of bounds array entry array[sizeof(array)] 2018-10-05 16:48:16 +09:00
Andrew Chow 4fb3388db9 check that a separator is found for psbt inputs, outputs, and global map 2018-10-03 00:26:10 -04:00
murrayn 3f5ac27205 Include some files currently missed by 'make distclean'. 2018-10-01 02:17:44 -07:00
MarcoFalke 011c39c296
Merge #14331: doxygen: Fix member comments
fa69ac7614 doxygen: Fix member comments (MarcoFalke)

Pull request description:

  Trailing comments must be indicted with the caret `//!<`.

  Not all places do this right now, see for example https://dev.visucore.com/bitcoin/doxygen/txmempool_8h.html#a2bc6653552b5871101b6cbefdbaf251f, but they can be fixed with an almost-scripted-diff:

  ```
  sed -i --regexp-extended -e 's/((,|;) *\/\/!) /\1< /g' $(git grep --extended-regexp -l  '(,|;)\s*//!\s')
  ```

  (Same as  [doxygen] Fix member comments #7793)

Tree-SHA512: 451077008353ccc6fcc795f34094b2d022feb7a171b562a07ba4de0dcb0aebc137e12b03970764bd81e2da386751d042903db4c4831900f43c0cfde804c81b2b
2018-09-30 22:15:37 -03:00
Chun Kuan Lee 380c843217 utils: Convert Windows args to utf-8 string 2018-09-30 15:08:16 +08:00
Gregory Sanders 88a79cb436 fix converttopsbt permitsigdata arg, add basic test 2018-09-29 22:09:15 -04:00
MarcoFalke 134b42a409
Merge #14244: amount: Move CAmount CENT to unit test header
fa84723e73 amount: Move CAmount CENT to unit test header (MarcoFalke)

Pull request description:

  `CAmount` is currently not type-safe. Exporting a constant (`CENT`) that is commonly not referred to by that name might be confusing. `CENT` is only used in two places prior to this commit (`ParseMoney` and `MIN_CHANGE`). So replace these with constants relative to `COIN` and move `CENT` to the unit test header.

Tree-SHA512: 5273e96d8664ced6ae211abde2e20bc763e6e99f89404eec02c621f29e1d235e5f9b1ade933743843fae16fc24b643f883deda9221e3d9fd31229d2ab63a914f
2018-09-27 12:02:17 -04:00
MarcoFalke 01211cea71
Merge #14307: Consolidate redundant implementations of ParseHashStr
9c5af58d51 Consolidate redundant implementations of ParseHashStr (Ben Woosley)

Pull request description:

  This change:
  * adds a length check to all calls to `ParseHashStr`, appropriate given its use to populate
    a 256-bit number from a hex str
  * allows the caller to handle the failure, which allows for the more
    appropriate `JSONRPCError` on failure in `prioritisetransaction` rpc

  Relative to #14288

Tree-SHA512: baa791147e5ceb3c30c70df3981aaf807bf7d4a90a0be3625540b59aa4b9a9d303a452bfef18bf167cbb833ef9591b4ef5948bf4a1ce67b421d804ae8d20ea53
2018-09-27 11:26:29 -04:00
MarcoFalke 423cb37658
Merge #14027: Skip stale tip checking if outbound connections are off or if reindexing.
66b3fc5437 Skip stale tip checking if outbound connections are off or if reindexing. (Gregory Maxwell)

Pull request description:

  I got tired of the pointless stale tip notices in reindex and on nodes with connections disabled.

Tree-SHA512: eb07d9c5c787ae6dea02cdd1d67a48a36a30adc5ccc74d6f1c0c7364d404dc8848b35d2b8daf5283f7c8f36f1a3c463aacb190d70a22d1fe796a301bb1f03228
2018-09-27 11:18:47 -04:00
MarcoFalke b88dd7c2db
Merge #12246: Bugfix: Only run bitcoin-tx tests when bitcoin-tx is enabled
a2a04a5abb Bugfix: Only run bitcoin-tx tests when bitcoin-tx is enabled (Luke Dashjr)
92af71cea9 configure: Make it possible to build only one of bitcoin-cli or bitcoin-tx (Luke Dashjr)

Pull request description:

  Includes #5618 (which the reasons for rejecting no longer hold true)

Tree-SHA512: f30a8e4a2f70166b7cabef77c4674163b3a9da14c6a547d34f00d1056a19bf4d23e22851eea726fad2afc8735d5473ae91122c770b65ac3886663dc20e2c5b70
2018-09-27 11:13:51 -04:00
Hennadii Stepanov ec1201a368
Don't use systray icon on inappropriate systems
Prevent a user from losing access to the main window by minimizing it to
the tray on some systems (e.g. GNOME 3.26+).
2018-09-27 17:24:04 +03:00
MarcoFalke ae1cc010b8
Merge #14282: [wallet] Remove -usehd
7ac911afe7 [docs] Add release notes for removing `-usehd` (John Newbery)
25548b2958 [wallet] Remove -usehd (John Newbery)

Pull request description:

  `-usehd` is no longer used (except to tell the user that they've set it incorrectly for the wallet that they're loading). Remove it (in the same spirit as #14272)

Tree-SHA512: 5bdcd2bb9bb8504a01343595bcd1bd433d97b730255152c725103c1ac3fa3a9d9e5220a4c29d4c72307cf803e1c09d31080f83603c23dc77263846e17b1826f0
2018-09-26 17:36:28 -04:00
MarcoFalke fa69ac7614
doxygen: Fix member comments 2018-09-26 15:42:21 -04:00
Hennadii Stepanov b0510d78ae
Set C locale for amountWidget
Fix #13873
2018-09-26 22:28:10 +03:00
MarcoFalke d799efe214
Merge #14310: [wallet] Ensure wallet is unlocked before signing
20442f617f [wallet] remove redundand restart node (gustavonalle)
db15805668 [wallet] Ensure wallet is unlocked before signing (gustavonalle)

Pull request description:

  Fixes #14082

Tree-SHA512: 200620a2ced934f958933aba34541565a992e5033cf04c4e2be48b99e7708973c85f8274968962cec943f0c1d76fb2faa5e056469bbf59ce7f768614572322f9
2018-09-26 09:18:00 -04:00
Chun Kuan Lee f86a571edb tests: Add test case for std::ios_base::ate 2018-09-26 08:47:42 +08:00
Chun Kuan Lee a554cc901a Move boost/std fstream to fsbridge 2018-09-26 08:47:42 +08:00
Chun Kuan Lee 86eb3b3f1a utils: Add fsbridge fstream function wrapper 2018-09-26 08:47:42 +08:00
MarcoFalke cc7258bdfb
Merge #13877: utils: Make fs::path::string() always return utf-8 string on Windows
2c3eade704 Make fs::path::string() always return utf-8 string (Chun Kuan Lee)

Pull request description:

  Imbue `fs::path` with `std::codecvt_utf8_utf16` at `SetupEnvironment()`, so that default string encoding will be utf-8 inside `fs::path`.

Tree-SHA512: 0cb59464d777278decbf24771fc5ff0cb2caa7bc2fe8ee5cd36c97a2324873a3caad131f08f050393b488316ee7f4ab0b28b7fa4699e41839f8e51b9867d5118
2018-09-25 14:00:46 -04:00
Ben Woosley 9c5af58d51
Consolidate redundant implementations of ParseHashStr
This change:
* adds a length check to ParseHashStr, appropriate given its use to populate
  a 256-bit number from a hex str.
* allows the caller to handle the failure, which allows for the more
  appropriate JSONRPCError on failure in prioritisetransaction rpc
2018-09-25 09:14:52 -07:00
MarcoFalke 4dac24db23
Merge #13311: Don't edit Chainparams after initialization
6fa901fb47 Don't edit Chainparams after initialization (Jorge Timón)
980b38f8a1 MOVEONLY: Move versionbits info out of versionbits.o (Jorge Timón)

Pull request description:

  This encapsulates the "-vbparams" option, which is only meant for regtest, directly on CRegTestParams.

  This is a refactor and doesn't change functionality.

  Related to https://github.com/bitcoin/bitcoin/pull/8994

Tree-SHA512: 79771d729a63a720e743a9c77d5e2d80369f072d66202a43c1304e83a7d0ef7c6103d4968a03aea9666cc89a7203c618da972124a677b38cfe62ddaeb28f9f5d
2018-09-24 17:24:06 -04:00
Patrick Strateman 032488e6e7 Move SocketHandler logic to private method. 2018-09-24 17:08:10 -04:00
Patrick Strateman 2af9cff11a Move InactivityCheck logic to private method. 2018-09-24 17:08:04 -04:00
Patrick Strateman 7479b63d91 Move DisconnectNodes logic to private method. 2018-09-24 16:53:52 -04:00
Patrick Strateman edb5350c32 Move NotifyNumConnectionsChanged logic to private method. 2018-09-24 16:30:53 -04:00
MarcoFalke 37612099ec
Merge #13424: Consistently validate txid / blockhash length and encoding in rpc calls
5eb20f81d9 Consistently use ParseHashV to validate hash inputs in rpc (Ben Woosley)

Pull request description:

  ParseHashV validates the length and encoding of the string and throws
  an informative RPC error on failure, which is as good or better than
  these alternative calls.

  Note I switched ParseHashV to check string length first, because
  IsHex tests that the length is even, and an error like:
  "must be of length 64 (not 63, for X)" is much more informative than
  "must be hexadecimal string (not X)" in that case.

  Split from #13420

Tree-SHA512: f0786b41c0d7793ff76e4b2bb35547873070bbf7561d510029e8edb93f59176277efcd4d183b3185532ea69fc0bbbf3dbe9e19362e8017007ae9d51266cd78ae
2018-09-24 15:09:11 -04:00
gustavonalle db15805668 [wallet] Ensure wallet is unlocked before signing 2018-09-24 18:13:22 +01:00
practicalswift 97ddc6026b validation: Pass chainparams in AcceptToMemoryPoolWorker(...) 2018-09-24 16:03:06 +02:00
MarcoFalke 985d28cc90
Merge #14297: [RPC] Remove warning for removed estimatefee RPC
1eb9a9b524 [RPC] Remove warning for removed estimatefee RPC (John Newbery)

Pull request description:

  The  RPC was removed in a previous version, but a warning was
  left for users to use the estimatesmartfee RPC. Remove that warning now
  that estimatefee has been gone for over one version.

Tree-SHA512: 7fb440a354a5058f9e95930306d7fe0c1cba6563b9a44b7388a17d9e5c3cff42023f5aa1728fd94a1a11249ea4a8615a8a891afe4fa81ae46b61c2aa08e9cc47
2018-09-24 08:20:57 -04:00
MarcoFalke f5035f9d0f
Merge #14298: [REST] improve performance for JSON calls
30973e9844 [REST] improve performance for JSON calls (Antoine Le Calvez)

Pull request description:

  JSON calls do not use the raw data generated for the .bin and .hex calls.

  By moving the raw data creation into the .bin and .hex switch branches, JSON calls' performance is improved.

  Light benchmarking indicates that fetching 2000 JSON headers is ~25% faster, fetching large JSON blocks is ~4% faster.

Tree-SHA512: 433552c89bac2469d041b48a4a991d5443e4026a3ad7dc5621685386029f22826484218642fa5130c268349a55524ecbc4e30d64c867bd6632e0edd24370cf11
2018-09-24 07:49:27 -04:00
MarcoFalke e798ae41e0
Merge #13546: wallet: Fix use of uninitialized value bnb_used in CWallet::CreateTransaction(...)
a23a7f60aa wallet: Avoid potential use of unitialized value bnb_used in CWallet::CreateTransaction(...) (practicalswift)

Pull request description:

  Avoid use of uninitialized value `bnb_used` in `CWallet::CreateTransaction(...)`.

Tree-SHA512: 22faf0711ae35af44d9a0ab7f251bc01661ac88b40ad7b0a87a510427b46bbc8caf16868cab2e0a05e7d8518e93ce666d6bd1d48d3707d37bab2c0fb56a0a4a2
2018-09-24 07:37:18 -04:00
Jorge Timón 6fa901fb47
Don't edit Chainparams after initialization 2018-09-23 22:58:54 +02:00
Jorge Timón 980b38f8a1
MOVEONLY: Move versionbits info out of versionbits.o 2018-09-23 22:55:11 +02:00
Antoine Le Calvez 30973e9844 [REST] improve performance for JSON calls
JSON calls do not use the raw data generated for
the .bin and .hex calls. By moving the raw data
creation into the .bin and .hex switch branches,
JSON calls become faster.
2018-09-23 14:12:42 +01:00
John Newbery ebec90ac97 [wallet] Remove deprecated addwitnessaddress RPC method 2018-09-23 08:53:16 -04:00
John Newbery 1eb9a9b524 [RPC] Remove warning for removed estimatefee RPC
The  RPC was removed in a previous version, but a warning was
left for users to use the estimatesmartfee RPC. Remove that warning now
that estimatefee has been gone for over one version.
2018-09-22 23:27:01 -04:00
Chun Kuan Lee 2c3eade704 Make fs::path::string() always return utf-8 string 2018-09-23 03:43:25 +08:00
Andrew Chow f8c1714634 Convert non-witness UTXOs to witness if witness sig created
If a witness signature was created when a non-witness UTXO is used,
convert the non-witness UTXO to a witness one.
2018-09-22 15:27:01 -04:00
MarcoFalke 2796c6e5ec
Merge #14214: convert C-style (void) parameter lists to C++ style ()
3ccfa34b32 convert C-style (void) parameter lists to C++ style () (Arvid Norberg)

Pull request description:

  In C, an empty parameter list, `()`, means the function takes any arguments, and `(void)` means the function does not take any parameters.
  In C++, an empty parameter list means the function does not take any parameters.

  So, C++ still supports `(void)` parameter lists with the same semantics, why change to `()`?

  1. removing the redundant `void` improves signal-to-noise ratio of the code
  2. using `(void)` exposes a rare inconsistency in that a template taking a template `(T)` parameter list, cannot be instantiated with `T=void`

Tree-SHA512: be2897b6c5e474873aa878ed6bac098382cd21866aec33752fe40b089a6331aa6263cae749aba1b4a41e8467f1a47086d32eb74abaf09927fd5a2f44a4b2109a
2018-09-20 17:57:20 -04:00
John Newbery 25548b2958
[wallet] Remove -usehd 2018-09-20 17:26:14 -04:00
MarcoFalke fa910e4301
init: Remove deprecated args from hidden args 2018-09-19 16:47:32 -04:00
MarcoFalke 920c090f63
Merge #14287: tests: Use MakeUnique to construct objects owned by unique_ptrs
b6718e373e tests: Use MakeUnique to construct objects owned by unique_ptrs (practicalswift)

Pull request description:

  A subset of #14211 ("Use MakeUnique to construct objects owned by unique_ptrs") as suggested by @MarcoFalke in https://github.com/bitcoin/bitcoin/pull/14211#issuecomment-423324019.

  Use `MakeUnique` to construct objects owned by `unique_ptr`s.

  Rationale:
  * `MakeUnique` ensures exception safety in complex expressions.
  * `MakeUnique` gives a more concise statement of the construction.

Tree-SHA512: 1228ae6ce7beb178d79142c4e936b728178ccaa8aa35c6d8feeb33d1a667abfdd010c59996a9d833594611e913877ce5794e75953d11d9b1fdbac04aa491d9cf
2018-09-19 13:26:47 -04:00
practicalswift b6718e373e tests: Use MakeUnique to construct objects owned by unique_ptrs 2018-09-21 11:03:21 +02:00
practicalswift a23a7f60aa wallet: Avoid potential use of unitialized value bnb_used in CWallet::CreateTransaction(...) 2018-09-19 14:11:14 +02:00
MarcoFalke d26278988f
Merge #13152: [rpc] Add getnodeaddresses RPC command
a2eb6f5405 [rpc] Add getnodeaddresses RPC command (chris-belcher)

Pull request description:

  Implements issue https://github.com/bitcoin/bitcoin/issues/9463

  New getnodeaddresses call gives access via RPC to the peers known by the node. It may be useful for bitcoin wallets to broadcast their transactions over tor for improved privacy without using the centralized DNS seeds. getnodeaddresses is very similar to the getaddr p2p method.

  Please advise me on the best approach for writing an automated test. By my reading the getaddr p2p method also isn't really tested.

Tree-SHA512: ad03abf518847476495b76a2f5394b8030aa86654429167fa618e21460abb505c10ef9817ec1b80472320d41d0aff5dc94a8efce023aaaaf5e81386aa92b852b
2018-09-18 19:50:00 -04:00
Karl-Johan Alm bf2e010973
uint256: Remove unnecessary crypto/common.h use 2018-09-18 14:27:05 +09:00
Chun Kuan Lee 82d6c5aad3 gui: Show watch-only eye instead of HD disabled 2018-09-18 11:12:05 +08:00
chris-belcher a2eb6f5405 [rpc] Add getnodeaddresses RPC command
New getnodeaddresses call gives access via RPC to the peers known by
the node. It may be useful for bitcoin wallets to broadcast their
transactions over tor for improved privacy without using the
centralized DNS seeds. getnodeaddresses is very similar to the getaddr
p2p method.

Tests the new rpc call by feeding IP address to a test node via the p2p
protocol, then obtaining someone of those addresses with
getnodeaddresses and checking that they are a subset.
2018-09-17 22:55:23 +01:00
Suhas Daftuar b8f801964f Fix crash bug with duplicate inputs within a transaction
Introduced by #9049
2018-09-17 15:50:55 -04:00
MarcoFalke fa84723e73
amount: Move CAmount CENT to unit test header 2018-09-17 14:34:56 -04:00
Wladimir J. van der Laan 2d4749b366
Merge #13578: [depends, zmq, doc] upgrade zeromq to 4.2.5 and avoid deprecated zeromq api functions
f1bd03eb01 [depends, zmq, doc] upgrade zeromq to 4.2.5 and avoid deprecated zeromq api functions (mruddy)

Pull request description:

  Upgrade the ZeroMQ dependency from version 4.2.3 to the latest stable version 4.2.5.

  This PR Follows the lead of https://github.com/bitcoin/bitcoin/pull/11986.

  I upgraded both patch files to correspond to the version `4.2.5` libzmq files.
  I assume doing so is still necessary and correct.

  Without updating the patch line numbers, things appear to work, but you get extra log messages while building `depends` because things don't exactly match, e.g.:
  ```
  /bitcoin/depends> make zeromq
  Extracting zeromq...
  /bitcoin/depends/sources/zeromq-4.2.5.tar.gz: OK
  Preprocessing zeromq...
  patching file src/windows.hpp
  Hunk #1 succeeded at 58 (offset 3 lines).
  patching file src/thread.cpp
  Hunk #1 succeeded at 307 with fuzz 2 (offset 87 lines).
  Hunk #2 succeeded at 323 with fuzz 2 (offset 90 lines).
  ```
  Updating the patches seemed cleaner, so I did it. Note that libzmq had some whitespace changes, so that's why the updated patches do too.

  More info: https://github.com/zeromq/libzmq/releases/tag/v4.2.5

  tags: libzmq, zmq, 0mq

Tree-SHA512: 78659dd276b5311e40634b1bbebb802ddd6b69662ba3c84995ef1e3795c49a78b1635112c7fd72a405ea36e2cc3bdeb84e6d00d4e491a349bba1dafff50e2fa5
2018-09-17 13:54:42 +02:00
Arvid Norberg be54f42e5f use integer division instead of double conversion and multiplication for computing amounts 2018-09-15 12:45:41 -07:00
MarcoFalke c53e083a49
Merge #14212: build: Remove libssl from LDADD unless gui
cccc362d62 build: Remove libssl from LDADD unless gui (MarcoFalke)

Pull request description:

  libssl is only used by the gui, so no need to LDADD it to the other tools and binaries

  Follow up of the commit which removed rpcssl: 40b556d374

Tree-SHA512: 9dbdf4faf40699cea3a37349ac83dbcacdaa062f5338416ff4ba77924c47d9e148b27218165c5aa3584a1ef4899e0fa237ff571208aa0b98803761e802d1e5dc
2018-09-15 09:35:14 -04:00
Wladimir J. van der Laan de89eec25d
Merge #14206: doc: Document -checklevel levels
8e1c13e6da doc: Document -checklevel levels (Wladimir J. van der Laan)

Pull request description:

  Document the various possible check levels for the command-line argument. The numbers say nothing on their own.

Tree-SHA512: 8a526c53222b55304dde1d9350dd15a50f1dd62bf452a32dc886a4521e3ab49d5f0a86a4c5cbb0d52fb76b60222101045100f93fee5e1a5d5e3ab8e79b64cbe0
2018-09-15 12:01:31 +02:00
Wladimir J. van der Laan 8e1c13e6da doc: Document -checklevel levels
Document the various possible check levels for the command-line
argument. The numbers say nothing on their own.
2018-09-15 10:17:07 +02:00
Wladimir J. van der Laan f09bc7ec98
Merge #12493: [wallet] Reopen CDBEnv after encryption instead of shutting down
c1dde3a949 No longer shutdown after encrypting the wallet (Andrew Chow)
d7637c5a3f After encrypting the wallet, reload the database environment (Andrew Chow)
5d296ac810 Add function to close all Db's and reload the databae environment (Andrew Chow)
a769461d5e Move BerkeleyEnvironment deletion from internal method to callsite (Andrew Chow)

Pull request description:

  This is the replacement for #11678 which implements @ryanofsky's [suggestion](https://github.com/bitcoin/bitcoin/pull/11678#pullrequestreview-76464511).

  Shutting down the software was to prevent the BDB environment from writing unencrypted private keys to disk in the database log files, as was noted [here](https://bitcointalk.org/index.php?topic=51474.msg616068#msg616068). This PR replaces the shutdown behavior with a CDBEnv flush, close, and reopen which achieves the same effect: everything is cleanly flushed and closed, the log files are removed, and then the environment reopened to continue normal operation.

  To ensure that no unencrypted private keys are in the log files after encrypting the wallet, I wrote [this script](https://gist.github.com/achow101/7f7143e6c3d3fdc034d3470e72823e9d) to pull private keys from the original wallet file and searches for these keys in the log files (note that you will have to change your file paths to make it work on your own machine).

  As for concerns about private keys being written to slack space or being kept in memory, these behaviors no longer exist after the original wallet encryption PR and the shutting down solution from 2011.

  cc @ryanofsky

Tree-SHA512: 34b894283b0677a873d06dee46dff8424dec85a2973009ac9b84bcf3d22d05f227c494168c395219d9aee3178e420cf70d4b3eeacc9785aa86b6015d25758e75
2018-09-14 10:43:35 +02:00
MarcoFalke cccc362d62
build: Remove libssl from LDADD unless gui 2018-09-13 15:53:51 -04:00
Arvid Norberg 3ccfa34b32 convert C-style (void) parameter lists to C++ style () 2018-09-13 10:36:41 -07:00
Wladimir J. van der Laan d73205ef36
Merge #14192: utils: Convert fs::filesystem_error messages from local multibyte to utf-8 on Windows
e221368932 utils: Convert fs error messages from multibyte to utf-8 (Chun Kuan Lee)

Pull request description:

  Before:
  ![default](https://user-images.githubusercontent.com/11154118/45318798-8d83f480-b570-11e8-8cbb-c729a54f6b9e.png)
  After:
  ![2](https://user-images.githubusercontent.com/11154118/45318806-91177b80-b570-11e8-9474-a62342c92dbd.png)

Tree-SHA512: 0a598bd159286f6784d117b8a24888b2650d5402d687ab0e8d0849e0c3d53797e266647d8177bb6614307c9598019cd7477311bb9895b1bb52a6bd77b460fda1
2018-09-13 17:30:27 +02:00
Wladimir J. van der Laan 49fd485bbf
Merge #14208: [build] Actually remove ENABLE_WALLET
e4ef4b4595 [build] remove #ifdef ENABLE_WALLET from interfaces/node (John Newbery)

Pull request description:

  Adds a couple of redefinitions to dummywallet.cpp.

Tree-SHA512: d226bcccc46d089eac88beb54c31f6f18817682994b371f9793a5d28bec5d60dbdffacc8fc281807e25cc7f89da23e1f8f36fd99d12f8a40f77a972840e8c1b4
2018-09-13 15:50:16 +02:00
John Newbery e4ef4b4595 [build] remove #ifdef ENABLE_WALLET from interfaces/node
Removes the final #ifdef ENABLE_WALLET from libbitcoin_server by calling
g_wallet_init_interface.HasWalletSupport(), and redifining GetWallets()
and MakeWallet() in dummywallet.cpp.
2018-09-13 09:37:37 -04:00
MarcoFalke 962c302710
Merge #13983: rpc: Return more specific reject reason for submitblock
fa6ab8ada1 rpc: Return more specific reject reason for submitblock (MarcoFalke)

Pull request description:

  The second commit in #13439 made the `TODO` in the first commit impossible to solve.

  The meaning of `fNewBlock` changed from "This is the first time we process this block" to "We are about to write the new *valid* block".

  So whenever `fNewBlock` is true, the block was valid. And whenever the `fNewBlock` is false, the block is either valid or invalid. If it was valid and not new, we know it is a `"duplicate"`. In all other cases, the `BIP22ValidationResult()` will return the reason why it is invalid.

Tree-SHA512: 4b6edf7a912339c3acb0fccfabbdd6d812a0321fb1639c244c2714e58dc119aa2b8c6bf8f7d61ea609a1b861bbc23f920370fcf989c48452721e259a8ce93d24
2018-09-13 09:28:46 -04:00
Wladimir J. van der Laan b9ed2fd026
Merge #13310: Report progress in ReplayBlocks while rolling forward
b16ab9af07 Report progress in ReplayBlocks while rolling forward (João Barbosa)

Pull request description:

  Fixes #13303.

Tree-SHA512: 9375bda03bd2527018b9d24a25c82fa01a841e41ae2cb5307be61af19e2b759d3a7db76852baba9a286fbcb52f70f427a5ab4375df08215ac439e47e73633e54
2018-09-13 14:07:20 +02:00
Luke Dashjr a2a04a5abb Bugfix: Only run bitcoin-tx tests when bitcoin-tx is enabled 2018-09-13 11:48:25 +00:00
Luke Dashjr 92af71cea9 configure: Make it possible to build only one of bitcoin-cli or bitcoin-tx 2018-09-13 11:48:23 +00:00
Wladimir J. van der Laan 37b836ad09
Merge #13888: Call unicode API on Windows
d38bf9105d Call unicode API on Windows (Chun Kuan Lee)

Pull request description:

  Call Unicode API on Windows

Tree-SHA512: 93c290ee79c9d911fdada8ba45e184fc4f14d3cb56f33f39223286213878b08e8c4dd296a80099c57797d3b8589870e6cff622b22e76123d7452659d49dd8309
2018-09-13 12:11:44 +02:00
Wladimir J. van der Laan 477f258755
Merge #14207: doc: -help-debug implies -help
d0b1cee1fe doc: `-help-debug` implies `-help` (Wladimir J. van der Laan)

Pull request description:

  I don't understand why `-help-debug` would be useful without requesting the help, and I've made this particular mistake one time too many.

Tree-SHA512: 370eab368d672fc09e66fcc440db3cb7e4c70c2988aab506cdc3f3e234c27c8f0fc7512c9cf86606ac43f5c6023b3618b7b0302b4b6e289b388559ba8010f27a
2018-09-13 12:00:36 +02:00
Wladimir J. van der Laan 81b3f3c7a3
Merge #14195: Pass privkey export DER compression flag correctly
9a565a8282 Pass export privkey DER compression flag correctly (liuyujun)

Tree-SHA512: 3fa1d7568ce133cd22708f453f3252c1138b1c40a821e90546d83bee4aac117ac8d848fa46cb45efad1031ce03cd5ba2d6c89b459abca6703aa2a957531e7edf
2018-09-13 09:59:39 +02:00
liuyujun 9a565a8282 Pass export privkey DER compression flag correctly
By passing a bitfield where a boolean was expected, the result was
always compressed. Fix this.
2018-09-13 09:58:26 +02:00
Wladimir J. van der Laan 1bfcc0696c
Merge #14209: logging: Replace LogPrint macros with regular functions
fae3fbd61a logging: Replace LogPrint macros with regular functions (MarcoFalke)

Pull request description:

  It is not possible to run the full test suite when configured with `--enable-lcov`, since logging is disabled currently so that "unnecessary branches are not analyzed". (See c8914b9dbb)

  Fix this instead by replacing the macros with functions.

Tree-SHA512: 101aa4f4a3ffcefc38faf70c9d3deb5fc63e0b11ca54a164d0463931c79eaf53ab0b0c6ae92a45355574e3b1d2c32233874a6b24293e7a09d188fc6698e212a5
2018-09-13 09:45:22 +02:00
Wladimir J. van der Laan d0b1cee1fe doc: -help-debug implies -help
I don't understand why `-help-debug` would be useful without requesting
the help, and I've made this particular mistake one time too many.

(ok, so apparently the original reason that -help-debug is an option is
to show debug options in the GUI option overview? that seems very
unlikely to ever be used, if someone wants to add a way to show debug
options in the GUI it'd be better to have a check box)
2018-09-13 07:57:13 +02:00
Pierre Rochard 2d471636eb wallet: Remove trailing separators from -walletdir arg 2018-09-12 21:05:53 -04:00
Pierre Rochard ea3009ee94 wallet: Add walletdir arg unit tests 2018-09-12 21:05:53 -04:00
MarcoFalke fae3fbd61a
logging: Replace LogPrint macros with regular functions 2018-09-12 11:28:01 -04:00
Wladimir J. van der Laan 8f464549c4
Merge #14204: build: Move interfaces/* to libbitcoin_server
e0664f7f54 build: Move interfaces/* to libbitcoin_server (Wladimir J. van der Laan)

Pull request description:

  Move interfaces/* from libbitcoin_util to libbitcoin_server.

  Usage of these is shared between `bitcoind` and `bitcoin-qt`. It is unnecessary for them to be linked against the other utilities. Also semantically they belong with the server/node, I think.

Tree-SHA512: f82f3a95d362051c0eb8092520715f77c2c75409d41f9c0fab9a15445ea9e79a2a36b5d00b1f5be09b266584051934a32a8b9b28f783f4d7be78885b4a29a383
2018-09-12 17:11:17 +02:00
Wladimir J. van der Laan 1c12cf6073
Merge #13886: utils: run commands using utf-8 string on Windows
23db9546c1 utils: run commands using utf-8 string on Windows (Chun Kuan Lee)

Pull request description:

  Use unicode string to call commans

Tree-SHA512: 72f84e7b56cd947ad05176f10b5ddd5610f4641ba5e93ffd67777dea8f9734ec06e6ed3a63f67ae5e766767122c0dd2c441d0bad5572bdb9fb78758f02531feb
2018-09-12 11:21:04 +02:00
Wladimir J. van der Laan e0664f7f54 build: Move interfaces/* to libbitcoin_server
These are shared between bitcoind and bitcoin-qt. It is unnecessary for
them to be linked against the other utilities.
2018-09-12 09:35:41 +02:00
mruddy f1bd03eb01 [depends, zmq, doc] upgrade zeromq to 4.2.5 and avoid deprecated zeromq api functions 2018-09-11 16:33:05 -04:00
MarcoFalke fa511e8dad
Pass tx pool reference into CheckSequenceLocks 2018-09-11 12:08:17 -04:00
MarcoFalke 4103cc3169
Merge #14168: Remove ENABLE_WALLET from libbitcoin_server.a
7d038dcb41 [build] remove ENABLE_WALLET ifdef from httprpc.cpp (John Newbery)
3076556cd0 [build] Move dummy wallet into its own .cpp file. (John Newbery)

Pull request description:

  This removes the final instances of ENABLE_WALLET in libbitcoin_server and so completes #7965.

Tree-SHA512: a49128b7c17f4f69940d5843e6b785f08687efb377b5157d5b267d1205e596eb5c1966f1afb8ab36bcc2491c46252099e3e844c91f5623da8ded2e358d46338d
2018-09-11 09:46:42 -04:00
Chun Kuan Lee d38bf9105d Call unicode API on Windows 2018-09-11 21:09:46 +08:00
Wladimir J. van der Laan 362518791a
Merge #13734: gui: Drop boost::scoped_array and use wchar_t API explicitly on Windows
bb6ca65f98 gui: get special folder in unicode (Chun Kuan Lee)
1c5d225853 Drop boost::scoped_array (Chun Kuan Lee)

Pull request description:

  Drop boost::scoped_array and simplify the code.

  `TCHAR` should be defined as `wchar_t` if `UNICODE` is defined. So we can use `.toStdWString().c_str()` to get wchar_t C-style string.

  Fix #13819

Tree-SHA512: 3fd4aa784129c9d1576b01e6ee27faa42d793e152d132f2dde504d917dad3a8e95e065fcbc54a3895d74fb6b2a9ed4f5ec67d893395552f585e225486a84a454
2018-09-11 10:58:10 +02:00
Wladimir J. van der Laan e3fec3cfa8
Merge #13419: [tests] Speed up knapsack_solver_test by not recreating wallet 100 times.
a679109be4 Speed up knapsack_solver_test by not recreating wallet 100 times. (lucash.dev@gmail.com)

Pull request description:

  Optimization of `knapsack_solver_test`by moving an expensive wallet creation to outside a 100x for loop.

  On my (slow) machine:

  ```
  before:        9.8s
  after:         6.2s
  --------------------
  saved:         3.6s (36%)
  ```

  This PR was split from #13050. Also see #10026.

Tree-SHA512: bde1a856b5f076a5845e14d1a924855c8c91742c3139b47903081289b21d01fef6f2d1fd8947058728a57de56f877bab3866af8cd1d25ba2daa44411752cdb2f
2018-09-11 10:22:36 +02:00
Wladimir J. van der Laan bcffd8743e
Merge #13558: Drop unused GetType() from CSizeComputer
893628be01 Drop minor GetSerializeSize template (Ben Woosley)
da74db0940 Drop unused GetType() from CSizeComputer (Ben Woosley)

Pull request description:

  Based on conversation in #13462, it seems the serialization `GetType` has very narrow use/effect. In every case except for `CAddress`, which specifically relates to a network peer's address, not a wallet address etc., the serialized representation of an object is irrespective of its destination / type.

  This removes the unused `GetType` method from `CSizeComputer` as a step to further narrowing that use.

Tree-SHA512: e72b8e9e5160396691e05aeaee3aba5a57935a75bd5005cfcc7fb51c936f3d1728a397f999da5c36696506dd815fafa5c738f3894df8864f25f91f639eba9c3d
2018-09-11 09:29:38 +02:00
Wladimir J. van der Laan 3783b139e9
Merge #13866: utils: Use _wfopen and _wfreopen on Windows
b9babc82dd utils: Use _wfopen and _wreopen on Windows (Chun Kuan Lee)

Pull request description:

  The fopen function does not support unicode filename on Windows, so use Windows specific function do deal with it.

Tree-SHA512: 4dcf14dcf9ec6307b9fdf95404e5b6b6b3df640949fd4b0c4ac7fecf8ea03a64fa25285fc319c4ff8a28e586eee106f1861116c181694955497402b2bf575f22
2018-09-11 09:02:26 +02:00
Wladimir J. van der Laan 7ab2837b65
Merge #14162: gui: Also log and print messages or questions like bitcoind
fa7e9694e1 qt: Also log and print messages or questions like bitcoind (MarcoFalke)
dd031e3839 noui: Move handlers to header file (MarcoFalke)

Pull request description:

  Testing and debugging after shutdown are harder if the node was run through the gui, because errors and warnings would not be logged to the debug.log or written to the stderr (as is the case for bitcoind).

Tree-SHA512: 1154e2bf02e3c2616c8d28609569d6c3c7344c5877ad5c1303245044cc7aced9eaec9627f1e1258ed087b49c2a2e6f99bc6c1ad0abe0a855b61e737bdf2059bc
2018-09-11 08:41:39 +02:00
Ben Woosley 893628be01
Drop minor GetSerializeSize template
Now that `GetType()` is not propagated, the benefits are not worth the code.
2018-09-11 00:58:13 -04:00
Ben Woosley da74db0940
Drop unused GetType() from CSizeComputer 2018-09-11 00:58:05 -04:00
Chun Kuan Lee e221368932 utils: Convert fs error messages from multibyte to utf-8 2018-09-11 03:11:39 +08:00
John Newbery 7d038dcb41 [build] remove ENABLE_WALLET ifdef from httprpc.cpp 2018-09-10 14:27:32 -04:00
Wladimir J. van der Laan 13c842e028
Merge #9332: Let wallet importmulti RPC accept labels for standard scriptPubKeys
98ea64cf23 Let wallet importmulti RPC accept labels for standard scriptPubKeys (Russell Yanofsky)

Pull request description:

  Allow importmulti RPC to apply address labels when importing standard scriptPubKeys. This makes the importmulti RPC less finnicky about import formats and also simpler internally.

Tree-SHA512: 102426b21239f1fa5f38162dc3f4145572caef76e63906afd786b7aff1670d6cd93456f8d85f737588eedc49c11bef2e1e8019b8b2cbf6097c77b3501b0cab1f
2018-09-10 19:02:44 +02:00
Wladimir J. van der Laan e0a4f9de7f
Merge #13793: tx pool: Use class methods to hide raw map iterator impl details
faa1a74942 tx pool: Use class methods to hide raw map iterator impl details (MarcoFalke)

Pull request description:

  ATMP et al would often use map iterator implementation details such as `end()` or `find()`, which is acceptable in current code.

  However, this not only makes it impossible to turn the maps into private members in the future but also makes it harder to replace the maps with different data structures.

  This is required for and split off of #13804

Tree-SHA512: 4f9017fd1d98d9df49d25bba92655a4a97755eea161fd1cbb565ceb81bbc2b4924129d214f8a29563a77e3d8eef85a67c81245ecdc9a9e5292d419922a93cb88
2018-09-10 18:32:00 +02:00
Wladimir J. van der Laan 838b85e120
Merge #14008: Preserve a format of RPC command definitions
d9d79576f4 Preserve a format of RPC command definitions (Kostiantyn Stepaniuk)

Pull request description:

  Currently, RPC commands are formatted in a way that it's easy to read
  and that `test/lint/check-rpc-mappings.py` can parse it.

  To void breaking `test/lint/check-rpc-mappings.py` script by running
  `clang-format`, RPC command definitions should be disabled for clang-format.

Tree-SHA512: e17d20ec0e6c4e19410198b55687ebbe6fa01654d214d4578cd16c00b872bf8b0b306594a45523685cd2e9d9280702e00471d9366e87954428e8bbeacd8cad60
2018-09-10 18:14:05 +02:00
Wladimir J. van der Laan 7c7bb6e772
Merge #14127: build: avoid getifaddrs when unavailable
9256f7d13f build: avoid getifaddrs when unavailable (Cory Fields)

Pull request description:

  These changes from @theuni help building when targeting platforms that don't always have getifaddrs available like Android < 24

Tree-SHA512: dbfeb83297bd6f00b7991f53eef8a04948d2d739bf47c0524d9ae5335b843b8a5c06ff98c109fe5e6192665e6d0cf58700b8aa7e2a0b410281d3c052881973ff
2018-09-10 18:08:05 +02:00
Wladimir J. van der Laan 6eeac2e628
Merge #14138: wallet: Set encrypted_batch to nullptr after delete. Avoid double free in the case of NDEBUG.
fa462b3657 wallet: Set encrypted_batch to nullptr after delete. Avoid double free in the case of NDEBUG. (practicalswift)

Pull request description:

  Set `encrypted_batch` to `nullptr` after delete. Avoid double free in the case of `NDEBUG`.

Tree-SHA512: 6f5ab40c82dd8c8713bbf1aacacdc837277c04769807f985248546be1c7ea269813c95379fbef982ac5683a45af0225613460a7446c39673b033f5f5edde2f5a
2018-09-10 17:59:15 +02:00
Wladimir J. van der Laan 321075609d
Merge #14054: p2p: Disable BIP 61 by default
faea5bfc5a doc: release notes for -enablebip61 default change (MarcoFalke)
fa14b54a87 p2p: Disable BIP 61 by default (MarcoFalke)

Pull request description:

  The live p2p network should not be used for debugging or as development aid when implementing the p2p protocol. Instead, applications should be tested locally (e.g. by inspecting the debug log of a validating node on the local network)

  Using the p2p network for this purpose seems wasteful and even dangerous, as peers can not be trusted to send the correct reject messages or a reject message at all.

Tree-SHA512: 9c91ad035b5110942172a3b4b8a332a84e0c0aa9ee80f8134aeab63e66ac604841e68b04038681c288b716e5e0cbe38065eb5c7eb63fa72c3bdb3255a4b2d99d
2018-09-10 17:57:47 +02:00
MarcoFalke 793d2b7430
Merge #14164: Update univalue subtree
dc287c98f8 Squashed 'src/univalue/' changes from 51d3ab34ba..7890db99d6 (MarcoFalke)

Pull request description:

  This removes the deprecated `std::pair` wrappers from univalue, so that they are not accidentally re-introduced in our code base.

Tree-SHA512: 46f6f7c7c7942a9e131d971c425cbde4159abcc1214235b61139ce97b174024e47b9c52e832cde89fbab9879f43d12c26b64d6def9907bd47883f1e574cf2e2e
2018-09-10 11:00:46 -04:00
Wladimir J. van der Laan fbfa2e46ff
Merge #14057: [Logging] Only log "Using config file PATH_TO_bitcoin.conf" message on startup if conf file exists
946107a68f Only log "Using PATH_TO_bitcoin.conf" message on startup if conf file exists. (Alexander Leishman)

Pull request description:

  Currently we log a message indicating that a bitcoin.conf file is being used even if one does not exist. This PR changes the logic to:

  **If config file does not exist and no -conf flag passed, log:**
  `Config file: FILE_PATH (not found, skipping)`. Where `FILE_PATH` is the default or the path passed in with the `-conf` flag.

  **If config file does not exist and -conf flag passed with incorrect path, log warning:**
  `Warning: The specified config file FILE_PATH does not exist`

  **If config file exists, log**:
  `Config file: FILE_PATH`

  Note: This is a (modified) subset of changes introduced in https://github.com/bitcoin/bitcoin/pull/13761 which creates a default example config file. I think it makes sense to extract this small bit out into a separate PR.

Tree-SHA512: be0f0ae6a0c9041e2d6acb54d2563bbcc79786fb2f8bf9a963fe01bc54cd4e388b89079fde1eb79f7f17099776428e5e984bf7107590a3d1ecfc0562dbc6e3f5
2018-09-10 15:39:05 +02:00
Michael Polzer bc8aa2ba78
don't translate command line options 2018-09-10 13:08:25 +02:00
João Barbosa b9f226b41f rpc: Remove cs_main lock from blockToJSON and blockHeaderToJSON 2018-09-09 18:02:24 +01:00
João Barbosa 343b98cbcd rpc: Specify chain tip instead of chain in GetDifficulty 2018-09-09 18:02:22 +01:00
João Barbosa 54dc13b6a2 rpc: Fix SoftForkMajorityDesc and SoftForkDesc signatures 2018-09-09 18:00:07 +01:00
Wladimir J. van der Laan eea87ef537
Merge #12775: Integration of property based testing into Bitcoin Core
b2f49bd732 Integration of property based testing into Bitcoin Core (Chris Stewart)

Pull request description:

  This PR is a subset of the changes in #8469. It's meant to be easier to review. This PR contains all of the build instructions needed for travis to pass. It includes one property call `key_properties.cpp` along with a generator file called `crypto_gen.{h,cpp}`.

Tree-SHA512: 895c9d9273dcd29f696b1de8dfe1ee843095831bf1f68472844181278850bec36b20f0ba7e51e796112c5cc75cd24759f9f1771906503bbf3af16f627e18c6c9
2018-09-08 05:33:16 +02:00
John Newbery 3076556cd0 [build] Move dummy wallet into its own .cpp file.
Removes the ifdef ENABLE_WALLET from init.cpp.
2018-09-07 16:08:40 -04:00
MarcoFalke fb06eb4ef7
Merge #13662: Explain when reindex-chainstate can be used instead of reindex
65a449f8e3 Explain when reindex-chainstate can be used instead of reindex (Sjors Provoost)

Pull request description:

  Save users from having to Google this: https://bitcoin.stackexchange.com/a/60711

Tree-SHA512: 3128565d037c77265a2ecf3bce137b8d27740f513802a4e683be06f21a75b82ee6cc22eb903181c4f438a2990cb682ce1d076f4d3af33d5aaa79b783a9f664b1
2018-09-07 14:21:38 -04:00
MarcoFalke faa1a74942
tx pool: Use class methods to hide raw map iterator impl details 2018-09-07 13:04:02 -04:00
MarcoFalke faad55a9a2
Update univalue subtree 2018-09-07 08:21:14 -04:00
MarcoFalke fa14b54a87
p2p: Disable BIP 61 by default 2018-09-07 08:11:27 -04:00
MarcoFalke 4799b0932a
Merge #12490: [Wallet] [RPC] Remove deprecated wallet rpc features from bitcoin_server
f7e9e70468 [rpc] Remove deprecated sigrawtransaction rpc method. (John Newbery)
90c834089a [RPC] Remove warning about wallet addresses in createmultisig() (John Newbery)
df905e390e [rpc] Remove deprecated validateaddress usage. (John Newbery)

Pull request description:

  The following rpc features were deprecated in V0.17:

  - `validateaddress` returning wallet information about an address
  - `signrawtransaction`

  This PR fully removes those features. It can be merged once V0.17 has been branched from master.

Tree-SHA512: 28293d218cf7e348632081e362f8775f243d091f49aed54c354f017d4a12ae92b87b99f81ee592a1bbf4aebd5d8cd5119278141edde7a0399ff82917ed68b9f6
2018-09-06 23:01:50 -04:00
MarcoFalke fa7e9694e1
qt: Also log and print messages or questions like bitcoind 2018-09-06 15:19:56 -04:00
MarcoFalke dd031e3839 noui: Move handlers to header file 2018-09-06 15:00:01 -04:00
Wladimir J. van der Laan 2f7ae35ce8
Merge #14149: doc: Remove misleading checkpoints comment in CMainParams
fab5267514 doxygen: Remove misleading checkpoints comment in CMainParams (MarcoFalke)

Pull request description:

  This removes the checkpoints comment because it is misleading for two reasons:

  * It shows up in the doxygen documentation of `CMainParams` https://dev.visucore.com/bitcoin/doxygen/class_c_main_params.html
  * The comment refers to "strange transactions" in a block, which are not specified further. Transactions in blocks are always consensus-valid or rejected as consensus-invalid.

  Also sort the includes with `clang-format`, as the file is touched anyway.

Tree-SHA512: b75f38dd0422b9310218307cbaa4dd5afa7579612d7dcdf781b8f25626f79c11e090dbcc83a05571f4418220c1a005f6254a9c461534d517ccecf7f1920be6be
2018-09-06 15:55:13 +02:00
Wladimir J. van der Laan 35d7d9471f
Merge #14096: Add reference documentation for descriptors language
2b5d6f8df2 Replace duplcate reference with reference to reference doc (Pieter Wuille)
89709db7a2 Adjust TODO link (Pieter Wuille)
9254ffcf2d Add descriptor reference documentation (Pieter Wuille)

Pull request description:

Tree-SHA512: 1ca0d537f9bcbb23266e9a4a02a60013ef8309958fb701f638283887585b5ddea6bc9dab859454ec3a373b1a12a4fd69836e7030417bb2ca43fef26b104c0d65
2018-09-06 14:51:07 +02:00
Wladimir J. van der Laan a6aca8dc2f
Merge #14105: util: Report parse errors in configuration file
ed2332aeff test: Add test for config file parsing errors (MarcoFalke)
a66c0f78a9 util: Report parse errors in configuration file (Wladimir J. van der Laan)

Pull request description:

  Report errors while parsing the configuration file, instead of silently ignoring them.

      $ src/bitcoind -regtest
      Error reading configuration file: parse error on line 22: nodebuglogfile, if you intended to specify a negated option, use nodebuglogfile=1 instead
      $ src/bitcoind -regtest
      Error reading configuration file: parse error on line 22: sdafsdfafs
      $ src/bitcoind -regtest
      Error reading configuration file: parse error on line 24: -nodebuglogfile=1, options in the configuration file must be specified without leading -

  (inspired by https://github.com/bitcoin/bitcoin/pull/14100#issuecomment-417264823)

Tree-SHA512: d516342b65db2969edf200390994bbbda23654c648f85dcc99f9f2d217d3d59a72e0f58227be7b4746529dcfa54ba26d8188ba9f14a57c9ab00015d7283fade2
2018-09-06 12:56:10 +02:00
MarcoFalke adf27b531a
Merge #13954: Warn (don't fail!) on spelling errors. Fix typos reported by codespell.
f8a81f73ac lint: Add spell check linter (codespell) (practicalswift)
ada356208e Fix typos reported by codespell (practicalswift)

Pull request description:

  * Check for common misspellings using `codespell`.
  * Fix recently introduced typos reported by `codespell`.

Tree-SHA512: 9974c0e640b411c7d0ebc5b45de253c19bac7fe3002cd98601ff8da8db584224c2fd7d331aee3df612c9f2cfef540d647a9b4c5a1a73fd208dc93ce4bf9e5e3e
2018-09-05 18:13:05 -04:00
Pieter Wuille 2b5d6f8df2 Replace duplcate reference with reference to reference doc 2018-09-05 11:27:43 -07:00
Pieter Wuille 89709db7a2 Adjust TODO link 2018-09-05 11:26:16 -07:00
Wladimir J. van der Laan e9a78e9b3b doc: Change documentation for =0 for non-boolean options
PR #12713 changed the interpretation for negation of non-boolean options
(e.g. -noconnect) to no longer set the option to 0, but to remove it
from the options.

I think this is better because it gets rid of the special meaning of
'0'.

However it needs to be documented. I attempt to do so in this PR.
Addreses #14064.
2018-09-05 14:18:23 +02:00
MarcoFalke fab5267514
doxygen: Remove misleading checkpoints comment in CMainParams 2018-09-04 13:42:42 -04:00
Wladimir J. van der Laan 5c24d3b98c
Merge #13249: Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.
f34c8c466a Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. (practicalswift)

Pull request description:

  Make objects in range declarations immutable by default.

  Rationale:
  * Immutable objects are easier to reason about.
  * Prevents accidental or hard-to-notice change of value.

Tree-SHA512: cad69d35f0cf8a938b848e65dd537c621d96fe3369be306b65ef0cd1baf6cc0a9f28bc230e1e383d810c555a6743d08cb6b2b0bd51856d4611f537a12e5abb8b
2018-09-04 15:50:08 +02:00
Wladimir J. van der Laan bdfeb5dfa8
Merge #14133: gui: Favor macOS show / hide action in dock menu
ee3a494f37 gui: Favor macOS show / hide action in dock menu (João Barbosa)

Pull request description:

  Before:

  <img width="188" alt="screen shot 2018-09-02 at 19 10 02" src="https://user-images.githubusercontent.com/3534524/44959393-5a44c400-aee5-11e8-90f4-9a30f67f7ee2.png">

  After:

  <img width="200" alt="screen shot 2018-09-02 at 19 19 01" src="https://user-images.githubusercontent.com/3534524/44959395-60d33b80-aee5-11e8-9773-1d04d3482115.png">

  Note that macOS toggles between `Hide` and `Show`.

Tree-SHA512: e616fabc5a4689355d924cb99ce33c0d4c6618e858002cef7521dc4783346ff882341cf8d7f667d7fb920a8337373eff37169cddc2da93e48f7710e5c41d0b93
2018-09-04 14:07:45 +02:00
practicalswift ada356208e Fix typos reported by codespell 2018-09-04 13:11:26 +02:00
Wladimir J. van der Laan 0f34dac67b
Merge #14013: [doc] Add new regtest ports in man following #10825 ports reattributions
e8c4a1e369 Add new regtest ports in doc following #10825 ports reattributions (Antoine Riard)

Pull request description:

  Following #10825, regtest ports for p2p connections and JSON-RPC connections have been remapped from 18333 and 18332 to 18444 and 18443. This change is not documented in the wiki or nowhere else and it's puzzling to guess why your regtest JSON-rpc connections all failed even if you're following the docs.

Tree-SHA512: e2a1b9b4059060d9ed0900c1554e124ed69ae3e4648474880795128e77c7324d68aba52e4acda2f47390a9c3d36629b777e3b8c0eb10f0e08a2b120c4119dff3
2018-09-04 12:51:06 +02:00
Wladimir J. van der Laan 564385f4bf
Merge #14094: refactoring: Remove unreferenced local variables
8ecaee13f7 Increase signal to noise in appveyor build output by reducing the MSVC warning count from 12 to 4 (12 is assuming the changes in #14086 are also implemented). (practicalswift)

Pull request description:

  Remove unreferenced local variables:

  Increase signal to noise in appveyor build output by reducing the MSVC warning count from 12 to 4. 12 is the number of MSVC warnings under our current appveyor setup assuming the changes in #14086 are also implemented.

  This makes it easier to spot errors or more important warnings in the verbose appveyor output. MSVC warnings are good, so having access to them in a noise free way (read: without trivial warnings) via appveyor without having to use Windows is really valuable.

  See https://github.com/bitcoin/bitcoin/pull/14086#issuecomment-416610313 plus discussion for context.

  Before:

  ```
  c:\projects\bitcoin\src\script\script.cpp(272): warning C4018: '>': signed/unsigned mismatch [C:\projects\bitcoin\build_msvc\libbitcoinconsensus\libbitcoinconsensus.vcxproj]
  c:\projects\bitcoin\src\rest.cpp(467): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\libbitcoin_server\libbitcoin_server.vcxproj]
  c:\projects\bitcoin\src\test\allocator_tests.cpp(147): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\coins_tests.cpp(511): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\coins_tests.cpp(524): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\coins_tests.cpp(722): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\coins_tests.cpp(783): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\crypto_tests.cpp(535): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\dbwrapper_tests.cpp(265): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\net_tests.cpp(118): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\net_tests.cpp(151): warning C4101: 'e': unreferenced local variable [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\scheduler_tests.cpp(57): warning C4305: 'argument': truncation from 'int' to 'bool' [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  ```

  After:

  ```
  c:\projects\bitcoin\src\script\script.cpp(272): warning C4018: '>': signed/unsigned mismatch [C:\projects\bitcoin\build_msvc\libbitcoinconsensus\libbitcoinconsensus.vcxproj]
  c:\projects\bitcoin\src\test\allocator_tests.cpp(147): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\crypto_tests.cpp(535): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  c:\projects\bitcoin\src\test\scheduler_tests.cpp(57): warning C4305: 'argument': truncation from 'int' to 'bool' [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
  ```

Tree-SHA512: 5051134126c570b8421d57c710f1f1b977600398d2b5e69f8a8bd766b3696f992bf4e3459643b99a6b7e08dee1adc92985ee4d0d52b20755954415cb6f23f2fb
2018-09-04 12:44:49 +02:00
Wladimir J. van der Laan 281feee7cc
Merge #14129: Trivial: update clang thread-safety docs url
c7f7fa467e Trivial: update clang thread-safety docs url (Ben Woosley)

Pull request description:

  From the defunct http://clang.llvm.org/docs/LanguageExtensions.html#threadsafety to https://clang.llvm.org/docs/ThreadSafetyAnalysis.html

Tree-SHA512: 5113c3933fccee7b45cace5d8dffa38b46ed9ad1422795d57843a20b276ed0e513bbf8d3d2bd28f55a46baf14a349871d7a635485785b93cb21baf8b8720c15a
2018-09-04 12:30:33 +02:00
Wladimir J. van der Laan 788b8a290c
Merge #14135: doc: correct GetDifficulty doc after #13288
68bfc0bce3 doc: correct GetDifficulty doc after #13288 (fanquake)

Pull request description:

  `chain` is no longer passed to GetDifficulty, and we just return `1.0` if no `blockindex`.

Tree-SHA512: 701375d732f343200c4abfaf9039d5c12b10abff97b022e84564f81b26b5ba552f1eb0c0d0fd5370b29b53319eafcf39773a36e1c2dd04ee77e61c18c7b183fa
2018-09-04 12:28:50 +02:00
Sjors Provoost 66e15e8f97
Explain GetAncestor check for m_failed_blocks in AcceptBlockHeader 2018-09-04 10:50:19 +02:00
practicalswift 8ecaee13f7 Increase signal to noise in appveyor build output by reducing the MSVC warning count from 12 to 4 (12 is assuming the changes in #14086 are also implemented).
This makes it easier to spot errors or more important warnings in the verbose appveyor output.

See https://github.com/bitcoin/bitcoin/pull/14086#issuecomment-416610313 plus discussion for context.
2018-09-03 19:53:56 +02:00
practicalswift fa462b3657 wallet: Set encrypted_batch to nullptr after delete. Avoid double free in the case of NDEBUG. 2018-09-03 15:41:02 +02:00
fanquake 68bfc0bce3
doc: correct GetDifficulty doc after #13288 2018-09-03 09:35:41 +08:00
João Barbosa ee3a494f37 gui: Favor macOS show / hide action in dock menu 2018-09-02 19:09:36 +01:00
Ben Woosley c7f7fa467e
Trivial: update clang thread-safety docs url 2018-09-02 02:49:30 -04:00
Cory Fields 9256f7d13f
build: avoid getifaddrs when unavailable 2018-09-01 15:25:03 +02:00
Patrick Strateman 83d53058ae Switch nPrevNodeCount to vNodesSize.
These both have the same value, but the variable naming is confusing.
2018-08-31 18:32:11 -04:00
Russell Yanofsky 190bf62be1 scripted-diff: Small locking rename
Call sync.h primitives "locks" and "mutexes" instead of "blocks" and "waitable
critical sections" to match current coding conventions and c++11 standard
names.

This PR does not rename the "CCriticalSection" class (though this could be done
as a followup) because it is used everywhere and would swamp the other changes
in this PR. Plain mutexes should mostly be preferred instead of recursive
mutexes in new code anyway.

-BEGIN VERIFY SCRIPT-
set -x
set -e
ren() { git grep -l $1 | xargs sed -i s/$1/$2/; }
ren CCriticalBlock           UniqueLock
ren CWaitableCriticalSection Mutex
ren CConditionVariable       std::condition_variable
ren cs_GenesisWait           g_genesis_wait_mutex
ren condvar_GenesisWait      g_genesis_wait_cv
perl -0777 -pi -e 's/.*typedef.*condition_variable.*\n\n?//g' src/sync.h
-END VERIFY SCRIPT-
2018-08-31 10:00:38 -04:00
Wladimir J. van der Laan 385ad11040
Merge #11640: Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection
9c4dc597dd Use LOCK macros for non-recursive locks (Russell Yanofsky)
1382913e61 Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection (Russell Yanofsky)
ba1f095aad MOVEONLY Move AnnotatedMixin declaration (Russell Yanofsky)
41b88e9337 Add unit test for DEBUG_LOCKORDER code (Russell Yanofsky)

Pull request description:

  Make LOCK macros work with non-recursive mutexes, and use wherever possible for better deadlock detection.

  Also add unit test for DEBUG_LOCKORDER code.

Tree-SHA512: 64ef209307f28ecd0813a283f15c6406138c6ffe7f6cbbd084161044db60e2c099a7d0d2edcd1c5e7770a115e9b931b486e86c9a777bdc96d2e8a9f4dc192942
2018-08-31 16:00:38 +02:00
MarcoFalke b012bbe358
Merge #10605: Add AssertLockHeld assertions in CWallet::ListCoins
62b6f0f21e Add EXCLUSIVE_LOCKS_REQUIRED to CWallet::ListCoins (Russell Yanofsky)
545e85eccc Add AssertLockHeld assertions in CWallet::ListCoins (Russell Yanofsky)

Pull request description:

  Fixes TODO from #10295

Tree-SHA512: 2dd03a8217e5e1313aa2119cb530e0c0daf3ae3a751b6fdec611df57b8090201a90b52ff05f8f696e978a1344aaf21989d67a03beb5ef6ef79b77be38d04b451
2018-08-31 09:03:05 -04:00
Chun Kuan Lee b9babc82dd utils: Use _wfopen and _wreopen on Windows
The fopen function does not support unicode filename on Windows, so use Windows specific function do deal with it
2018-08-31 21:02:53 +08:00
Wladimir J. van der Laan 709a15b0a6
Merge #14088: tests: Don't assert(...) with side effects
ca1a093127 Add regression test: Don't assert(...) with side effects (practicalswift)
4c3c9c3869 Don't assert(...) with side effects (practicalswift)

Pull request description:

  Don't `assert(...)` with side effects.

  From the developer notes:

  > **Assertions should not have side-effects**
  >
  > Rationale: Even though the source code is set to refuse to compile with assertions disabled, having side-effects in assertions is unexpected and makes the code harder to understand

  These assertions were introduced quite recently (in #14069 which was merged two days ago) and since this is a recurring thing (see #13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect.

Tree-SHA512: be65db9d8d5d0f5752152ba73fe3fbb0531880f156d3cd7dfdf1752709979b63214e46ae64b1adbe1e09fa121278f4087f4ae49bff16cf8f5aec16ea6bde3650
2018-08-31 15:00:15 +02:00
MarcoFalke bdbd654df8
Merge #14108: tests: Add missing locking annotations and locks (g_cs_orphans)
b602c9b3af tests: Add missing locking annotations and locks (practicalswift)

Pull request description:

  Add missing locking annotations and locks.

  `mapOrphanTransactions` is guarded by `g_cs_orphans`.

Tree-SHA512: f95104fbef23bd385e754c6bea3c3bdddd8a9c6a68e719d761227c9be1e46ff1316ec050a15a1243218dbab4e8584da6674f4a72f949f54b0a758392f19c83f8
2018-08-31 08:32:31 -04:00
Russell Yanofsky 62b6f0f21e Add EXCLUSIVE_LOCKS_REQUIRED to CWallet::ListCoins
Suggested by MarcoFalke <falke.marco@gmail.com> in
https://github.com/bitcoin/bitcoin/pull/10605#issuecomment-417643535
2018-08-31 08:11:01 -04:00
Wladimir J. van der Laan 3f96908448
Merge #14073: blockfilter: Avoid out-of-bounds script access.
f05599557a blockfilter: Omit empty scripts from filter contents. (Jim Posen)

Pull request description:

  Caught during review of #12254 by @TheBlueMatt. https://github.com/bitcoin/bitcoin/pull/12254#discussion_r212830981

Tree-SHA512: cfc9e3eeaba12a14fd3d2e1ccce1a1f89e8cf44cc340ceec05d2d5fa61d27ff64e355603f4ad2184ff73c0ed23dfdab6e2103bddc48f3b76cb13b88d428770ac
2018-08-31 13:35:31 +02:00
Wladimir J. van der Laan bb0277819a
Merge #13159: Don't close old debug log file handle prematurely when trying to re-open (on SIGHUP)
75ea00f391 Remove unused fsbridge::freopen (practicalswift)
cceedbc4bf Don't close old debug log file handle prematurely when trying to re-open (on SIGHUP) (practicalswift)

Pull request description:

  Don't close old debug log file handle prematurely when trying to re-open (on `SIGHUP`).

  Context: https://github.com/bitcoin/bitcoin/pull/13148#issuecomment-386288606

  Thanks @ajtowns!

Tree-SHA512: c436b4286f00fc428b60269b6d6321f435c72c7ccec3c15b2194aac71196529b30f32c2384b418ffe3ed67ba7ee8ec51f4c9c5748e65945697c0437eafcdacd1
2018-08-31 13:19:12 +02:00
practicalswift dfef0df840 tests: Dry run bench_bitcoin (-evals=1 -scaling=0: <1 second running time) as part "make check" to allow for quick identification of assertion/sanitizer failures in benchmarking code 2018-08-30 22:54:42 +02:00