Commit graph

12589 commits

Author SHA1 Message Date
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
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
Alexander Leishman 946107a68f Only log "Using PATH_TO_bitcoin.conf" message on startup if conf file exists.
Currently we log a message indicating that a bitcoin.conf file is being used
even if one does not exists. This commit changes the logic to only display
this message if a config file exists and logs a separate message
if no config file exists. Additionally, a warning is now logged if the file
path passed in the -conf flag does not exist.
2018-08-30 11:24:03 -07:00
practicalswift b602c9b3af tests: Add missing locking annotations and locks 2018-08-30 16:36:26 +02:00
Wladimir J. van der Laan 07033a8f91
Merge #13825: [wallet] Kill accounts
c9c32e6b84 [wallet] Kill accounts (John Newbery)

Tree-SHA512: 783272e7df9042fb0a01826fa37a02b97218496459015d7457e56223da8690bdad930c223dd4a903a1d4df57f3f2f4a097d392d272a72419ea9a882b11e599f7
2018-08-30 16:18:36 +02:00
John Newbery c9c32e6b84 [wallet] Kill accounts
This commit does the following changes:

- [wallet] Remove 'account' argument from GetLegacyBalance()
  - GetLegacyBalance() is never called with an account argument.
    Remove the argument and helper functions.
- [wallet] Remove CWallet::ListAccountCreditDebit()
  - Function no longer used.
- [wallet] Remove AccountMove()
  - Function no longer used.
- [wallet] Remove AddAccountingEntry()
  - Function no longer used.
- [wallet] Remove GetAccountCreditDebit()
  - Function no longer used.
- [wallet] Don't rewrite accounting entries when reordering wallet transactions.
 - Accounting entries are deprecated. Don't rewrite them to the wallet
   database when re-ordering transactions.
- [wallet] Remove WriteAccountingEntry()
  - Function no longer used.
- [wallet] Don't read acentry key-values from wallet on load.
- [wallet] Remove ListAccountCreditDebit()
  - Function no longer used.
- [wallet] Remove CAccountingEntry class
  - No longer used
- [wallet] Remove GetLabelDestination
  - Function no longer used.
- [wallet] Delete unused account functions
  - ReadAccount
  - WriteAccount
  - EraseAccount
  - DeleteLabel
- [wallet] Remove fromAccount argument from CommitTransaction()
- [wallet] Remove strFromAccount.
  - No longer used.
- [wallet] Remove strSentAccount from GetAmounts().
  - No longer used.
- [wallet] Update zapwallettxes comment to remove accounts.
- [wallet] Remove CAccount
  - No longer used
- [docs] fix typo in release notes for PR 14023
2018-08-30 16:08:42 +02:00
Wladimir J. van der Laan a66c0f78a9 util: Report parse errors in configuration file
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 -
2018-08-30 14:41:33 +02:00
MarcoFalke 6c7cfc8da6
Merge #13126: util: Add Clang thread safety annotations for variables guarded by cs_args
1e29379d69 Fix potential deadlock (practicalswift)
d58dc9f943 Add lock annotations (cs_args) (practicalswift)
db5e9d3c88 Add missing locks (cs_args) (practicalswift)

Pull request description:

  * Add missing `cs_args` locks
  * Add Clang thread safety annotations for variables guarded by `cs_args`

Tree-SHA512: bc562dbddf24a287bcf9bf902bc930f942f260a94e5c8ec4d190f7f2ddac448ed3d52acadaf9fc1c81a5cbff2c171c52c18ba0804eeb03f699d70394e1c977c5
2018-08-30 07:52:55 -04:00
Wladimir J. van der Laan be301a5777
Merge #14103: docs: Fix broken Doxygen comments
0e534d4dca Fix incorrect Doxygen comments (practicalswift)

Pull request description:

  Fix broken Doxygen comments.

  This commit was taken from #13914 which now only covers `-Wdocumentation`.

Tree-SHA512: dddbca16bb792b8193e5f417151b5eace9acc942a321f1bc095b906e98889e3bd93509fe112ab6a24ee1f6a3a918db905bda7acefd53774fe3e6ebe669fb51ac
2018-08-30 12:00:28 +02:00
practicalswift 1e29379d69 Fix potential deadlock 2018-08-30 10:02:49 +02:00
practicalswift d58dc9f943 Add lock annotations (cs_args) 2018-08-29 22:33:33 +02:00
practicalswift db5e9d3c88 Add missing locks (cs_args) 2018-08-29 20:57:41 +02:00
Wladimir J. van der Laan 4e9a6f87b7
Merge #14097: validation: Log FormatStateMessage on ConnectBlock error in ConnectTip
fa309dc305 validation: Log FormatStateMessage on ConnectBlock error in ConnectTip (MarcoFalke)

Pull request description:

  This change additionally logs the validation state on error, which is not logged at all on current master.

  Before:
  ```
  ERROR: ConnectTip(): ConnectBlock ffffff.... failed
  ```

  After:
  ```
  ERROR: ConnectTip: ConnectBlock ffffff.... failed, bad-cb-amount (code 16)
  ```

Tree-SHA512: e69ee0266772b3f77c0193c4a959c2444bf1a51259bd29d790cf665582b037997e520c8567f70b36362c071dcfe1a8ebd7c0f2286cf1b842df5731960e7e1ba0
2018-08-29 17:14:50 +02:00
Wladimir J. van der Laan 888acefa5e
Merge #13792: tx pool: Avoid passing redundant hash into addUnchecked (scripted-diff)
fa587773e5 scripted-diff: Remove unused first argument to addUnchecked (MarcoFalke)
fe5c49766c tx pool: Use the entry's hash instead of the one passed to addUnchecked (MarcoFalke)
ddd395f968 Mark CTxMemPoolEntry members that should not be modified const (MarcoFalke)

Pull request description:

  Several years ago the transaction hash was not cached. For optimization the hash was instead passed into `addUnchecked` to avoid re-calculating it. See f77654a0e9

  Passing in the hash is now redundant and the argument can safely be removed.

Tree-SHA512: 0206b65c7a014295f67574120e8c5397bf1b1bd70c918ae1360ab093676f7f89a6f084fd2c7000a141baebfe63fe6f515559e38c4ac71810ba64f949f9c0467f
2018-08-29 16:30:58 +02:00
practicalswift 75ea00f391 Remove unused fsbridge::freopen 2018-08-29 16:05:51 +02:00
practicalswift cceedbc4bf Don't close old debug log file handle prematurely when trying to re-open (on SIGHUP) 2018-08-29 16:05:00 +02:00
Wladimir J. van der Laan b0eb8f7ed4
Merge #14028: Explicitly initialize prevector _union
1d9aa008d6 Explicitly initialize prevector _union (Ben Woosley)

Pull request description:

Tree-SHA512: 3037a5d63b840a4cb0c3c26593ce1b7e1a6ba273a4ee5072563b20169be9783dbdfe3a38c9651d73b2d18ed9668deaf65f994eca7f225c70f875716f05eda3a6
2018-08-29 15:13:45 +02:00
Wladimir J. van der Laan 5924dadc2f
Merge #13671: Remove the boost/algorithm/string/case_conv.hpp dependency
b193d5a443 Removes the Boost case_conv.hpp dependency. (251)
7a208d9fad Implements custom tolower and toupper functions. (251)
e2ba043b8d Implements ParseNetwork unit test. (251)

Pull request description:

  This pull request removes the `boost/algorithm/string/case_conv.hpp` dependency from the project.

  `boost/algorithm/string/case_conv.hpp` is included for the `boost::to_lower` and `boost::to_upper` template functions.

  We can replace the calls to these functions with straightforward alternative implementations that use the C++ Standard Library, because the functions are called with `std::string` objects that use standard 7-bit ASCII characters as argument.

  The refactored implementation should work without the explicit `static_cast<unsigned char>` cast and `unsigned char` lambda return type. Both have been added defensively and to be explicit. Especially in case of the former, behaviour is undefined (potentially result in a crash) if the `std::toupper` argument is not an `unsigned char`.

  A potential alternative, maybe even preferred, implementation to address the `boost::to_lower` function call in `ParseNetwork(std::string)` could have been:

  ```c++
  if (net == "ipv4" || net == "IPv4") return NET_IPV4;
  if (net == "ipv6" || net == "IPv6") return NET_IPV6;
  ```
  This alternative implementation would however change the external behaviour of `ParseNetwork(std::string)`.

  This pull requests includes a unit test to validate the implementation of `ParseNetwork(std::string)`  prior and after the removal of the `case_conv.hpp` dependency.

  `boost/algorithm/string/case_conv.hpp` has been removed from the `EXPECTED_BOOST_INCLUDES` in `test/lint/lint-includes.sh` because it is no longer required.

Tree-SHA512: d803ae709f2368a3efb223097384a722436955bce0c44a1a5cffd0abb3164be0cce85ba0e9ebd9408166df3f1a95ea0c0d29e3a2534af2fae206c0419d67fde9
2018-08-29 14:59:49 +02:00
Wladimir J. van der Laan 2ddce35abc
Merge #13862: utils: drop boost::interprocess::file_lock
1661a472b8 add unicode compatible file_lock for Windows (Chun Kuan Lee)

Pull request description:

  boost::interprocess::file_lock cannot open the files that contain characters which cannot be parsed by the user's code page on Windows.

  This PR is seperated from #13426 for easier review.

Tree-SHA512: e240479cda65958bf6e1319840b83928b2b50da81d99f4f002fb3b62621370bcd4bcfacd2b8c0678c443a650d6ba53d9d12618b591e5bfd67ac14388a18fd822
2018-08-29 14:16:13 +02:00
MarcoFalke 13887f41f2
Merge #14093: tests: Fix accidental trunction from int to bool
1cc58978b7 tests: Fix accidental trunction from int to bool (practicalswift)

Pull request description:

  Fix accidental trunction from `int` to `bool`.

  Context: https://github.com/bitcoin/bitcoin/pull/14086#issuecomment-416610313

Tree-SHA512: 72d209f892e580afa9c295174c206ea5ba764ff9e03613cd9bc57fd0d7118e895ee44d96db90930a29c0b4de7f51dc00101a1b32ba6b46576d34e089ff5482ba
2018-08-28 22:15:49 -04:00
MarcoFalke fa309dc305
validation: Log FormatStateMessage on ConnectBlock error in ConnectTip 2018-08-28 21:49:23 -04:00
Wladimir J. van der Laan 5de338ec72
Merge #14055: fix walletcreatefundedpsbt deriv paths, add test
61fe653bd9 fix walletcreatefundedpsbt deriv paths, add test (Gregory Sanders)

Pull request description:

  Added the regression in #13968

Tree-SHA512: a31290b57ed80a8486925e562ca5412500d4215a238de7e448f48edfa671c87aebd79ee179a8340b289d9811ae6fa30ef75eefd5f5890fb6285174c5db72ff65
2018-08-28 23:11:15 +02:00
Jim Posen f05599557a blockfilter: Omit empty scripts from filter contents.
Code change also avoids out-of-bounds script access bug.
2018-08-28 12:12:32 -07:00
251 b193d5a443 Removes the Boost case_conv.hpp dependency.
This commit removes the `boost/algorithm/string/case_conv.hpp` dependency from the project. It replaces the `boost::to_lower` and `boost::to_upper` functions with custom functions that are locale independent and ASCII deterministic.
2018-08-28 18:42:53 +02:00
251 7a208d9fad Implements custom tolower and toupper functions.
This commit implements custom equivalents for the C and C++ `tolower` and `toupper` Standard Library functions.
In addition it implements a utility function to capitalize the first letter of a string.
2018-08-28 18:42:27 +02:00
251 e2ba043b8d Implements ParseNetwork unit test.
This commit implements a unit test that validates the `ParseNetwork(std::string)` implementation in `netbase.cpp`.
2018-08-28 18:37:34 +02:00
practicalswift 1cc58978b7 tests: Fix accidental trunction from int to bool 2018-08-28 17:42:55 +02:00
Wladimir J. van der Laan aa39ca7645
Merge #13723: PSBT key path cleanups
917353c8b0 Make SignPSBTInput operate on a private SignatureData object (Pieter Wuille)
cad5dd2368 Pass HD path data through SignatureData (Pieter Wuille)
03a99586a3 Implement key origin lookup in CWallet (Pieter Wuille)
3b01efa0d1 [MOVEONLY] Move ParseHDKeypath to utilstrencodings (Pieter Wuille)
81e1dd5ce1 Generalize PublicOnlySigningProvider into HidingSigningProvider (Pieter Wuille)
84f1f1bfdf Make SigningProvider expose key origin information (Pieter Wuille)
611ab307fb Introduce KeyOriginInfo for fingerprint + path (Pieter Wuille)

Pull request description:

  This PR adds "key origin" (master fingeprint + key path) information to what is exposed from `SigningProvider`s, allowing this information to be used by the generic PSBT code instead of having the RPC pull it directly from the wallet.

  This is also a preparation to having PSBT interact with output descriptors, which can then directly expose key origin information for the scripts they generate.

Tree-SHA512: c718382ba8ba2d6fc9a32c062bd4cff08b6f39b133838aa03115c39aeca0f654c7cc3ec72d87005bf8306e550824cd8eb9d60f0bd41784a3e22e17b2afcfe833
2018-08-28 16:25:04 +02:00
practicalswift 4c3c9c3869 Don't assert(...) with side effects 2018-08-28 10:22:28 +02:00
Chun Kuan Lee fe1ff5026b Hide spendable label if priveate key is disabled 2018-08-28 03:56:07 +08:00
John Newbery f7e9e70468 [rpc] Remove deprecated sigrawtransaction rpc method. 2018-08-27 14:36:12 -04:00
John Newbery 90c834089a [RPC] Remove warning about wallet addresses in createmultisig()
createmultisig() was updated in V0.16 to not use the wallet. Warning
text was included to warn the user. Remove that now.
2018-08-27 14:36:12 -04:00
John Newbery df905e390e [rpc] Remove deprecated validateaddress usage. 2018-08-27 14:36:08 -04:00
MarcoFalke fea4e9eca5
Merge #13767: Remove redundant assignments (dead stores)
dd777f3e12 Remove unused variable (practicalswift)
cdf4089457 Remove redundant assignments (dead stores) (practicalswift)

Pull request description:

  Remove redundant assignments (dead stores).

Tree-SHA512: e852059b22a161c34a0f18a6a6ed798e2b35e6d2b9f23c526af0ec33e01f6a5bb1fa5ada6671ba183d7b02393ff0d397be5aa4b4e2edbd5e604c9a76ac48d249
2018-08-27 13:39:46 -04:00
MarcoFalke dd34204611
Merge #13769: Mark single-argument constructors "explicit"
1ac3c983bf Mark single-argument constructors "explicit" (practicalswift)

Pull request description:

  Mark single-argument constructors `explicit`.

  Rationale:
  * Avoid unexpected implicit promotions.

  From the developer notes:

  > **By default, declare single-argument constructors explicit.**
  > Rationale: This is a precaution to avoid unintended conversions that might arise when single-argument constructors are used as implicit conversion functions.

Tree-SHA512: 7901ed5be808c9d0ecb5ca501e1bc0395987fe1b7941b8548cebac2ff08a14f7dab61fab374a69b9ba29a9295a04245c814325c7f95b97ae558af0780f111dfa
2018-08-27 13:33:04 -04:00
Chun Kuan Lee 1661a472b8 add unicode compatible file_lock for Windows
boost::interprocess::file_lock cannot open the files that contain characters which cannot be parsed by the user's code page on Windows.
This commit add a new class to handle those specific file for Windows.
2018-08-28 00:55:13 +08:00
Ben Woosley 1d9aa008d6
Explicitly initialize prevector _union 2018-08-27 09:50:13 -07:00
practicalswift f34c8c466a Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. 2018-08-27 18:19:33 +02:00
John Newbery 1f4b865e57 [wallet] Re-sort wallet RPC commands
This wasn't done in previous commit to make diff more reviewable.
2018-08-27 10:45:03 -04:00
John Newbery f0dc850bf6 [wallet] Remove wallet account RPCs
Also remove the RPC deprecation tests for accounts, and make one small
change to another wallet test that relies on account behaviour.
2018-08-27 10:45:01 -04:00
Chris Stewart b2f49bd732 Integration of property based testing into Bitcoin Core
update copyright headers

attempt to fix linting errors

Fixing issue with make check classifying generator files as actual unit tests

Wrapping gen files in ENABLE_PROPERTY_TESTS macro

Make macro better
2018-08-27 08:51:51 -05:00
John Newbery c410f41575 [tests] Remove wallet accounts test
The accounts API will be removed in the next commit. Remove all
functional tests for the accounts API.
2018-08-27 09:34:01 -04:00
MarcoFalke 6667490466
Merge #13987: Report minfeefilter value in getpeerinfo rpc
5778bf95d9 Report minfeefilter value in getpeerinfo rpc (Anthony Towns)

Pull request description:

  Lowering the minimum relay fee is only useful when many nodes in the p2p network also lower the fee, so to make it easier to understand progress on that front, this includes the value of the minfeefilter in getpeerinfo, so you at least have visibility to what fees your neighbours are currently accepting.

Tree-SHA512: 059f01bf2a32c98fce1648a13b7898701203b354d0209ee34e6683994b720eb594cf24968e66b699caae5e17e53d351e73281f042dd094decde14d3a318e9fb3
2018-08-27 07:28:38 -04:00
Anthony Towns 5778bf95d9 Report minfeefilter value in getpeerinfo rpc
Lowering the minimum relay fee is only useful when many nodes in the
p2p network also lower the fee, so to make it easier to understand
progress on that front, this includes the value of the minfeefilter in
getpeerinfo, so you at least have visibility to what fees your neighbours
are currently accepting.
2018-08-27 21:13:15 +10:00
Wladimir J. van der Laan e13a820f99
Merge #13861: test: Add testing of value_ret for SelectCoinsBnB
384273260a test: Add testing of value_ret for SelectCoinsBnB (Ben Woosley)

Pull request description:

  Fix that the early bailout optimization tests did not test the intended
  selection because their utxo pool was polluted by the make_hard_case test
  preceding. Note the code was tested, just not with the constructed case.

Tree-SHA512: 95f665525f5922f70f4c17708c0c09900f38d7a652b5bdd817e017ba7ff2865a6234edbd340064ffccc20d34048c45df86a4ac5f46dd8f4aab98834e71dc9d3c
2018-08-27 12:47:20 +02:00
Wladimir J. van der Laan 4a1a2148f6
Merge #14030: Remove ambiguity in construction of prevector
497e90c02b Remove default argument to prevector constructor to remove ambiguity (Ben Woosley)

Pull request description:

  The call with this default argument is redundant with `prevector(size_type)` on line 251.

Tree-SHA512: 4d22e6f4cd56e4b700596d7f5afc945ec6684636a94690fa16a1bbb34e4f53b6340f53a6c314fea213359426474125228ba7193388789f8a13308506358e92db
2018-08-27 12:23:48 +02:00
Wladimir J. van der Laan cb98effc5c
Merge #14031: Make IS_TRIVIALLY_CONSTRUCTIBLE consistent on GCC < 5, don't patch clang
f1640d093f Make IS_TRIVIALLY_CONSTRUCTIBLE consistent on GCC < 5 (Ben Woosley)

Pull request description:

  `std::is_trivially_constructible<T>` is equivalent to `std::is_trivially_default_constructible<T>`
  `std::has_trivial_default_constructor<T>` is the GCC < 5 name for `std::is_trivially_default_constructible<T>`

  https://en.cppreference.com/w/cpp/types/is_default_constructible
  https://www.gnu.org/software/gcc/gcc-5/changes.html

  `std::is_trivial` was also used when compiling with clang, due to clang's use of `__GNUC__`. Test `__clang__`  to target the intended implementations.
  https://stackoverflow.com/a/28166605

  All callers currently only pass one template argument to IS_TRIVIALLY_CONSTRUCTIBLE, with this change the build would fail if someone attempted passing more.

Tree-SHA512: 3e36ddf20a1c0d76ad94d7c95f3fe5b90f4ee00389d5516b35c657136205e7a3ddff60789b0b0b2375624631f15a51eaad3570ef19a7b9df1469a50ba28415d1
2018-08-27 12:00:21 +02:00
Wladimir J. van der Laan deed63f6fb
Merge #14056: Docs: Fix help message typo optiona -> optional
7d0a8ad310 Docs: Fix help message typo optiona -> optional (Ben Woosley)

Pull request description:

Tree-SHA512: 1812b45d912769f11280e3f72d7c8bd273f6d151797d5d32d21cd5a3bbe8725515406494291953be7a9afc02a2cef23bed1930ac3638f8118c0d8346ee8d6332
2018-08-27 10:48:35 +02:00
MarcoFalke e8061831e8
Merge #14071: qa: Stop txindex thread before calling destructor
faf4a9b674 qa: Stop txindex thread before calling destructor (MarcoFalke)

Pull request description:

  Same as #13894, but for the tests.

Tree-SHA512: a21d9f8ad8dc9703217d1808cb14bd969903c364fe30bbdc0dd2df170ddc0cbaba98b0bde28bc21ff1319222aaf6cb4f1b2c45cd6b236fe3c645a92eab6bacba
2018-08-26 22:04:32 -04:00
Chun Kuan Lee 23db9546c1 utils: run commands using utf-8 string on Windows 2018-08-27 03:24:34 +08:00
Wladimir J. van der Laan c775dc4a94
Merge #12254: BIP 158: Compact Block Filters for Light Clients
254c85b687 bench: Benchmark GCS filter creation and matching. (Jim Posen)
f33b717a85 blockfilter: Optimization on compilers with int128 support. (Jim Posen)
97b64d67da blockfilter: Unit test against BIP 158 test vectors. (Jim Posen)
a4afb9cadb blockfilter: Additional helper methods to compute hash and header. (Jim Posen)
cd09c7925b blockfilter: Serialization methods on BlockFilter. (Jim Posen)
c1855f6052 blockfilter: Construction of basic block filters. (Jim Posen)
53e7874e07 blockfilter: Simple test for GCSFilter construction and Match. (Jim Posen)
558c536e35 blockfilter: Implement GCSFilter Match methods. (Jim Posen)
cf70b55005 blockfilter: Implement GCSFilter constructors. (Jim Posen)
c454f0ac63 blockfilter: Declare GCSFilter class for BIP 158 impl. (Jim Posen)
9b622dc722 streams: Unit tests for BitStreamReader and BitStreamWriter. (Jim Posen)
fe943f99bf streams: Implement BitStreamReader/Writer classes. (Jim Posen)
87f2d9ee43 streams: Unit test for VectorReader class. (Jim Posen)
947133dec9 streams: Create VectorReader stream interface for vectors. (Jim Posen)

Pull request description:

  This implements the compact block filter construction in [BIP 158](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki). The code is not used anywhere in the Bitcoin Core code base yet. The next step towards [BIP 157](https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki) support would be to create an indexing module similar to `TxIndex` that constructs the basic and extended filters for each validated block.

  ### Filter Sizes

  [Here](https://gateway.ipfs.io/ipfs/QmRqaAAQZ5ZX5eqxP7J2R1MzFrc2WDdKSWJEKtQzyawqog) is a CSV of filter sizes for blocks in the main chain.

  As you can see below, the ratio of filter size to block size drops after the first ~150,000 blocks:

  ![filter_sizes](https://user-images.githubusercontent.com/881253/42900589-299772d4-8a7e-11e8-886d-0d4f3f4fbe44.png)

  The reason for the relatively large filter sizes is that Golomb-coded sets only achieve good compression with a sufficient number of elements. Empirically, the average element size with 100 elements is 14% larger than with 10,000 elements.

  The ratio of filter size to block size is computed without witness data for basic filters. Here is a summary table of filter size ratios *for blocks after height 150,000*:

  | Stat | Filter Type |
  |-------|--------------|
  | Weighted Size Ratio Mean | 0.0198 |
  | Size Ratio Mean | 0.0224 |
  | Size Ratio Std Deviation | 0.0202 |
  | Mean Element Size (bits) | 21.145 |
  | Approx Theoretical Min Element Size (bits) | 21.025 |

Tree-SHA512: 2d045fbfc3fc45490ecb9b08d2f7e4dbbe7cd8c1c939f06bbdb8e8aacfe4c495cdb67c820e52520baebbf8a8305a0efd8e59d3fa8e367574a4b830509a39223f
2018-08-26 16:57:05 +02:00
MarcoFalke faf4a9b674
qa: Stop txindex thread before calling destructor 2018-08-26 10:18:06 -04:00
Jesse Cohen 737670c036 Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe 2018-08-26 09:41:57 -04:00
practicalswift 9e2de6b9d0 Move cs_main locking annotations from .cpp to .h 2018-08-26 11:15:17 +02:00
MarcoFalke 91186e5984
Merge #13083: Add compile time checking for cs_main runtime locking assertions
9e0a514112 Add compile time checking for all cs_main runtime locking assertions (practicalswift)

Pull request description:

  Add compile time checking for `cs_main` runtime locking assertions.

  This PR is a subset of #12665. The PR was broken up to make reviewing easier.

  The intention is that literally all `EXCLUSIVE_LOCKS_REQUIRED`/`LOCKS_EXCLUDED`:s added in this PR should follow either directly or indirectly from `AssertLockHeld(…)`/`AssertLockNotHeld(…)`:s already existing in the repo.

  Consider the case where function `A(…)` contains `AssertLockHeld(cs_foo)` (without
  first locking `cs_foo` in `A`), and that `B(…)` calls `A(…)` (without first locking `cs_main`):
  * It _directly_ follows that: `A(…)` should have an `EXCLUSIVE_LOCKS_REQUIRED(cs_foo)` annotation.
  * It _indirectly_ follows that: `B(…)` should have an `EXCLUSIVE_LOCKS_REQUIRED(cs_foo)` annotation.

Tree-SHA512: 120e7410c4c223dbc7d42030b1a19e328d01a55f041bb6fb5eaac10ac35cb0c5d469b9b3bda6444731164c73b88ac6495a00890672b107d9305e891571f64dd6
2018-08-25 18:31:29 -04:00
practicalswift 9e0a514112 Add compile time checking for all cs_main runtime locking assertions 2018-08-26 00:25:28 +02:00
Wladimir J. van der Laan 6516b36731
Merge #12676: Show "bip125-replaceable" flag, when retrieving mempool entries
870bd4c73d Update functional RBF test to check replaceable flag (dexX7)
820d31f95f Add "bip125-replaceable" flag to mempool RPCs (dexX7)

Pull request description:

  This pull request adds a flag "bip125-replaceable" to the mempool RPCs getrawmempool, getmempoolentry, getmempoolancestors and getmempooldescendants, which indicates whether an unconfirmed transaction might be replaced.

  Initially the flag was added to the raw transaction RPCs, but thanks to @conscott, it was moved to the mempool RPCs, which actually have access to the mempool.

  ~~This pull request adds a flag "bip125-replaceable" to the RPCs "getrawtransaction" and "decoderawtransaction", which indicates, whether a transaction signals BIP 125 replaceability.~~

  There was some discussion in #7817, whether showing replaceability in the UI could lead to the false assumption that transactions that don't signal BIP 125 are truely non-replaceable, but given that this PR tackles the raw transaction interface, which is a rather low level tool, I believe having this extra piece of information isn't bad.

Tree-SHA512: 1f5511957af2c20a9a6c79d80a335c3be37a2402dbf829c40cceaa01a24868eab81a9c1cdb0b3d77198fa3bb82799e3540a5c0ce7f35bbac80d73f7133ff7cbc
2018-08-26 00:04:05 +02:00
Wladimir J. van der Laan 6f5372a171
Merge #13961: util: Replace boost::signals2 with std::function
ddddce0e46 util: Replace boost::signals2 with std::function (MarcoFalke)

Pull request description:

  This removes the `#include <boost/signals2/signal.hpp>` from `util.h` (hopefully speeding up the build time and reducing the memory usage further after  #13634)

  The whole translation interface is replaced by a function `G_TRANSLATION_FUN` that is set to nullptr in units that don't need translation. (Thus only set in the gui)

Tree-SHA512: 087c717358bbed8bdb409463e225239d667f1ced381abb10e7cd31a41dcdd2cebe20b43c2ee86f0f8e55d53301f75e963f07421a99a7ff4c0cad2c6a375c5ab1
2018-08-25 21:13:46 +02:00
Jim Posen 254c85b687 bench: Benchmark GCS filter creation and matching. 2018-08-25 10:02:37 -07:00
Jim Posen f33b717a85 blockfilter: Optimization on compilers with int128 support. 2018-08-25 10:02:37 -07:00
Jim Posen 97b64d67da blockfilter: Unit test against BIP 158 test vectors.
Full test of block filter and header construction.
2018-08-25 10:02:37 -07:00
Jim Posen a4afb9cadb blockfilter: Additional helper methods to compute hash and header. 2018-08-25 10:02:37 -07:00
Jim Posen cd09c7925b blockfilter: Serialization methods on BlockFilter. 2018-08-25 10:02:37 -07:00
Jim Posen c1855f6052 blockfilter: Construction of basic block filters. 2018-08-25 10:02:37 -07:00
Jim Posen 53e7874e07 blockfilter: Simple test for GCSFilter construction and Match. 2018-08-25 10:02:37 -07:00
Jim Posen 558c536e35 blockfilter: Implement GCSFilter Match methods. 2018-08-25 10:02:37 -07:00
Jim Posen cf70b55005 blockfilter: Implement GCSFilter constructors. 2018-08-25 10:02:37 -07:00
Jim Posen c454f0ac63 blockfilter: Declare GCSFilter class for BIP 158 impl. 2018-08-25 10:02:37 -07:00
Jim Posen 9b622dc722 streams: Unit tests for BitStreamReader and BitStreamWriter. 2018-08-25 10:02:37 -07:00
Jim Posen fe943f99bf streams: Implement BitStreamReader/Writer classes.
Golomb-Rice coding, as specified in BIP 158, involves operations on
individual bits. These classes will be used to implement the
encoding/decoding operations.
2018-08-25 10:02:37 -07:00
Jim Posen 87f2d9ee43 streams: Unit test for VectorReader class. 2018-08-25 10:02:37 -07:00
Jim Posen 947133dec9 streams: Create VectorReader stream interface for vectors.
This is a read analogue for the existing CVectorWriter.
2018-08-25 10:02:37 -07:00
Wladimir J. van der Laan 021dce935a
Merge #13946: p2p: Clarify control flow in ProcessMessage
fa6c3dea42 p2p: Clarify control flow in ProcessMessage() (MarcoFalke)

Pull request description:

  `ProcessMessage` is effectively a massive switch case construct. In the past there were attempts to clarify the control flow in `ProcessMessage()` by moving each case into a separate static function (see #9608). It was closed because it wasn't clear if moving each case into a function was the right approach.
  Though, we can quasi treat each case as a function by adding a return statement to each case. (Can be seen as a continuation of bugfix #13162)

  This patch does exactly that.

  Also note that this patch is a subset of previous approaches such as #9608 and #10145.

  Review suggestion: `git diff HEAD~ --function-context`

Tree-SHA512: 91f6106840de2f29bb4f10d27bae0616b03a91126e6c6013479e1dd79bee53f22a78902b631fe85517dd5dc0fa7239939b4fefc231851a13c819458559f6c201
2018-08-25 18:18:15 +02:00
Wladimir J. van der Laan 4cef8e0593
Merge #13429: Return the script type from Solver
984d72ec65 Return the script type from Solver (Ben Woosley)

Pull request description:

  Because false is synonymous with TX_NONSTANDARD, this conveys the same
  information and makes the handling explicitly based on script type,
  simplifying each call site.

  Prior to this change it was common for the return value to be ignored, or for the
  return value and TX_NONSTANDARD to be redundantly handled.

Tree-SHA512: 31864f856b8cb75f4b782d12678070e8b1cfe9665c6f57cfb25e7ac8bcea8a22f9a78d7c8cf0101c841f2a612400666fb91798bffe88de856e98b873703b0965
2018-08-25 17:41:00 +02:00
Wladimir J. van der Laan 776fa60c4b
Merge #13631: Add CMerkleTx::IsImmatureCoinBase method
23f4343781 Add CMerkleTx::IsImmatureCoinBase method (Ben Woosley)

Pull request description:

  All but one call to `GetBlocksToMaturity` is testing it relative to 0
  for the purposes of determining whether the coinbase tx is immature.
  In such case, the value greater than 0 implies that the tx is coinbase,
  so there is no need to separately test that status.

  This names the concept for easy singular use.

Tree-SHA512: 4470d07404a0707144f9827b9a94c5c4905f23ee6f9248edc5df599a59d28e21ea0201d8abe5d5d73b39cb05b60c861ea8e04767eef04433e2ee95dcfed653ee
2018-08-25 16:53:21 +02:00
Ben Woosley 7d0a8ad310
Docs: Fix help message typo optiona -> optional 2018-08-24 15:02:16 -07:00
Gregory Sanders 61fe653bd9 fix walletcreatefundedpsbt deriv paths, add test 2018-08-24 17:03:55 -04:00
MarcoFalke ddddce0e46
util: Replace boost::signals2 with std::function 2018-08-24 08:34:38 -04:00
Ben Woosley f1640d093f
Make IS_TRIVIALLY_CONSTRUCTIBLE consistent on GCC < 5
std::is_trivially_constructible<T> is equivalent to std::is_trivially_default_constructible<T>
std::has_trivial_default_constructor<T> is the GCC < 5 name for std::is_trivially_default_constructible<T>

std::is_trivial was also used when compiling with clang, due to clang's use of __GNUC__. Test __clang__
to target the intended implementations.
2018-08-23 10:38:59 -07:00
Wladimir J. van der Laan 540bf8aacc
Merge #12559: Avoid locking cs_main in some wallet RPC
00f58f8c48 rpc: Avoid locking cs_main in some wallet RPC (João Barbosa)

Pull request description:

  Avoid locking `cs_main` in the folllowing wallet RPC:
   - `decoderawtransaction`
   - `getnewaddress`
   - `getrawchangeaddress`
   - `setlabel`

Tree-SHA512: 54089766b2a969a17479af6c60e8ce151fac1f8cec268d43c61e679d5d17e76d17e414240c9ca2bfd280165f3a04e24a51310eb283591cd601a7eebc8b2423ea
2018-08-23 19:38:18 +02:00
Gregory Maxwell 66b3fc5437 Skip stale tip checking if outbound connections are off or if reindexing. 2018-08-23 10:10:12 +00:00
Ben Woosley 497e90c02b
Remove default argument to prevector constructor to remove ambiguity
The call with this default argument is redundant with prevector(size_type).
2018-08-23 02:57:39 -07:00
Antoine Riard e8c4a1e369 Add new regtest ports in doc following #10825 ports reattributions
Add checkmempool and checkblockindex regtest true in doc
2018-08-23 03:14:11 +00:00
João Barbosa 00f58f8c48 rpc: Avoid locking cs_main in some wallet RPC 2018-08-23 01:46:59 +01:00
MarcoFalke fa5099ceb7
p2p: Remove dead code for nVersion=10300 2018-08-22 09:22:04 -04:00
Wladimir J. van der Laan 17d644901b
Merge #13988: Add checks for settxfee reasonableness
317f2cb3f4 test: Check RPC settxfee errors (João Barbosa)
48618daf26 Add checks for settxfee reasonableness (Anthony Towns)

Pull request description:

  When using the `settxfee` RPC, the value is silently ignored if it is less than either than minrelaytxfee or the wallet's mintxfee. This adds an error response if that's going to happen, but still allows "settxfee 0" to deliberately default to the minimum value.

Tree-SHA512: ce685584cf8d6b9ca2cc97196d494220e3892b6a804a458086e04b3a23df281da432ad0a3053106a064c90c541ddb6f6b96a27cf8376d45af1e44449baf88456
2018-08-22 11:10:41 +02:00
Wladimir J. van der Laan 0738b88fe0
Merge #13967: [walletdb] don't report minversion wallet entry as unknown
321159e53e don't report minversion wallet entry as unknown (Gregory Sanders)

Pull request description:

  It is known in WalletBatch::LoadWallet

Tree-SHA512: 82f7e12f48ae7d17317074ce5b5e27c70ba8334b04adbf7cc863f8169cc1aa460b9454571e2698aa00059c8c8f669fe19c0d40c4910dcded260ddca6ce78be9d
2018-08-22 10:02:11 +02:00
Wladimir J. van der Laan df29abf673
Merge #14006: Add const modifier to HTTPRequest methods
18c49eb887 http: Add const modifier to HTTPRequest methods (João Barbosa)

Pull request description:

Tree-SHA512: 233617425ff3abc7419817a95337056c190640197c6c4d8b1a0810967d960c0968d02967e16ffbc1af1a2b3117fdc98722bf05e270504d59548e6838fa7f5ffb
2018-08-21 17:33:12 +02:00
João Barbosa f78558f1e3 qt: Use new Qt5 connect syntax 2018-08-21 09:43:54 +01:00
Wladimir J. van der Laan 8aa9badf5e
Merge #13968: [wallet] couple of walletcreatefundedpsbt fixes
faaac5caaa RPCTypeCheck bip32derivs arg in walletcreatefunded (Gregory Sanders)
1f0c4282e9 QA: add basic walletcreatefunded optional arg test (Gregory Sanders)
1f18d7b591 walletcreatefundedpsbt: remove duplicate replaceable arg (Gregory Sanders)
2252ec5008 Allow ConstructTransaction to not throw error with 0-input txn (Gregory Sanders)

Pull request description:

  1) Previously an empty input argument transaction that is marked for replaceability fails to pass the `SignalsOptInRBF` check right before funding it. Explicitly check for that condition before throwing an error.

  2) The rpc call had two separate `replaceable` arguments, each of which being used in mutually exclusive places. I preserved the `options` version to retain compatability with `fundtransaction`.

Tree-SHA512: 26eb0c9e2d38ea51d11f741d61100223253271a084adadeb7e78c6d4e9004636f089e4273c5bf64a41bd7e9ff795317acf30531cb36aeb0d8db9304b3c8270c3
2018-08-21 09:44:26 +02:00
Russell Yanofsky a3197c5294 Disable wallet and address book Qt tests on macOS minimal platform
macOS Qt 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`).
2018-08-20 15:24:55 -04:00
MarcoFalke 4732fa133a
Merge #12818: [qt] TransactionView: highlight replacement tx after fee bump
d795c610d3 [qt] TransactionView: highlight replacement tx after fee bump (Sjors Provoost)

Pull request description:

  Consistent with #12421 which highlights the transaction after send.

  <img width="747" alt="1" src="https://user-images.githubusercontent.com/10217/38036280-a7358ea4-32a6-11e8-8f92-417e9e1e3e8b.png">

  <img width="685" alt="2" src="https://user-images.githubusercontent.com/10217/38036289-aac87040-32a6-11e8-9f94-81745ff6c592.png">

  ~I'm not too proud of the `QTimer::singleShot(10` bit; any suggestions on how to properly wait for the transactions table to become aware of the new transaction?~

  Although I could have called `focusTransaction()` directly from `TransactionView::bumpFee()` I'm using the same signal as the send screen. This should make it easier to move fee bump / transaction replacement functionality around later.

Tree-SHA512: 242055b7c3d32c7b2cf871f5ceda2581221902fd53fa29e0b092713fc16d3191adbe8cbb28417d522dda9febec8cc05e07afe3489cd7caaecd33460c1dde6fbc
2018-08-20 13:26:30 -04:00
Gregory Sanders faaac5caaa RPCTypeCheck bip32derivs arg in walletcreatefunded 2018-08-20 13:02:20 -04:00
Gregory Sanders 1f18d7b591 walletcreatefundedpsbt: remove duplicate replaceable arg 2018-08-20 13:02:20 -04:00
Kostiantyn Stepaniuk d9d79576f4 Preserve a format of RPC command definitions
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.
2018-08-20 15:19:12 +02:00
Wladimir J. van der Laan 2a583406c0
Merge #13248: [gui] Make proxy icon from statusbar clickable
6d5fcad576 [gui] Make proxy icon from statusbar clickable (Cristian Mircea Messel)

Pull request description:

  Clicking on the proxy icon will open settings showing the network tab

  https://github.com/bitcoin/bitcoin/pull/11491#issuecomment-336685303

Tree-SHA512: c3549749296918818694a371326d1a3b1075478918aaee940b5c7119a7e2cb991dcfda78f20d44d6d001157b9b82951f0d5157b17f4f0d1a0a242795efade036
2018-08-20 13:40:11 +02:00
João Barbosa 18c49eb887 http: Add const modifier to HTTPRequest methods 2018-08-20 01:35:55 +01:00
Wladimir J. van der Laan 3c8d1ae153
Merge #13665: [build] Add risc-v support to gitian
c4aecd1d80 Add risc-v 64-bit to gitian (Chun Kuan Lee)
96dda8b058 [depends] Add riscv qt depends support for cross compiling bitcoin-qt (Chun Kuan Lee)

Pull request description:

  Based on ~#13660~ #13710 ,  add gitian tarball for RISC-V

Tree-SHA512: 8db73545a2ea7fe03fa156598479335ea3c79aa3fb9c5cc44b8563094b1deb7c94d29c1dab47fac129dbfa2e3e774301b526474beeeb59c9b0087d3ea087dbd6
2018-08-16 20:33:50 +02:00
Anthony Towns 48618daf26 Add checks for settxfee reasonableness 2018-08-16 12:47:31 +10:00
MarcoFalke fa6ab8ada1
rpc: Return more specific reject reason for submitblock 2018-08-15 14:09:35 -04:00
Wladimir J. van der Laan b5591ca0b0
Merge #13399: rpc: Add submitheader
fa091b0016 qa: Add tests for submitheader (MarcoFalke)
36b1b63f20 rpc: Expose ProcessNewBlockHeaders (MarcoFalke)

Pull request description:

  This exposes `ProcessNewBlockHeaders` as an rpc called `submitheader`. This can be used to check for invalid block headers and submission of valid block headers via the rpc.

Tree-SHA512: a61e850470f15465f88e450609116df0a98d5d9afadf36b2033d820933d8b6a4012f9f2b3246319c08a0e511bef517f5d808cd0f44ffca91d10895a938004f0b
2018-08-15 17:52:06 +02:00
Wladimir J. van der Laan ef98e122ca
Merge #13891: [RPC] Remove getinfo deprecation warning
b2f23c4153 [RPC] Remove getinfo deprecation warning (John Newbery)

Pull request description:

  `getinfo` was removed in V0.16. A removal warning message was left in place to tell users that the method had been removed. We can remove that entirely in V0.18.

Tree-SHA512: bf93fbcf57a9be480438dcbdcab2dfd69ce277218b10628776975b093b3ffd2caa1751e0fb4cb0245443c81465693e2b8750e96d3e38632a78bae5ffa04f9212
2018-08-15 17:10:43 +02:00
fanquake 4b3b85c597
refactor: use fs:: over boost::filesystem:: 2018-08-15 21:05:21 +08:00
MarcoFalke 80127f074e
Merge #13974: [trivial] Fix typo in CDiskBlockPos struct's ToString
8bd98a3846 [trivial] Fix typo in CDiskBlockPos struct's ToString (Jon Layton)

Pull request description:

  (Logging)

Tree-SHA512: 5c0334fda15b1d668b251107772ae527e6b5f63d10e6c75330107eec0db7195845fdb9e92781591bcad6720bc8ef5af5a77cccf883170c4dfd2090b8c7ce16bd
2018-08-15 08:01:49 -04:00
MarcoFalke e393a18b51
Merge #13964: ci: Add Appveyor CI
1f6ff04e59 Use wildcard path in test_bitcoin.vcxproj (Chun Kuan Lee)
90cc69c0c7 ci: Add appveyor.yml to build on MSVC (Chun Kuan Lee)
4d0c7924d2 Make macro compatible with MSVC (Chun Kuan Lee)

Pull request description:

  Introduce Appveyor CI for MSVC. This would require the owner adding appveyor to this repo. Also fix some MSVC incompatible code.

  This `appveyor.yml` file is modified from @sipsorcery and @NicolasDorier 's code in #12613.

  Appveyor CI result: https://ci.appveyor.com/project/ken2812221/bitcoin/build/1.0.151

Tree-SHA512: b5b0f1686a33e54325ea6de81606806a7d9a0f8d4acbb97c9ce598386e8fcb2220def264777609ed2b850ac8c490fd181303ea522c5a70487272d46995f4c52d
2018-08-15 07:55:39 -04:00
Jon Layton 8bd98a3846 [trivial] Fix typo in CDiskBlockPos struct's ToString 2018-08-14 18:03:43 -05:00
Gregory Sanders 2252ec5008 Allow ConstructTransaction to not throw error with 0-input txn 2018-08-14 14:28:29 -04:00
Wladimir J. van der Laan 63f8b0128b
Merge #13917: Additional safety checks in PSBT signer
5df6f089b5 More tests of signer checks (Andrew Chow)
7c8bffdc24 Test that a non-witness script as witness utxo is not signed (Andrew Chow)
8254e9950f Additional sanity checks in SignPSBTInput (Pieter Wuille)
c05712cb59 Only wipe wrong UTXO type data if overwritten by wallet (Pieter Wuille)

Pull request description:

  The current PSBT signing code can end up producing a non-segwit signature, while only the UTXO being spent is provided in the PSBT (as opposed to the entire transaction being spent). This may be used to trick a user to incorrectly decide a transaction has the semantics he intends to sign.

  Fix this by refusing to sign if there is any mismatch between the provided data and what is being signed.

Tree-SHA512: b55790d79d8166e05513fc4c603a982a33710e79dc3c045060cddac6b48a1be3a28ebf8db63f988b6567b15dd27fd09bbaf48846e323c8635376ac20178956f4
2018-08-14 18:01:02 +02:00
Gregory Sanders 321159e53e don't report minversion wallet entry as unknown 2018-08-14 11:34:27 -04:00
Wladimir J. van der Laan 3e5424faf6
Merge #13960: Fix PSBT deserialization of 0-input transactions
bd19cc78cf Serialize non-witness utxo as a non-witness tx but always deserialize as witness (Andrew Chow)
43811e6338 Fix PSBT deserialization of 0-input transactions (Andrew Chow)

Pull request description:

  0-input transactions can be ambiguously deserialized as being witness transactions. Since the unsigned transaction is never serialized as a witness transaction as it has no witnesses, we should always deserialize it as a non-witness transaction and set the serialization flags as such.

  When a transaction is serliazed for the non-witness-utxo, it is always a valid network transaction and thus it should be always be deserialized as a witness transaction and the deserialzation flags are set as such.

  Fixes #13958

Tree-SHA512: 1937b3cb2618534478d4f533541fb9efce3cb5badb5d1964bfe19400f4aacc6c8ecedaf1f20d26b20baf94f81fd07dfb15b3b08089ecbd63aeecbc18c7c48086
2018-08-14 16:52:36 +02:00
Chun Kuan Lee 4d0c7924d2 Make macro compatible with MSVC 2018-08-14 09:19:47 +00:00
Wladimir J. van der Laan db3cb5c5a6
Merge #13948: trivial: Removes unsed CBloomFilter constructor.
265bd50884 Removes unsed `CBloomFilter` constructor. (251)

Pull request description:

  This pull request removes the `CBloomFilter::CBloomFilter(const unsigned int, const double, const unsigned int)` constructor, which became obsolete with 086ee67.

Tree-SHA512: 46742f178e219661e82609a9bf6b644ebc58ab3efc2d1865c5562980e84f16a5fa286be9813738196ad7a27e639dee926062538eb44cadd67ab87ad5e9a266ba
2018-08-14 10:58:44 +02:00
Carl Dong 16bcc1b823 Remove unused dummy_tx variable from FillPSBT 2018-08-13 18:45:26 -07:00
Andrew Chow bd19cc78cf Serialize non-witness utxo as a non-witness tx but always deserialize as witness
Strip out the witnesses when serializing the non-witness utxo. However
witness serializations are allowed, so make sure we always deserialize
as witness.
2018-08-13 15:00:06 -07:00
Andrew Chow 43811e6338 Fix PSBT deserialization of 0-input transactions
0-input transactions can be ambiguously deserialized as being witness
transactions. Since the unsigned transaction is never serialized as
a witness transaction as it has no witnesses, we should always
deserialize it as a non-witness transaction and set the serialization
flags as such.

Also always serialize the unsigned transaction as a non-witness transaction.
2018-08-13 14:59:31 -07:00
MarcoFalke ddc3ec92b0
Merge #13634: ui: Compile boost::signals2 only once
fa5ce27385 ui: Compile boost:signals2 only once (MarcoFalke)

Pull request description:

  ui is one of the modules that poison other modules with `boost/signals2` headers. This moves the include to the cpp file and uses a forward declaration in the header.

  Locally this speeds up the incremental build (building everything that uses the ui module) with gcc by ~5% for me. Gcc uses ~5% less memory.

  Would be nice if someone could verify the numbers roughly.

  I presume the improvements will be more pronounced if the other models would stop exposing the boost header as well.

Tree-SHA512: 078360eba330ddbca4268bd8552927eae242a239e18dfded25ec20be72650a68cd83af7ac160690249b943d33ae35d15df1313f1f60a0c28b9526853aa7d1e40
2018-08-13 15:02:38 -04:00
MarcoFalke 36b1b63f20 rpc: Expose ProcessNewBlockHeaders 2018-08-13 14:27:40 -04:00
Pieter Wuille 917353c8b0 Make SignPSBTInput operate on a private SignatureData object 2018-08-13 08:46:23 -07:00
Pieter Wuille cad5dd2368 Pass HD path data through SignatureData 2018-08-13 08:46:23 -07:00
Pieter Wuille 03a99586a3 Implement key origin lookup in CWallet 2018-08-13 08:46:23 -07:00
Pieter Wuille 3b01efa0d1 [MOVEONLY] Move ParseHDKeypath to utilstrencodings 2018-08-13 08:46:23 -07:00
Pieter Wuille 81e1dd5ce1 Generalize PublicOnlySigningProvider into HidingSigningProvider 2018-08-13 08:46:23 -07:00
Pieter Wuille 84f1f1bfdf Make SigningProvider expose key origin information 2018-08-13 08:46:23 -07:00
Pieter Wuille 611ab307fb Introduce KeyOriginInfo for fingerprint + path 2018-08-13 08:46:23 -07:00
Pieter Wuille 8254e9950f Additional sanity checks in SignPSBTInput 2018-08-13 08:21:16 -07:00
Pieter Wuille c05712cb59 Only wipe wrong UTXO type data if overwritten by wallet 2018-08-13 08:21:16 -07:00
MarcoFalke f87d0a9d75
Merge #13534: Don't assert(foo()) where foo() has side effects
6ad0328f1c Don't assert(foo()) where foo has side effects (practicalswift)

Pull request description:

  Don't `assert(foo())` where `foo` has side effects.

  From `assert(3)`:

  > If the macro `NDEBUG` is defined at the moment `<assert.h>` was last included, the macro `assert()` generates no code, and hence does nothing at all.

  Bitcoin currently cannot be compiled without assertions, but we shouldn't rely on that.

Tree-SHA512: 28cff0c6d1c2fb612ca58c9c94142ed01c5cfd0a2fecb8e59cdb6c270374b215d952ed3491d921d84dc1b439fa49da4f0e75e080f6adcbc6b0e08be14e54c170
2018-08-13 10:02:50 -04:00
MarcoFalke 3bd25c010c
Merge #13899: build: Enable -Wredundant-decls where available. Remove redundant redeclarations.
d56b73f217 Remove redundant extern (practicalswift)
f04bb1361c Enable -Wredundant-decls (gcc) if available (practicalswift)
a9e90e5002 Remove redundant redeclaration of rescanblockchain(...) in same scope (practicalswift)

Pull request description:

  Remove redundant redeclaration of `rescanblockchain` and enable `-Wredundant-decls` (gcc) where available to avoid accidental redundant redeclarations.

  ```
   CXX      wallet/libbitcoin_wallet_a-rpcwallet.o
  wallet/rpcwallet.cpp:4764:17: warning: redundant redeclaration of ‘UniValue rescanblockchain(const JSONRPCRequest&)’ in same scope [-Wredundant-decls]
   extern UniValue rescanblockchain(const JSONRPCRequest& request);
                   ^~~~~~~~~~~~~~~~
  wallet/rpcwallet.cpp:3929:10: note: previous declaration of ‘UniValue rescanblockchain(const JSONRPCRequest&)’
   UniValue rescanblockchain(const JSONRPCRequest& request)
            ^~~~~~~~~~~~~~~~
  ```

Tree-SHA512: b9af95fa53f494c3f6702e485956b66b042d2ff7578b4a53bf28e91aa844cdcf5d7ac3e2e710948eed566007324e81317304b8eabf2d4ea284cd6acd77f8ffcd
2018-08-13 09:55:35 -04:00
MarcoFalke f083ec13c3
Merge #13938: refactoring: Cleanup StartRest()
2da54f5a66 Cleanup StartRest() (DesWurstes)

Pull request description:

Tree-SHA512: 7e907315009c0351b7a3347ec13b6727abd12fe722d51cc061cb635ea20f9a550af5f50dc364c4313501b0dfc3696bcfa26a2a5f0170a4b5808624e043085d29
2018-08-13 09:42:50 -04:00
Wladimir J. van der Laan 825fb02ef1 net: Update hardcoded seeds
Pre-0.17 branch hardcoded seeds update.
2018-08-13 13:57:15 +02:00
MarcoFalke 73a09b4458
Merge #13905: docs: fixed bitcoin-cli -help output for help2man
869193f5a6 docs: fixed bitcoin-cli -help output for help2man (Hennadii Stepanov)

Pull request description:

  Currently `bitcon-cli -help` output forces help2man to produce `.TP` and `.IP` commands instead of a single `.IP` command for `-stdinrpcpass`  option.
  Removing an extra space fixes this issue.

  This pull request is rebased from #13879

Tree-SHA512: 1c5b25ed2ef7b7de42bc6210165bdbabe63f045699487f2db4790e0d3176f6493dfd3e8e19f4ddc38b551539465d7b41aea570f20dccbc0609f00fdfee1b5180
2018-08-13 07:33:33 -04:00
MarcoFalke a9c56b6634
Merge #13918: rpc: Replace median fee rate with feerate percentiles in getblockstats
4b7091a842 Replace median fee rate with feerate percentiles (Marcin Jachymiak)

Pull request description:

  Currently,  the `medianfeerate` statistic is calculated from the feerate of the middle transaction of a list of transactions sorted by feerate.

  This PR instead uses the value of the 50th percentile weight unit in the block, and also calculates the feerate at the 10th, 25th, 75th, and 90th percentiles.  This more accurately corresponds with what is generally meant by median feerate.

Tree-SHA512: 59255e243df90d7afbe69839408c58c9723884b8ab82c66dc24a769e89c6d539db1905374a3f025ff28272fb25a0b90e92d8101103e39a6d9c0d60423a596714
2018-08-13 07:18:25 -04:00
Wladimir J. van der Laan 2115cba9c6
Merge #13666: Always create signatures with Low R values
e306be7429 Use 72 byte dummy signatures when watching only inputs may be used (Andrew Chow)
48b1473c89 Use 71 byte signature for DUMMY_SIGNATURE_CREATOR (Andrew Chow)
18dfea0dd0 Always create 70 byte signatures with low R values (Andrew Chow)

Pull request description:

  When creating signatures for transactions, always make one which has a 32 byte or smaller R and 32 byte or smaller S value. This results in signatures that are always less than 71 bytes (32 byte R + 32 byte S + 6 bytes DER + 1 byte sighash) with low R values. In most cases, the signature will be 71 bytes.

  Because R is not mutable in the same way that S is, a low R value can only be found by trying different nonces. RFC 6979 for deterministic nonce generation has the option to specify additional entropy, so we simply use that and add a uin32_t counter which we increment in order to try different nonces. Nonces are sill deterministically generated as the nonce used will the be the first one where the counter results in a nonce that results in a low R value. Because different nonces need to be tried, time to produce a signature does increase. On average, it takes twice as long to make a signature as two signatures need to be created, on average, to find one with a low R.

  Having a fixed size signature makes size calculations easier and also saves half a byte of transaction size, on average.

  DUMMY_SIGNATURE_CREATOR has been modified to produce 71 byte dummy signatures instead of 72 byte signatures.

Tree-SHA512: 3cd791505126ce92da7c631856a97ba0b59e87d9c132feff6e0eef1dc47768e81fbb38bfbe970371bedf9714b7f61a13a5fe9f30f962c81734092a4d19a4ef33
2018-08-13 12:07:20 +02:00
Wladimir J. van der Laan 13d51a2b61
Merge #13808: wallet: shuffle coins before grouping, where warranted
18f690ec2f wallet: shuffle coins before grouping, where warranted (Karl-Johan Alm)

Pull request description:

  Coins are randomly shuffled in coin selection to avoid unintentional privacy leaks regarding the user's coin set. For the case where a user has a lot of coins with the same destination, these will be grouped into groups of 10 *before* the shuffling.

  It is unclear whether this has any implications at all, but this PR plugs the potential issue, if there ever is one, by shuffling the coins before they are grouped.

  Issue brought up in https://github.com/bitcoin/bitcoin/pull/12257#discussion_r204554549

Tree-SHA512: fb50ed4b5fc03ab4853d45b76e1c64476ad5bcd797497179bc37b9262885c974ed6811159fd8e581f1461b6cc6d0a66146f4b70a2777c0f5e818d1322e0edb89
2018-08-13 11:36:39 +02:00
Hennadii Stepanov 869193f5a6 docs: fixed bitcoin-cli -help output for help2man
The `help2man` parses a string containing two spaces between words with an issue:
it gives out `.TP` and `.IP` commands instead of a single `.IP` command.
Removing an extra space fixes this issue.
Currently the `-help` output for the `-stdin` option looks without any issue due to eliminating
of two spaces between words by a `FormatParagraph` call for this particular case.
For consistency and preventing from future regressions extra spaces have been removed from the both lines.
The redundant `strprintf` call has been removed aswell.
2018-08-13 12:12:03 +03:00
Wladimir J. van der Laan b0d3e9b102
qt: Translations update before 0.17 branch
Make sure that translations are synchronized with transifex before the
branch-off point to minimize the difference and prevent duplicate work.

Tree-SHA512: 41e71eaf14094606fd90011d035c551a635d5a715f865a49841dbe2b54a76b7fbf59a7918f86e5fd80a717e2934a9613fe463391fd01848d0a01e5c4e7e7fef0
2018-08-13 11:00:17 +02:00
251 265bd50884 Removes unsed CBloomFilter constructor.
This commit removes the `CBloomFilter::CBloomFilter(const unsigned int, const double, const unsigned int)` constructor, which became obsolete with 086ee67.
2018-08-13 01:24:55 +02:00
MarcoFalke fa6c3dea42
p2p: Clarify control flow in ProcessMessage() 2018-08-12 15:07:45 -04:00
Marcin Jachymiak 4b7091a842 Replace median fee rate with feerate percentiles
Removes medianfeerate result from getblockstats.
Adds feerate_percentiles which give the feerate of the 10th, 25th, 50th,
75th, and 90th percentile weight unit in the block.
2018-08-11 15:00:17 -04:00
DesWurstes 2da54f5a66 Cleanup StartRest() 2018-08-11 09:34:47 +03:00
MarcoFalke d6faea4f91
Merge #13908: [Docs] upgrade rescan time warning from minutes to >1 hour
bb5b1c0b2d [Docs] upgrade rescan time warning from minutes to >1 hour (Mason Simon)

Pull request description:

  When I rescanned just now it took well over an hour. The time warning "may take minutes" didn't prepare me for that.

  ```
  2018-08-08T03:10:17Z [wallet] Still rescanning. At block 174747. Progress=0.008341
  2018-08-08T03:11:17Z [wallet] Still rescanning. At block 204233. Progress=0.024533
  2018-08-08T03:12:17Z [wallet] Still rescanning. At block 221170. Progress=0.038340
  ...
  2018-08-08T04:16:17Z [wallet] Still rescanning. At block 524815. Progress=0.957105
  2018-08-08T04:17:17Z [wallet] Still rescanning. At block 528572. Progress=0.971323
  2018-08-08T04:18:17Z [wallet] Still rescanning. At block 532458. Progress=0.986824
  ```

  This is on a 4-core 4ghz system with a 7200rpm drive.

Tree-SHA512: 722ccf566bfd6a3381fa173e08849cb676fe4c1f1cb2c4b86b07df2a5dc1ca0d54797cbe8fd606cdc2c60fef2be7c98e052460decdac2132ba759cff822132e8
2018-08-10 21:36:18 -04:00
lucash.dev@gmail.com a679109be4 Speed up knapsack_solver_test by not recreating wallet 100 times.
Moved the code for creating the wallet out of the 100-times repetition loop, for the most time-consuming tests.
2018-08-10 18:33:47 -07:00
MarcoFalke bced8ea71a
Merge #13927: rpc: Use pushKV in some new PSBT RPCs
227d27e70c Use pushKV in some new PSBT RPCs. (Daniel Kraft)

Pull request description:

  Most of the code uses `UniValue::pushKV` where appropriate, but some new RPC code related to PSBTs did not.  This fixes those places - after this change, there are no remaining source files I could find that contain `push_back(Pair(`.

Tree-SHA512: d6567cf144d05d7e42276bd66ff4cd44413328f985772d11bb9d7339d32ab7c3438d4bb0040a37e75f8d193c610b08fa971073935885e0a178546aa045daf9fa
2018-08-10 21:33:10 -04:00
Wladimir J. van der Laan 48bf8ff5b1
Merge #13907: Introduce a maximum size for locators.
e254ff5d53 Introduce a maximum size for locators. (Gregory Maxwell)

Pull request description:

  The largest sensible size for a locator is log in the number of blocks.
   But, as noted by Coinr8d on BCT a maximum size message could encode a
   hundred thousand locators.  If height were used to limit the messages
   that could open new attacks where peers on long low diff forks would
   get disconnected and end up stuck.

  Ideally, nodes first first learn to limit the size of locators they
   send before limiting what would be processed, but common implementations
   back off with an exponent of 2 and have an implicit limit of 2^32
   blocks, so they already cannot produce locators over some size.

  Locators are cheap to process so allowing a few more is harmless,
   so this sets the maximum to 64-- which is enough for blockchains
   with 2^64 blocks before the get overhead starts increasing.

Tree-SHA512: da28df9c46c988980da861046c62e6e7f93d0eaab3083d32e408d1062f45c00316d5e1754127e808c1feb424fa8e00e5a91aea2cc3b80326b71c148696f7cdb3
2018-08-10 19:52:13 +02:00
Wladimir J. van der Laan 71dec5c81f
Merge #13925: Merge leveldb subtree
ec749b1bcd Squashed 'src/leveldb/' changes from 64052c76c5..524b7e36a8 (MarcoFalke)

Pull request description:

  For review:

  ```sh
  git fetch https://github.com/bitcoin-core/leveldb
  ./test/lint/git-subtree-check.sh src/leveldb
  ```

  Closes #13860

Tree-SHA512: 9d13384fe35e7144b4a7fca57efe77b0cc5295952da4a397e4c6d8aa3f8043d5113fccedd3ae1dcaa3d2649e732e5f57a71504847946e055aa4dc8c3780e29fc
2018-08-10 19:48:14 +02:00
Andrew Chow e306be7429 Use 72 byte dummy signatures when watching only inputs may be used
With watching only inputs, we do not know how large the signatures
for those inputs will be as their signers may not have implemented
71 byte signatures. Thus we estimate their fees using the 72 byte
dummy signature to ensure that we pay enough fees.

This only effects fundrawtransaction when includeWatching is true.
2018-08-09 18:39:56 -07:00
Andrew Chow 48b1473c89 Use 71 byte signature for DUMMY_SIGNATURE_CREATOR
Changes DUMMY_SIGNATURE_CREATOR to create 71 byte dummy signatures.

Update comments to reflect this change
2018-08-09 18:39:56 -07:00
Andrew Chow 18dfea0dd0 Always create 70 byte signatures with low R values
When extra entropy is not specified by the caller, CKey::Sign will
now always create a signature that has a low R value and is at most
70 bytes. The resulting signature on the stack will be 71 bytes when
the sighash byte is included.

Using low R signatures means that the resulting DER encoded signature
will never need to have additional padding to account for high R
values.
2018-08-09 18:39:56 -07:00
Karl-Johan Alm 18f690ec2f
wallet: shuffle coins before grouping, where warranted
Issue brought up in https://github.com/bitcoin/bitcoin/pull/12257\#discussion_r204554549
2018-08-10 09:08:11 +09:00
Gregory Maxwell e254ff5d53 Introduce a maximum size for locators.
The largest sensible size for a locator is log in the number of blocks.
 But, as noted by Coinr8d on BCT a maximum size message could encode a
 hundred thousand locators.  If height were used to limit the messages
 that could open new attacks where peers on long low diff forks would
 get disconnected and end up stuck.

Ideally, nodes first first learn to limit the size of locators they
 send before limiting what would be processed, but common implementations
 back off with an exponent of 2 and have an implicit limit of 2^32
 blocks, so they already cannot produce locators over some size.

This sets the limit to an absurdly high amount of 101 in order to
 maximize compatibility with existing software.
2018-08-09 20:54:01 +00:00
Andrew Chow c1dde3a949 No longer shutdown after encrypting the wallet
Since the database environment is flushed, closed, and reopened during
EncryptWallet, there is no need to shut down the software anymore.
2018-08-09 11:28:33 -07:00
Andrew Chow d7637c5a3f After encrypting the wallet, reload the database environment
Calls ReloadDbEnv after encrypting the wallet so that the database
environment is flushed, closed, and reopened to prevent unencrypted
keys from being saved on disk.
2018-08-09 11:27:39 -07:00
Andrew Chow 5d296ac810 Add function to close all Db's and reload the databae environment
Adds a ReloadDbEnv function to BerkeleyEnvironment in order to close all Db
instances, closes the environment, resets it, and then reopens
the BerkeleyEnvironment.

Also adds a ReloadDbEnv function to BerkeleyDatabase that calls
BerkeleyEnvironment's ReloadDbEnv.
2018-08-09 11:27:39 -07:00
Andrew Chow a769461d5e Move BerkeleyEnvironment deletion from internal method to callsite
Instead of having the object destroy itself, having the caller
destroy it.
2018-08-09 11:27:39 -07:00
Daniel Kraft 227d27e70c Use pushKV in some new PSBT RPCs.
Most of the code uses UniValue::pushKV where appropriate, but some new
RPC code related to PSBTs did not.
2018-08-09 18:08:45 +02:00
MarcoFalke fa14fa742d
Merge leveldb subtree
Merge commit 'ec749b1bcdf2483b642fb51d635800e272c68ba6' into HEAD
2018-08-09 11:31:45 -04:00
MarcoFalke 3e3a50aeb8
Merge #13911: doc: Revert translated string change, clarify wallet log messages
c4a884d555 Trivial: Revert translated string change, clarify wallet log messages (Pierre Rochard)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/pull/12992 post-merge nits from @jnewbery

Tree-SHA512: 002d8a69b489fd216e15b7d6200d7117c489b32405d5e9f514f120d43113fd97ca2f235452b0093e0760bc03baf714edc4564ae14af8456e1b2a54f83c577bf3
2018-08-09 08:11:17 -04:00
MarcoFalke 8eb9870052
Merge #13876: wallet: Catch filesystem_error and raise InitError
fa8527ffec wallet: Catch filesystem_error and raise InitError (MarcoFalke)

Pull request description:

  Fixes #13754 by restoring the previous behaviour

Tree-SHA512: f64052e89f6b332be395df2a5ea6f227c213fa2f38e415e83f30a4fad0938e947e5cddff7902368a43c07be135955a31b90f7eac5a46875c58d54ea95f87f6e6
2018-08-09 08:03:23 -04:00
practicalswift 0e534d4dca Fix incorrect Doxygen comments 2018-08-08 22:14:45 +02:00
Chun Kuan Lee c4aecd1d80 Add risc-v 64-bit to gitian 2018-08-09 03:35:51 +08:00
Pierre Rochard c4a884d555 Trivial: Revert translated string change, clarify wallet log messages 2018-08-08 11:00:55 -04:00
Wladimir J. van der Laan df9f712746
Merge #13894: shutdown: Stop threads before resetting ptrs
faab63111d shutdown: Stop threads before resetting ptrs (MarcoFalke)

Pull request description:

  On shutdown some threads would continue to run after or during a pointer reset. This leads to occasional segfaults on shutdown.

  Fix this by resetting the smart pointers after all threads that might read from them have been stopped.

  This should fix:
  * A segfault in the txindex thread, that occurs when the txindex destructor is done, but the thread was not yet stopped (as this is done in the base index destructor)
  * A segfault in the scheduler thread, which dereferences conman. (e.g. CheckForStaleTipAndEvictPeers)

Tree-SHA512: abbcf67fadd088e10fe8c384fadfb90bb115d5317145ccb5363603583b320efc18131e46384f55a9bc574969013dfcbd08c49e0d42c004ed7212eca193858ab2
2018-08-08 15:19:00 +02:00
Wladimir J. van der Laan 78dae8cacc
Merge #13780: 0.17: Pre-branch maintenance
3fc20632a3 qt: Set BLOCK_CHAIN_SIZE = 220 (DrahtBot)
2b6a2f4a28 Regenerate manpages (DrahtBot)
eb7daf4d60 Update copyright headers to 2018 (DrahtBot)

Pull request description:

  Some trivial maintenance to avoid having to do it again after the 0.17 branch off.

  (The scripts to do this are in `./contrib/`)

Tree-SHA512: 16b2af45e0351b1c691c5311d48025dc6828079e98c2aa2e600dc5910ee8aa01858ca6c356538150dc46fe14c8819ed8ec8e4ec9a0f682b9950dd41bc50518fa
2018-08-08 13:55:27 +02:00
Mason Simon bb5b1c0b2d [Docs] upgrade rescan time warning from minutes to >1 hour 2018-08-07 22:39:34 -07:00
Ben Woosley 5eb20f81d9
Consistently use ParseHashV to validate hash inputs in rpc
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)"
2018-08-07 12:47:39 -04:00
Wladimir J. van der Laan 9d86aad287
Merge #13812: wallet: sum ancestors rather than taking max in output groups
23fbbb100f wallet: sum ancestors rather than taking max in output groups (Karl-Johan Alm)

Pull request description:

  This is pointed out in https://github.com/bitcoin/bitcoin/pull/12257#discussion_r204549758.

  Basically, the ancestors gives an indication as to how many ancestors the resulting transaction will have, which is more precise when summing up the values, rather than taking the maximum, since all the coins in the group will become ancestors if selected.

Tree-SHA512: 0588c4b6059669650614817e041526a2ab89dda8c07fca8e077c7669dca1fed51cd164f7df56340840ab60285d48f3b140dcee64f64bf696b2dd4ab16d556a13
2018-08-07 17:23:04 +02:00
Wladimir J. van der Laan e8f387f997
Merge #13843: [trivial] Add doxygen-compatible comments to CAffectedKeysVisitor
3339d84535 [trivial] add doxygen-compatible comments to CAffectedKeysVisitor (Pierre Rochard)

Pull request description:

Tree-SHA512: 0003fde198a6977d0c8988efc8f76428f9e095009fddf131b07bd9809ef76a778c86bb2b1305e33df16101b6b703cf43eb6193462bb9f3687f98c1d9b109dd96
2018-08-07 16:49:18 +02:00
MarcoFalke fa5ce27385
ui: Compile boost:signals2 only once 2018-08-07 10:49:10 -04:00
MarcoFalke 1cd5f2cf9a
Merge #13895: Docs: fix GetWarnings docs to reflect behavior
13bb5cae31 Docs: fix GetWarnings docs to reflect behavior (Ben Woosley)

Pull request description:

  In "gui", it returns all warnings, joined by a separator
  In "statusbar", it returns the last warning set which seems notionally to be the most important, though that is debatable

Tree-SHA512: 5fc0dc68d143a040b7b893b7176188e2b064c2cf1d559420906e4de636e16e9ab7451a1b87603020a7a8f66d6b94f4ee6c7da2697efad879f9e6de9c0e0c9ac1
2018-08-07 10:30:31 -04:00
Wladimir J. van der Laan e7ea858729
Merge #13527: policy: Remove promiscuousmempoolflags
faa24441ec policy: Remove promiscuousmempoolflags (MarcoFalke)

Pull request description:

  It seems odd to clutter validation code with features that can only ever be used for testing (testnet or regtest). Removing that test-only code makes the mempool logic less painful to understand and easier to reason about when changed or refactored in the future.

Tree-SHA512: 3b897aa9604ac8d82ebe9573c6efd468c93ddaa08d378ebc902e247b7aa6c68fcde71e5b449c08f17a067146cdc66dc50a67ce06d07607c27e5189a49c3fba3f
2018-08-07 15:45:37 +02:00
Wladimir J. van der Laan 51c693d49e
Merge #13657: wallet: assert to ensure accuracy of CMerkleTx::GetBlocksToMaturity
93de2891fa wallet: assert to ensure accuracy of CMerkleTx::GetBlocksToMaturity (Ben Woosley)

Pull request description:

  According to my understanding, it should not be possible for coinbase
  transactions to be conflicting, thus it should not be possible for
  GetDepthInMainChain to return a negative result. If it did, this would
  also result in innacurate results for GetBlocksToMaturity due to the
  math therein. asserting ensures accuracy.

Tree-SHA512: 8e71c26f09fe457cfb00c362ca27066f7f018ea2af1f395090fdc7fd9f5964b76f4317c23f7a4923776f00087558511da5c1c368095be39fb1bacc614a93c32f
2018-08-07 14:19:50 +02:00
Wladimir J. van der Laan b81a8a5ea9
Merge #13667: wallet: Fix backupwallet for multiwallets
a1a998cf24 wallet: Fix backupwallet for multiwallets (Daniel Kraft)

Pull request description:

  `backupwallet` was broken for multiwallets in their own directories (i.e. something like `DATADIR/wallets/mywallet/wallet.dat`).  In this case, the backup would use `DATADIR/wallets/wallet.dat` as source file and not take the specific wallet's directory into account.

  This led to either an error during the backup (if the wrong source file was not present) or would silently back up the wrong wallet; especially the latter behaviour can be quite bad for users.

Tree-SHA512: 7efe2450ca047e40719fcc7cc211ed94699056020ac737cada7b59e8240298675960570c45079add424d0aab520437d5050d956acd695a9c2452dd4317b4d2c4
2018-08-07 13:31:54 +02:00
Wladimir J. van der Laan 37ab117a87
Merge #13872: [docs] Reformat -help output for help2man
7272fdcfe7 [docs] Reformat -help output for help2man (Tim Ruffing)

Pull request description:

  This commit slightly changes the format of the "Usage" strings in CLI
  `-help` messages to meet the expection of the help2man tool, which we
  use to generate man pages. On the way, we remove a few calls to
  `strprintf()`, which became superficial after commit 32fbfda.

  Before:
  ![screenshot from 2018-08-04 12-11-25](https://user-images.githubusercontent.com/1071625/43675564-6e2e016c-97e2-11e8-8de7-0912a4088efd.png)
  After:
  ![screenshot from 2018-08-04 12-11-46](https://user-images.githubusercontent.com/1071625/43675566-712d7032-97e2-11e8-85a7-5decc6dcb4b2.png)

Tree-SHA512: 9752ee0d0fde0b084e00232609866291ff493f4feb45919279b0f142b04635c049ddd2bf71ff6ad57d4ae1ed37103348640d253bb4f0b3e16b7fd2bb4b2a6fba
2018-08-07 10:32:53 +02:00
practicalswift d56b73f217 Remove redundant extern 2018-08-07 09:34:45 +02:00
practicalswift a9e90e5002 Remove redundant redeclaration of rescanblockchain(...) in same scope 2018-08-06 23:52:35 +02:00
Ben Woosley 13bb5cae31
Docs: fix GetWarnings docs to reflect behavior
In "gui", it returns all warnings, joined by a separator
In "statusbar", it returns just the first warning
2018-08-06 17:16:15 -04:00
MarcoFalke faab63111d
shutdown: Stop threads before resetting ptrs 2018-08-06 16:35:41 -04:00
John Newbery b2f23c4153 [RPC] Remove getinfo deprecation warning 2018-08-06 11:20:27 -04:00
MarcoFalke fa8527ffec
wallet: Catch filesystem_error and raise InitError 2018-08-04 12:04:38 -04:00
Tim Ruffing 7272fdcfe7 [docs] Reformat -help output for help2man
This commit slightly changes the format of the "Usage" strings in CLI
`-help` messages to meet the expection of the help2man tool, which we
use to generate man pages. On the way, we remove a few calls to
`strprintf()`, which became superficial after commit 32fbfda.
2018-08-04 16:17:13 +02:00
Pierre Rochard 3339d84535 [trivial] add doxygen-compatible comments to CAffectedKeysVisitor 2018-08-03 15:30:08 -04:00
Chun Kuan Lee bb6ca65f98 gui: get special folder in unicode 2018-08-04 02:47:58 +08:00
Chun Kuan Lee 1c5d225853 Drop boost::scoped_array 2018-08-04 01:11:42 +08:00
Russell Yanofsky 9c4dc597dd Use LOCK macros for non-recursive locks
Instead of std::unique_lock.
2018-08-03 07:11:37 -05:00
Russell Yanofsky 1382913e61 Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection
They should also work with any other mutex type which std::unique_lock
supports.

There is no change in behavior for current code that calls these macros with
CCriticalSection mutexes.
2018-08-03 07:11:37 -05:00
Russell Yanofsky ba1f095aad MOVEONLY Move AnnotatedMixin declaration
Move AnnotatedMixin closer to where it's used, and after the DEBUG_LOCKORDER
function declarations so it can call them.
2018-08-03 07:11:37 -05:00
Russell Yanofsky 41b88e9337 Add unit test for DEBUG_LOCKORDER code 2018-08-03 07:11:37 -05:00
Ben Woosley 384273260a
test: Add testing of value_ret for SelectCoinsBnB
Fix that the early bailout optimization tests did not test the actual
selection because their utxo pool was polluted by the make_hard_case test
preceding.
2018-08-03 02:45:20 -04:00
Pierre Rochard 909f54c80a [wallet] Add wallet name to log messages
After multiple wallets became supported, wallet-related log messages
became ambiguous as to which wallet they were being emitted by.

fixes #11317
2018-08-02 12:09:39 -04:00
Varunram d5f745a5c7
trivial: correct typos 2018-08-02 21:27:17 +08:00
practicalswift dd777f3e12 Remove unused variable 2018-08-02 14:30:59 +02:00
practicalswift cdf4089457 Remove redundant assignments (dead stores) 2018-08-02 14:30:53 +02:00
Wladimir J. van der Laan e577669062
gui: Pull initial 017x translations from transifex
Tree-SHA512: 4372a0602587e2bfceae69e3c90726c5d4a9d34a934dac9d000a9611fa7fca51e9d0fbacaee60decbea09294e53f94259ddcef2b3f876fefa1fd9f8a4dc25188
2018-08-02 13:43:51 +02:00
Wladimir J. van der Laan 2c14c1fa2f
Merge #13791: gui: Reject dialogs if key escape is pressed
7bf22bf0c2 gui: Reject options dialog when key escape is pressed (João Barbosa)
4a43306a4f gui: Reject edit address dialog when key escape is pressed (João Barbosa)
f7a553177d gui: Add GUIUtil::ItemDelegate with keyEscapePressed signal (João Barbosa)

Pull request description:

  Currently `EditAddressDialog` and `OptionsDialog` don't close when the escape key is pressed. The `QDataWidgetMapper` instances prevents closing the dialogs because the escape key is used to reset the widgets values. More details and workarounds in https://stackoverflow.com/a/51487847 and http://qtramblings.blogspot.com/2010/10/qdatawidgetmapper-annoyances.html.

  The adopted solution is different from the above references. It turns out that `QDataWidgetMapper::setItemDelegate` sets the event filter for all mapped widgets. So in this PR the mapper's delegate are changed to a custom `GUIUtil::ItemDelegate` that offers the signal `keyEscapePressed`, which is connected to the `QDialog::reject` slot.

  Note that the installed event filter lets all events pass, so the current behaviour isn't changed, meaning that widgets values are reset in addition to closing the dialog.

Tree-SHA512: 9c961d488480b4ccc3880a11a8f1824b65f77570ee8918c7302c62775a1a73e52ae988a31a55ffff87b4170ddbecf833c2f09b66095c00eb6854a4d43f030f1f
2018-08-02 12:59:39 +02:00
Wladimir J. van der Laan d3325b02e4
Merge #13844: doc: correct the help output for -prune
312ff01ee5 -prune option -help output aligned with code (Hennadii Stepanov)

Pull request description:

  The -help output for -prune is aligned with the code.

  In the code (.../src/init.cpp#L1063):
  ```
          if (nPruneTarget < MIN_DISK_SPACE_FOR_BLOCK_FILES) {
              return InitError(strprintf(_("Prune configured below the minimum of %d MiB.  Please use a higher number."), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024));
          }
  ```
  So correct value of nPruneTarget is **greater than or equal to** MIN_DISK_SPACE_FOR_BLOCK_FILES.

Tree-SHA512: 8e55aa99c8f5a9d020677b0f1b016215e2dbda5fa4ee7c8504b12a3abef226bc21beca118fa332c0bf206a4aff913a5a717b55bb5b2ecdba38423e9c0161209e
2018-08-02 12:00:57 +02:00
Wladimir J. van der Laan aa30e4bb8f
Merge #13824: doc: Remove outdated net comment
fa365021bb doc: Remove outdated net comment (MarcoFalke)

Pull request description:

  `mapAddresses` and the corresponding "critsect" has been removed in 5fee401fe1 more than 6 years ago. Now is probably a good time to remove this confusing comment.

Tree-SHA512: 498a403d5703da395c18a7ebb776aa6e693e59fe43a839fefd261e0a5af58621763813979d4cfbd8d1728ce73b325b82002e393cde79bdbff33e0fbf68ab6747
2018-08-02 10:07:11 +02:00
Wladimir J. van der Laan c1cba35725
Merge #13835: [trivial,doc] Fix memory consistency model in comment
fe7180c5b2 [trivial,doc] Fix memory consistency model in comment (Jesse Cohen)

Pull request description:

  Updating a comment overlooked during review in #13247

Tree-SHA512: 0bd54ba1c265fdd77fd6e12ad0be46dd422348f7d926ce9abaca53fdb3a3c55c0d1cd90b4382321352076f4a81e2249c0014cd789f47a3637cb93bd983cb4657
2018-08-02 10:05:46 +02:00
Hennadii Stepanov 312ff01ee5
-prune option -help output aligned with code
see: .../src/init.cpp#L1063
2018-08-02 01:16:41 +03:00
Wladimir J. van der Laan f030410e88
Merge #13697: Support output descriptors in scantxoutset
f6b7fc349c Support h instead of ' in hardened descriptor paths (Pieter Wuille)
fddea672eb Add experimental warning to scantxoutset (Jonas Schnelli)
6495849bfd [QA] Extend tests to more combinations (Pieter Wuille)
1af237faef [QA] Add xpub range tests in scantxoutset tests (Jonas Schnelli)
151600bb49 Swap in descriptors support into scantxoutset (Pieter Wuille)
0652c3284f Descriptor tests (Pieter Wuille)
fe8a7dcd78 Output descriptors module (Pieter Wuille)
e54d76044b Add simple FlatSigningProvider (Pieter Wuille)
29943a904a Add more methods to Span class (Pieter Wuille)

Pull request description:

  As promised, here is an implementation of my output descriptor concept (https://gist.github.com/sipa/e3d23d498c430bb601c5bca83523fa82) and integration within the `scantxoutset` RPC that was just added through #12196.

  It changes the RPC to use descriptors for everything; I hope the interface is simple enough to encompass all use cases. It includes support for P2PK, P2PKH, P2WPKH, P2SH, P2WSH, multisig, xpubs, xprvs, and chains of keys - combined in every possible way.

Tree-SHA512: 63b54a96e7a72f5b04a8d645b8517d43ecd6a65a41f9f4e593931ce725a8845ab0baa1e9db6a7243190d8ac841f6e7e2f520d98c539312d78f7fd687d2c7b88f
2018-08-01 20:06:17 +02:00
Sjors Provoost d795c610d3
[qt] TransactionView: highlight replacement tx after fee bump 2018-08-01 18:43:46 +02:00
Jesse Cohen fe7180c5b2 [trivial,doc] Fix memory consistency model in comment 2018-08-01 12:19:45 -04:00
MarcoFalke c88529a178
Merge #13805: [wallet] Correctly limit output group size
a13647b8bd [qa] Add test for too-large wallet output groups (Suhas Daftuar)
57ec1c97b2 [wallet] correctly limit output group size (Suhas Daftuar)

Pull request description:

  Also add a test to ensure that output groups are being limited, even if a wallet has many outputs corresponding to the same scriptPubKey (the test fails without the first commit).

Tree-SHA512: 2aaa82005b0910488f5cbf40690d4c5e2f46949e299ef70b4cb6e440713811443d411dcbc6d71b1701fd82423073125e21747787d70830cd021c841afb732d51
2018-08-01 12:03:20 -04:00
MarcoFalke e83d82a85c
Merge #13247: Add tests to SingleThreadedSchedulerClient() and document the memory model
cbeaa91dbb Update ValidationInterface() documentation to explicitly specify threading and memory model (Jesse Cohen)
b296b425a7 Update documentation for SingleThreadedSchedulerClient() to specify the memory model (Jesse Cohen)
9994d01d8b Add Unit Test for SingleThreadedSchedulerClient (Jesse Cohen)

Pull request description:

  As discussed in #13023 I've split this test out into a separate pr

  This test (and documentation update) makes explicit the guarantee (previously undefined, but implied by the 'SingleThreaded' in `SingleThreadedSchedulerClient()`) - that callbacks pushed to the `SingleThreadedSchedulerClient()` obey the single threaded model for memory and execution - specifically, the callbacks are executed fully and in order, and even in cases where a subsequent callback is executed by a different thread, sequential consistency of memory for all threads executing these callbacks is maintained.

  Maintaining memory consistency should make the api more developer friendly - especially for users of the validationinterface. To the extent that there are performance implications from this decision, these are not currently present in practice because all use of this scheduler happens on a single thread currently, furthermore the lock should guarantee consistency across callback executions even when callbacks are executed by multiple threads (as the test does).

Tree-SHA512: 5d95a7682c402e5ad76b05bc9dfbca99ca64105f62ab9e78f6fc0f6ea8c5277aa399fbb94298e35cc677b0c2181ff17259584bb7ae230e38aa68b85ecbc22856
2018-07-31 20:52:05 -04:00
MarcoFalke fa365021bb
doc: Remove outdated net comment 2018-07-31 17:02:42 -04:00
MarcoFalke 0fb9c87815
Merge #13822: bench: Make CoinSelection output groups pass eligibility filter
494634a052 bench: Make CoinSelection output groups pass eligibility filter (Andrew Chow)

Pull request description:

  Set the depth of the output groups used in the CoinSelection benchmark to be 6 in order to pass the eligibility filter for the benchmark.

  Fixes #13813

Tree-SHA512: 55fc6aeda0127f5e155efb982aec211b70dfd3257808dce627886af6866ffa25de4df3c9b10f8c45b6c298a42542c54654f36e59efb208e9055885361f0e501c
2018-07-31 15:24:33 -04:00
Wladimir J. van der Laan 7d3623794a
Merge #13776: net: Add missing verification of IPv6 address in CNetAddr::GetIn6Addr(...)
2fb0066b99 net: Add missing verification of IPv6 address in CNetAddr::GetIn6Addr(...) (practicalswift)

Pull request description:

  Add missing verification of IPv6 address in `CNetAddr::GetIn6Addr(...)`.

Tree-SHA512: 8b0681252eec9cf293a2043e99fdacec520e321b477d8aca1cbd6327b85bf6c5e8cd820fb914f097c62655947e88745ebccd824a78b995a8186e910e6fe520aa
2018-07-31 20:47:40 +02:00
Andrew Chow 494634a052 bench: Make CoinSelection output groups pass eligibility filter
Set the depth of the output groups used in the CoinSelection benchmark
to be 6 in order to pass the eligibility filter for the benchmark.
2018-07-31 11:31:07 -07:00
MarcoFalke 230652cafc
Merge #13799: Ignore unknown config file options; warn instead of error
247d5740d2 Ignore unknown config file options for now (Pieter Wuille)
04ce0d88ca Report when unknown config file options are ignored (Pieter Wuille)

Pull request description:

  As reported by @satwo on IRC a few days ago, the current mechanism of treating unknown config file options as errors is problematic for options like `-rpcclienttimeout` which aren't defined for `bitcoind`.

  A full solution would be to either make all binaries be aware of each other's options, or to permit config file options that only apply to specific binaries (`bitcoind`, `bitcoin-qt`, `bitcoin-cli`). Both of these seem too invasive to introduce for 0.17.

  As a compromise, this PR makes it ignores those options, but still warn about it in the log file.

Tree-SHA512: dfddc771b91df3031a9c98d9f3292f8f4fcd1b97ebb7317b2f457e12d9f205dc63f42721302e7258dbb53f273d7cc041a65a0a9120972769555784e1f1cc9aef
2018-07-31 12:17:55 -04:00
Wladimir J. van der Laan 8ce55df70d
Merge #13794: chainparams: Update with data from assumed valid chain
fa8f2d826c doc: Fix chainTxData comment (MarcoFalke)
fa6094f152 chainparams: Update with data from assumed valid chain (MarcoFalke)

Pull request description:

  Can be reviewed by using the `getblock` and `getchaintxstats` rpcs of a synced node. Reviewers get extra points when their full node has checkpoints and assumevalid disabled.

Tree-SHA512: cedd61fde129ae4c16fc12275b61e4c5659b6d72dd801c608efc294188561bc986d94652fe9bea71ada48654258e2a074d2d2da78036c69608ccff3a6cc1ccf5
2018-07-31 06:53:09 +02:00
Pieter Wuille 247d5740d2 Ignore unknown config file options for now 2018-07-30 18:01:20 -07:00
Jesse Cohen cbeaa91dbb Update ValidationInterface() documentation to explicitly specify threading and memory model 2018-07-30 19:41:59 -04:00
Jesse Cohen b296b425a7 Update documentation for SingleThreadedSchedulerClient() to specify the memory model 2018-07-30 19:41:59 -04:00
João Barbosa 7bf22bf0c2 gui: Reject options dialog when key escape is pressed 2018-07-30 23:13:04 +01:00
João Barbosa 4a43306a4f gui: Reject edit address dialog when key escape is pressed 2018-07-30 23:13:04 +01:00
João Barbosa f7a553177d gui: Add GUIUtil::ItemDelegate with keyEscapePressed signal 2018-07-30 23:13:04 +01:00
MarcoFalke 84d5a6210c
Merge #13786: refactor: Avoid locking tx pool cs thrice
fa5ed4f8d2 refactor: Avoid locking tx pool cs thrice (MarcoFalke)

Pull request description:

  `addUnchecked` is (outside the tests) only called by ATMP, which already takes the tx pool read lock. So locking it twice more in both `addUnchecked` methods seems redundant.

  Similarly `CalculateMemPoolAncestors` is (beside once in the wallet) only called in contexts, where the tx pool lock is already taken. So remove the lock there as well.

Tree-SHA512: fcf603b570da0fc529fe6db8add218663eae52845510732bee0d4611263d2429d3d3c9c8ae68493d67287d13504500ed51905ccbe711eb15a0af3b019edad543
2018-07-30 16:18:23 -04:00
Karl-Johan Alm 23fbbb100f
wallet: sum ancestors rather than taking max in output groups 2018-07-31 04:54:41 +09:00
MarcoFalke fa8f2d826c
doc: Fix chainTxData comment 2018-07-30 15:49:23 -04:00
James O'Beirne 6f53edb395 Acquire cs_main before ATMP call in block_assemble bench
Otherwise we fail an assert in sync.cpp:AssertLockHeldInternal.
2018-07-30 12:08:22 -04:00
Suhas Daftuar 57ec1c97b2 [wallet] correctly limit output group size 2018-07-30 10:43:16 -04:00
Wladimir J. van der Laan 63d73f5bc8
Merge #13554: Remove unused function arguments
bd9d0690dc Remove unused argument to WitnessSigOps(...) (practicalswift)
d1d7cfebd2 Remove unused argument to DefaultOptions(...) (practicalswift)
05dbb0c042 Remove unused argument to ThreadHTTP(...) (practicalswift)

Pull request description:

  Remove unused function arguments.

Tree-SHA512: 9933b6d34ff00a32d2f06a2e542d1225bdfb2c960599f01a8ff0427324b3529db49f19ffdbf54059acbbef5ca87f4c3169e97082169022022cd1e3afa7aaa56d
2018-07-30 16:30:54 +02:00
MarcoFalke fa587773e5
scripted-diff: Remove unused first argument to addUnchecked
-BEGIN VERIFY SCRIPT-
git grep -l addUnchecked | xargs sed --regexp-extended -i -e 's/addUnchecked\([^)][^,]+,\s*/addUnchecked(/g'
-END VERIFY SCRIPT-
2018-07-30 09:09:32 -04:00
MarcoFalke fe5c49766c tx pool: Use the entry's hash instead of the one passed to addUnchecked 2018-07-30 08:57:49 -04:00
MarcoFalke ddd395f968 Mark CTxMemPoolEntry members that should not be modified const 2018-07-30 08:57:49 -04:00
Pieter Wuille 04ce0d88ca Report when unknown config file options are ignored 2018-07-30 00:35:44 -07:00
Ben Woosley 23f4343781
Add CMerkleTx::IsImmatureCoinBase method
All but one call to GetBlocksToMaturity is testing it relative to 0
for the purposes of determining whether the coinbase tx is immature.
In such case, the value greater than 0 implies that the tx is coinbase,
so there is no need to separately test that status.

This names the concept for easy singular use.
2018-07-29 19:49:14 -04:00
MarcoFalke fa6094f152
chainparams: Update with data from assumed valid chain 2018-07-29 13:30:41 -04:00
MarcoFalke fa5ed4f8d2
refactor: Avoid locking tx pool cs thrice 2018-07-29 08:04:06 -04:00
MarcoFalke ad51e1372b
Merge #13774: Return void instead of bool for functions that cannot fail
d78a8dc3e8 Return void instead of bool for functions that cannot fail (practicalswift)

Pull request description:

  Return `void` instead of `bool` for functions that cannot fail:
  * `CBlockTreeDB::ReadReindexing(...)`
  * `CChainState::ResetBlockFailureFlags(...)`
  * `CTxMemPool::addUnchecked(...)`
  * `CWallet::CommitTransaction(...)`
  * `CWallet::LoadDestData(...)`
  * `CWallet::LoadKeyMetadata(...)`
  * `CWallet::LoadScriptMetadata(...)`
  * `CWallet::LoadToWallet(...)`
  * `CWallet::SetHDChain(...)`
  * `CWallet::SetHDSeed(...)`
  * `PendingWalletTx::commit(...)`
  * `RemoveLocal(...)`
  * `SetMinVersion(...)`
  * `StartHTTPServer(...)`
  * `StartRPC(...)`
  * `TorControlConnection::Disconnect(...)`

  Some of the functions can fail by throwing.

  Found by manually inspecting the following candidate functions:

  ```
  $ git grep -E '(^((static|virtual|inline|friend)[^a-z])*[^a-z]*bool [^=]*\(|return true|return false)' -- "*.cpp" "*.h"
  ```

Tree-SHA512: c0014e045362dbcd1a0cc8f69844e7b8cbae4f538e7632028daeca3a797ac11d8d3d86ebc480bedcb8626df3e96779d592747d52a12556fc49921b114fa0ccc6
2018-07-29 07:56:36 -04:00
Pieter Wuille f6b7fc349c Support h instead of ' in hardened descriptor paths 2018-07-27 12:21:12 -07:00
Jonas Schnelli fddea672eb Add experimental warning to scantxoutset 2018-07-27 11:52:45 -07:00
Pieter Wuille 151600bb49 Swap in descriptors support into scantxoutset 2018-07-27 11:52:45 -07:00
Pieter Wuille 0652c3284f Descriptor tests 2018-07-27 11:52:45 -07:00
Pieter Wuille fe8a7dcd78 Output descriptors module 2018-07-27 11:52:45 -07:00
Pieter Wuille e54d76044b Add simple FlatSigningProvider 2018-07-27 11:52:18 -07:00
Pieter Wuille 29943a904a Add more methods to Span class
This introduces a rudimentary begin(), end(), operator[], and subspan to Span.
2018-07-27 11:52:18 -07:00
MarcoFalke ef4fac0ea5
Merge #13775: doc: Remove newlines from error message
620361fce8 Fix accidental use of the addition assignment operator ("+="). Remove newlines from error message. (practicalswift)

Pull request description:

  Fix accidental use of the addition assignment operator (`+=`).

  _Note to reviewers:_ Perhaps the `\n`:s should be removed too?

Tree-SHA512: 4e8c2dfd6025d78ef9d60522297994829dacc447e6b6782e15c0bdd5dd2daa17ca9a8948bfa9a15be57d9286092356381d7e6747980303852d273eb0df0dd76b
2018-07-27 14:38:46 -04:00
practicalswift 620361fce8 Fix accidental use of the addition assignment operator ("+="). Remove newlines from error message. 2018-07-27 18:47:03 +02:00
MarcoFalke f98d1e0008
Merge #13711: [bench] Add benchmark for unserialize prevector
46340b3337 [bench] Add benchmark for unserialize prevector (Akio Nakamura)

Pull request description:

  This PR adds benchmarks for the unserialization of the prevector.

  Note: Separated from #12324.

Tree-SHA512: c055a283328cc2634c01eb60f26604a8665939bbf77d367b6ba6b4e01e77d4511fab69cc3ddb1e62969adb3c48752ed870f45ceba153eee192302601341e18a7
2018-07-27 11:44:10 -04:00
practicalswift d78a8dc3e8 Return void instead of bool for functions that cannot fail
* CBlockTreeDB::ReadReindexing(...)
* CChainState::ResetBlockFailureFlags(...)
* CTxMemPool::addUnchecked(...)
* CWallet::LoadDestData(...)
* CWallet::LoadKeyMetadata(...)
* CWallet::LoadScriptMetadata(...)
* CWallet::LoadToWallet(...)
* CWallet::SetHDChain(...)
* CWallet::SetHDSeed(...)
* RemoveLocal(...)
* SetMinVersion(...)
* StartHTTPServer(...)
* StartRPC(...)
* TorControlConnection::Disconnect(...)
2018-07-27 13:19:03 +02:00
DrahtBot 3fc20632a3 qt: Set BLOCK_CHAIN_SIZE = 220 2018-07-27 07:15:37 -04:00
DrahtBot eb7daf4d60 Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
practicalswift 2fb0066b99 net: Add missing verification of IPv6 address in CNetAddr::GetIn6Addr(...) 2018-07-27 08:41:20 +02:00
practicalswift aecd615ad7 wallet: Fix accidental use of the comma operator 2018-07-26 23:33:16 +02:00
practicalswift 1ac3c983bf Mark single-argument constructors "explicit" 2018-07-26 17:15:32 +02:00
Jesse Cohen 1e3bcd2517 [net_processing] Add thread safety annotations 2018-07-25 15:23:53 -04:00
Jesse Cohen f393a533be Annotate AssertLockHeld() with ASSERT_CAPABILITY() for thread safety analysis 2018-07-25 10:31:27 -04:00
Wladimir J. van der Laan 2d41af1728
Merge #13658: [moveonly] Extract RescanWallet to handle a simple rescan
3fe836b78d [moveonly] Extract RescanWallet to handle a simple rescan (Ben Woosley)

Pull request description:

  Where the outcome does not depend on the result, apart from a simple
  success check.

Tree-SHA512: e0d29c6fc0c7f99a730289e5a80deb586b2848aead56b5198a71ef01f65374812468dfd57be0b8b076eb9be4090d5101d28d979a1d5c3d2f1caeca77b303e90e
2018-07-25 15:39:04 +02:00
Wladimir J. van der Laan 9f23c16599
Merge #13721: Bugfixes for BIP 174 combining and deserialization
fad231ad41 Fix merging of global unknown data in PSBTs (Andrew Chow)
41df035ee1 Check that PSBT keys are the correct length (Andrew Chow)

Pull request description:

  This PR fixes a few bugs that were found and adds tests checking for these errors.

  Specifically:
  - Single byte keys are checked to actually be one byte.
  - Unknown global data must be merged when combining two PSBTs.

Tree-SHA512: c0e7b4bc607d510cc005aaa7c0813ee58c5467ab7ce4adce485522dfeee92b1af3d29fe89df778b0ea812bb3827e085b30e04d4f4ebcefd8364d809573991332
2018-07-25 15:04:25 +02:00
MarcoFalke a140953907
Merge #13753: scripted-diff: Remove trailing whitespaces
12dd101345 scripted-diff: Remove trailing whitespaces (João Barbosa)

Pull request description:

  The script test/lint/lint-whitespace.sh should prevent new cases.

  This happens in some pulls where the code editor and the author 'git add's them, so this would fix it all.

Tree-SHA512: bcdd3472fcd01a2754e52212c7db1de2fdc422728b06785481954a27162fb72001cb73708329cc56e95bcc5e45c1348ebc4eacc2ccfa6aa12413c7ec450b6a33
2018-07-25 07:09:33 -04:00
fanquake 3828a79711
scripted-diff: prefer MAC_OSX over __APPLE__
-BEGIN VERIFY SCRIPT-
sed -i 's/__APPLE__/MAC_OSX/g' src/compat/byteswap.h src/util.cpp
-END VERIFY SCRIPT-
2018-07-25 07:30:28 +08:00
fanquake fa6e841e89
gui: remove macOS ProgressBar workaround 2018-07-25 07:30:28 +08:00
fanquake 68c272527f
gui: remove SubstituteFonts 2018-07-25 07:30:28 +08:00
Cristian Mircea Messel 6d5fcad576 [gui] Make proxy icon from statusbar clickable
Clicking on the proxy icon will open settings showing the network tab
Create enum Tab in OptionsModel
Use new connect syntax
Use lambda for private slots
2018-07-25 01:03:26 +03:00
João Barbosa 12dd101345 scripted-diff: Remove trailing whitespaces
-BEGIN VERIFY SCRIPT-

sed --in-place'' --regexp-extended 's/[[:space:]]+$//g' $(git grep -I --files-with-matches --extended-regexp '[[:space:]]+$' -- src test  ':!*.svg' ':!src/crypto/sha256_sse4*' ':!src/leveldb' ':!src/qt/locale' ':!src/secp256k1' ':!src/univalue')

-END VERIFY SCRIPT-
2018-07-24 20:46:23 +01:00
MarcoFalke 1211b15bf6
Merge #13656: Remove the boost/algorithm/string/predicate.hpp dependency
e3245f2e7b Removes Boost predicate.hpp dependency (251)

Pull request description:

  This pull request removes the `boost/algorithm/string/predicate.hpp` dependency from the project.

  To replace the the `predicate.hpp` dependency from the project the function calls to `boost::algorithm::starts_with` and `boost::algorithm::ends_with` have been replaced with respectively C++11's `std::basic_string::front` and `std::basic_string::back` function calls.

  Refactors that were not required, but have been done anyways:

  - The Boost function `all` was implicitly made available via the `predicate.hpp` header. Instead of including the appropriate header, function calls to `all` have been replaced with function calls to `std::all_of`.

  - The  `boost::algorithm::is_digit` predicate has been replaced with a custom `IsDigit` function that is locale independent and ASCII deterministic.

Tree-SHA512: 22dda6adfb4d7ac0cabac8cc33e8fb8330c899805acc1ae4ede402c4b11ea75a399414b389dfaa3650d23b47f41351b4650077af9005d598fbe48d5277bdc320
2018-07-24 14:50:05 -04:00
Wladimir J. van der Laan 5f7575e263
Merge #12257: [wallet] Use destination groups instead of coins in coin select
232f96f5c8 doc: Add release notes for -avoidpartialspends (Karl-Johan Alm)
e00b4699cc clean-up: Remove no longer used ivars from CInputCoin (Karl-Johan Alm)
43e04d13b1 wallet: Remove deprecated OutputEligibleForSpending (Karl-Johan Alm)
0128121101 test: Add basic testing for wallet groups (Karl-Johan Alm)
59d6f7b4e2 wallet: Switch to using output groups instead of coins in coin selection (Karl-Johan Alm)
87ebce25d6 wallet: Add output grouping (Karl-Johan Alm)
bb629cb9dc Add -avoidpartialspends and m_avoid_partial_spends (Karl-Johan Alm)
65b3eda458 wallet: Add input bytes to CInputCoin (Karl-Johan Alm)
a443d7a0ca moveonly: CoinElegibilityFilter into coinselection.h (Karl-Johan Alm)
173e18a289 utils: Add insert() convenience templates (Karl-Johan Alm)

Pull request description:

  This PR adds an optional (off by default) `-avoidpartialspends` flag, which changes coin select to use output groups rather than outputs, where each output group corresponds to all outputs with the same destination.

  It is a privacy improvement, as each time you spend some output, any other output that is publicly associated with the destination (address) will also be spent at the same time, at the cost of fee increase for cases where coin select without group restriction would find a more optimal set of coins (see example below).

  For regular use without address reuse, this PR should have no effect on the user experience whatsoever; it only affects users who, for some reason, have multiple outputs with the same destination (i.e. address reuse).

  Nodes with this turned off will still try to avoid partial spending, if the fee of the resulting transaction is not greater than the fee of the original transaction.

  Example: a node has four outputs linked to two addresses `A` and `B`:

  * 1.0 btc to `A`
  * 0.5 btc to `A`
  * 1.0 btc to `B`
  * 0.5 btc to `B`

  The node sends 0.2 btc to `C`. Without `-avoidpartialspends`, the following coin selection will occur:
  * 0.5 btc to `A` or `B` is picked
  * 0.2 btc is output to `C`
  * 0.3 - fee is output to (unique change address)

  With `-avoidpartialspends`, the following will instead happen:
  * Both of (0.5, 1.0) btc to `A` or `B` is picked (one or the other pair)
  * 0.2 btc is output to `C`
  * 1.3 - fee is output to (unique change address)

  As noted, the pro here is that, assuming nobody sends to the address after you spend from it, you will only ever use one address once. The con is that the transaction becomes slightly larger in this case, because it is overpicking outputs to adhere to the no partial spending rule.

  This complements #10386, in particular it addresses @luke-jr and @gmaxwell's concerns in https://github.com/bitcoin/bitcoin/pull/10386#issuecomment-300667926 and https://github.com/bitcoin/bitcoin/pull/10386#issuecomment-302361381.

  Together with `-avoidreuse`, this fully addresses the concerns in #10065 I believe.

Tree-SHA512: 24687a4490ba59cf4198ed90052944ff4996653a4257833bb52ed24d058b3e924800c9b3790aeb6be6385b653b49e304453e5d7ff960e64c682fc23bfc447621
2018-07-24 16:34:03 +02:00
Karl-Johan Alm e00b4699cc
clean-up: Remove no longer used ivars from CInputCoin 2018-07-24 15:05:38 +09:00
Karl-Johan Alm 43e04d13b1
wallet: Remove deprecated OutputEligibleForSpending 2018-07-24 15:05:38 +09:00
Karl-Johan Alm 59d6f7b4e2
wallet: Switch to using output groups instead of coins in coin selection 2018-07-24 15:05:37 +09:00
Karl-Johan Alm 87ebce25d6
wallet: Add output grouping 2018-07-24 15:05:37 +09:00
Karl-Johan Alm bb629cb9dc
Add -avoidpartialspends and m_avoid_partial_spends 2018-07-24 15:05:37 +09:00
Karl-Johan Alm 65b3eda458
wallet: Add input bytes to CInputCoin
With nInputBytes, coin selection can execute without a reference to the COutput
2018-07-24 15:05:36 +09:00
Karl-Johan Alm a443d7a0ca
moveonly: CoinElegibilityFilter into coinselection.h 2018-07-24 15:05:36 +09:00
Karl-Johan Alm 173e18a289
utils: Add insert() convenience templates 2018-07-24 15:05:36 +09:00
Wladimir J. van der Laan 7ebd8c6385
qt: Update translation source messages
Tree-SHA512: f286d4252487863c66e764a780e714739cc4783b6a72ec345973998cf717e5fde69dd960c6df1a4a84247939a159779dc4a9d26e2e0686b782ad5cacf6956caf
2018-07-23 17:23:20 +02:00
Wladimir J. van der Laan c0a47da725
Merge #13719: Avoid creating a temporary vector for size-prefixed elements
84547fa6d4 Avoid creating a temporary vector for size-prefixed elements (Pieter Wuille)

Pull request description:

  This is a simple improvement to the PSBT serialization code, avoiding the need for temporary vectors everywhere.

Tree-SHA512: 9f7243b7169ec8ba00ffad31af03c016ab84e4f76ebac810167f91f5e8008f3827ad59fbcee0cb2bd2334fc26466eb222404af24e7fb6ec040fd78229ebe0fd1
2018-07-23 12:52:53 +02:00
Wladimir J. van der Laan d2186b3db6
Merge #13742: doc: Adjust bitcoincore.org links
fa451511a1 doc: Adjust bitcoincore.org links (MarcoFalke)

Pull request description:

  Minor adjustments to our https://bitcoincore.org/ links:

  Mainly adding links of the Bitcoin Core Github mirror and Bitcoin Core website to the doxygen introduction. (See e.g. current master: https://dev.visucore.com/bitcoin/doxygen/index.html). Also removing the link to bitcoin.org, to not imply there is only one resource that educates about bitcoin.

Tree-SHA512: d4d50f6de4d4b412203934e947889ebc0f564747e26f9190a2cff64234bf9fc3d56b8f056651550ce568170fba448559fa005959ef4e504d990e2fbc96a2ed77
2018-07-23 12:32:58 +02:00
Ben Woosley 984d72ec65
Return the script type from Solver
Because false is synonymous with TX_NONSTANDARD, this conveys the same
information and makes the handling explicitly based on script type,
simplifying each call site.

Prior to this change it was common for the return value to be ignored,
or for the return value and TX_NONSTANDARD to be redundantly handled.
2018-07-22 21:37:00 -04:00
251 e3245f2e7b Removes Boost predicate.hpp dependency
This is a squashed commit that squashes the following commits:

This commit removes the `boost/algorithm/string/predicate.hpp` dependenc
from the project by replacing the function calls to `boost::algorithm::starts_with`
`boost::algorithm::ends_with` and `all` with respectively C++11'
`std::basic_string::front`, `std::basic_string::back`, `std::all_of` function calls

This commit replaces `boost::algorithm::is_digit` with  a locale independent isdigi
function, because the use of the standard library's `isdigit` and `std::isdigit
functions is discoraged in the developer notes
2018-07-22 21:34:45 +02:00
MarcoFalke 0a34593ddb
Merge #13740: trivial: remove unneeded include
0454b56d8a trivial: remove unneeded include (Nikolay Mitev)

Pull request description:

  Remove dead include

Tree-SHA512: 66380fe25259d37a19f955142ad53da24d4927064a84249989f54bebc21d9d688236fb60979acc79f219b05692c4c73b3ebab0872b8d03ab2447b0b44a06c8ed
2018-07-22 11:12:09 -04:00
Wladimir J. van der Laan a6f00ce66f
Merge #13212: Net: Fixed a race condition when disabling the network.
793290f940 Net: Fixed a race condition when disabling the network. (lmanners)

Pull request description:

  This change addresses a race condition where setnetworkactive=false wouldn't always disconnect all peers.

  Before this change, the following could happen:
  1. Thread A -- Begins connecting to a node.
  2. Thread B -- Sets kNetworkActive=false and disconnects connected nodes.
  3. Thread A -- Finishes connecting and adds node to list of connected nodes.

  The node that was connected from Thread A remains connected and active,
  even though kNetworkActive=false.

  To fix the race, disconnections when kNetworkActive=false are now handled in the main network loop.

  fixes #13038

Tree-SHA512: 6d0b7a78ae956358e796efcc034cb532c2e0d824a52ae822a3899eefc7df76327519d1f2d77362c9fddf34ef860abd095d7490d7cc02d0ba7543bf1e8c8f2535
2018-07-22 16:33:00 +02:00
MarcoFalke fa451511a1
doc: Adjust bitcoincore.org links 2018-07-22 10:32:38 -04:00
Wladimir J. van der Laan 6deac922e3
Merge #13633: Drop dead code from Stacks
5617840392 Drop dead code from Stacks (Ben Woosley)

Pull request description:

  Stacks is local to this file, and only used in DataFromTransaction, so
  it's easy to confirm this code is unused.

Tree-SHA512: cc680c99f9b31cb56db70f453087d642f83906ce594c07a6bf3e61427cfbee41441495d440b240419ba3386582cf0670c0999b2f51e7fd56b00e0a0f3f618845
2018-07-22 16:20:07 +02:00
Wladimir J. van der Laan 0d1ebf4d3f
Merge #13733: Utils: Refactor ArgsManager a little
9544a3f3fc tiny refactor for ArgsManager (AtsukiTak)

Pull request description:

  This PR contains some small refactors for `ArgsManager`.

  1. Mark `const` on member function if it possible.
  2. Remove unused `error` argument from `ArgsManager::IsArgKnown`.

  I'm not sure whether these refactors should be separated into another PR. If so, I will do that.

Tree-SHA512: 7df09e7f7c4cdd2e7cd60e34137faa7ca7463be66490f8552fdea3656da6ccc98886e258bdeef21820d197fc2fde06ab2d3405205f5de53f258df7c191d206b0
2018-07-22 16:09:06 +02:00
Nikolay Mitev 0454b56d8a trivial: remove unneeded include 2018-07-22 16:49:14 +03:00
MarcoFalke 05714f96e4
Merge #11762: Avoid locking mutexes that are already held by the same thread
01a06d6686 Avoid locking mutexes that are already held by the same thread (practicalswift)

Pull request description:

  Avoid locking mutexes that are already held by the same thread. These are reentrant mutexes, but still no need to lock them more than once per thread :-)

Tree-SHA512: e2fb85882e8800892fd8e8170f3c13128d6acfeb14d7b69fb9555f2b7ad0884fb201cf945b8144ffaf6fb1253c28af7c8c6c435319a7ae30ca003f28aa645a98
2018-07-22 09:41:36 -04:00
MarcoFalke 10b9a811b6
Merge #12764: doc: Remove field in getblocktemplate help that has never been used.
ac8a1d092e [RPC] Remove field in getblocktemplate help that has never been used (Conor Scott)

Pull request description:

  [BIP 22 - getblocktemplate](https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki#Transactions%20Object%20Format) specifies an optional flag, `required` if the transaction must be in the block.

  Luke's implementation #936 did not include this flag, and it was later added to the help description in #3246 (more than a year later) but the field was still never actually implemented. As far as I can tell, bitcoin core would have never actually included this in a `getblocktemplate` call, so it seems logical to remove it from the help description.

  If I am missing something or this is considered harmless - I can close the PR.

Tree-SHA512: f25dda51cc4e1512aff69309be04e3053bdccc1cf03c8d58e8866aa1fdf9d86cc57df872e85528351fc8a8d6d64a8f46a36c513680834762d854f368fbeb0f44
2018-07-22 09:40:18 -04:00
MarcoFalke 62baa28787
Merge #13691: Remove redundant variables, statements and forward declarations
3dee4cc509 Remove redundant statement (practicalswift)
99be644966 Remove redundant unused variables (practicalswift)
66ed242343 Remove redundant forward declaration (practicalswift)

Pull request description:

  Remove redundant …
  * ~access modifiers,~
  * forward declarations,
  * unused variables,
  * statements, and
  * ~return types from lambdas.~

Tree-SHA512: 328bb7d9c45398e44ecbee32095b6376879470dfddbc2180e037620d8390d524b51d7fda112fd58a078715e04432b24dd6998a2459f3550aa0498aa68de866d4
2018-07-22 09:38:10 -04:00
MarcoFalke 59407fce54
Merge #13722: trivial: Replace CPubKey::operator[] with CPubKey::vch where possible
6755569840 trivial: Replace CPubKey::operator[] with CPubKey::vch where possible (Nikolay Mitev)

Pull request description:

  Use variable name instead of calling operator[] through &(*this)[0]

Tree-SHA512: 7054ffda0fa33fb45d4d9f3b29698643f02fd1421d78d5197a0881f2c368dc410647fd2e1a6feb8048e30f8ab8bc2fa8749bf42b9ccbe42c30de8ff80ac45274
2018-07-22 09:09:07 -04:00
MarcoFalke e8c74348d3
Merge #13683: wallet: Introduce assertion to document the assumption that cache and cache_used are always set in tandem
d06330396f wallet: Avoid potential null pointer dereference in CWalletTx::GetAvailableCredit(...) (practicalswift)

Pull request description:

  Avoid potential null pointer dereference in `CWalletTx::GetAvailableCredit(...)`.

  Introduced in 4279da4785.

Tree-SHA512: 92d1da9682f0bab11f6f96395ca30549331b0a056cbceb7e1a7f98b3d17d10082aaeed0907cafd46f4164b0e0f4b77e01f78bfd7d24e0503a66c6942ae842aa5
2018-07-22 08:34:09 -04:00
MarcoFalke eeae4711f3
Merge #13726: Utils and libraries: Removes the boost/algorithm/string/join dependency
5f019d5354 Removes the boost/algorithm/string/join dependency (251)

Pull request description:

  This commit removes the `boost/algorithm/string/join` dependency from the project by replacing `boost::algorithm::join` with the helper function proposed by @MarcoFalke in https://github.com/bitcoin/bitcoin/pull/13726#discussion_r204159967

Tree-SHA512: d4ba3e7621b76bd5210aec9b8d6c320f7ee963d7f902e6d2d3fc0eadbee1cd77799e5c09be9c11452d2825f25740fc436cdec3a6b6c66ced674d771e4ed306ae
2018-07-21 22:38:31 -04:00
AtsukiTak 9544a3f3fc tiny refactor for ArgsManager
This commit contains 2 refactors.

1. mark "const" on ArgsManager::GetHelpMessage and IsArgKnown.
2. remove unused "error" argument from ArgsManager::IsArgKnown.

Firstly, I mark "const" on where it is possible to. It is mentioned
before (e.g. https://github.com/bitcoin/bitcoin/pull/13190#pullrequestreview-118823133).

And about 2nd change, ArgsManager::IsArgKnown was added at commit #4f8704d which was
merged at PR #13112. But from its beggining, "error" argument never be used.
I think it should be refactored.
2018-07-22 03:16:53 +09:00
practicalswift 01a06d6686 Avoid locking mutexes that are already held by the same thread 2018-07-21 19:46:04 +02:00
Nikolay Mitev 6755569840 trivial: Replace CPubKey::operator[] with CPubKey::vch where possible 2018-07-21 05:35:16 +03:00
251 5f019d5354 Removes the boost/algorithm/string/join dependency
This commit removes the `boost/algorithm/string/join` dependency
from the project by replacing `boost::algorithm::join` with
a simple helper function.
2018-07-21 01:14:25 +02:00
Ben Woosley 5b82aa7352
Fix bitcoin-cli --version
By declaring the relevant option.

Note contrib/devtools/gen-manpages.sh relies on this version information.
2018-07-20 14:24:47 -04:00
Wladimir J. van der Laan 2dc5ab6378
Merge #13482: Remove boost::program_options dependency
f447a0a707 Remove program options from build system (Chun Kuan Lee)
11588c639e Replace boost program_options (Chun Kuan Lee)

Pull request description:

  Concept from #12744, but without parsing negated options.

Tree-SHA512: 7f418744bb8934e313d77a5f162633746ef5d043de802b9c9cd9f7c1842e7e566eb5f171cd9e2cc13317281b2449c6fbd553fa4f09b837e6af2f5d2b2aabdca2
2018-07-20 16:45:44 +02:00
Wladimir J. van der Laan c575260f80
Merge #11637: p2p: Remove dead service bits code
fa4bf92be9 Remove dead service bits code (MarcoFalke)

Pull request description:

  Seems fine to remove for the upcoming 0.17 release

  Fixes #10993

Tree-SHA512: 3a4664b787e3da399bcaaba693619bd384826df14f469dbdfbbfffc540d9da3f2b322cda262b43388376785f77907c2540541c239ab0fca82bd7eb69d02b6b7a
2018-07-20 15:13:49 +02:00
Wladimir J. van der Laan 6b6e854362
Merge #9662: Add createwallet "disableprivatekeys" option: a sane mode for watchonly-wallets
a3fa4d6a6a QA: Fix bug in -usecli logic that converts booleans to non-lowercase strings (Jonas Schnelli)
4704e5f074 [QA] add createwallet disableprivatekey test (Jonas Schnelli)
c7b8f343e9 [Qt] Disable creating receive addresses when private keys are disabled (Jonas Schnelli)
2f15c2bc20 Add disable privatekeys option to createwallet (Jonas Schnelli)
cebefba085 Add option to disable private keys during internal wallet creation (Jonas Schnelli)
9995a602a6 Add facility to store wallet flags (64 bits) (Jonas Schnelli)

Pull request description:

  This mode ('createwallet {"disableprivatekeys": true}') is intended for a sane pure watch-only mode, ideal for a use-case where one likes to use Bitcoin-Core in conjunction with a hardware-wallet or another solutions for cold-storage.

  Since we have support for custom change addresses in `fundrawtransaction`, pure watch-only wallets including coin-selection are possible and do make sense for some use cases.

  This new mode disables all forms of private key generation and ensure that no mix between hot and cold keys are possible.

Tree-SHA512: 3ebe7e8d54c4d4e5f790c348d4c292d456f573960a5b04d69ca5ef43a9217c7e7671761c6968cdc56f9a8bc235f3badd358576651af9f10855a0eb731f3fc508
2018-07-20 14:28:50 +02:00
Akio Nakamura 46340b3337 [bench] Add benchmark for unserialize prevector
This patch adds 2 benchmarks to measure for performance of
the unserialization of prevector.
2018-07-20 17:57:01 +09:00
Andrew Chow fad231ad41 Fix merging of global unknown data in PSBTs
Actually merge the global unknown key-value pairs.

Add a test for merging unknown key-value pairs.
2018-07-19 18:49:51 -07:00
Andrew Chow 41df035ee1 Check that PSBT keys are the correct length
Checks that all of the one byte type keys are actually one byte and
throw an error if they are not.

Add tests for each type to check for this behavior.
2018-07-19 18:29:25 -07:00
Pieter Wuille 84547fa6d4 Avoid creating a temporary vector for size-prefixed elements 2018-07-19 16:16:37 -07:00
MarcoFalke aba2e666d7
Merge #13712: wallet: Fix non-determinism in ParseHDKeypath(...). Avoid using an uninitialized variable in path calculation.
27ee53c1ae wallet: Add error handling. Check return value of ParseUInt32(...) in ParseHDKeypath(...). (practicalswift)
7223263899 wallet: Add tests for ParseHDKeypath(...) (practicalswift)

Pull request description:

  Add error handling. Check return value of `ParseUInt32(...)` in `ParseHDKeypath(...)`.

  `ParseUInt32(...)` returns `false` if the entire string could not be parsed or when an overflow or underflow occurred. In such case the uninitialized variable `number` would be used in the calculation of `path` (prior to this commit).

  An example key path triggering this is `m/0/4294967296`:

  ```
    ParseHDKeypath("m/0/4294967296", keypath);
  ```

  `4294967296` is `1` + `0xFFFFFFFF` (`uint32_t` max: `4294967295`).

  Introduced in a4b06fb42e which was merged into `master` 14 hours ago as part of #13557 ("BIP 174 PSBT Serializations and RPCs").

Tree-SHA512: e5ff423f67c18d82c1231bde6343587a453e793c32004d93dc9b61be6d9372b57a6b2c9978d9eb1000d6cc82fd180f2486013f928dca737fb92daad22c16e467
2018-07-19 17:39:59 -04:00
MarcoFalke f281f8f755
Merge #13074: [trivial] Correct help text for importaddress RPC
2c71edc2fc [wallet] [rpc] Fix importaddress help text (John Newbery)

Pull request description:

  Help text for `importaddress` referred to the first parameter as `script`, when in fact it's `address`. Calling with a script argument fails:

  ```
  → bcli -named importaddress script=2N3qhMpHK8WNo7wv87W9eHMgvGyJU1593Ei
  error code: -8
  error message:
  Unknown named parameter script
  → bcli -named importaddress address=2N3qhMpHK8WNo7wv87W9eHMgvGyJU1593Ei
  # success!
  ```

Tree-SHA512: 24dcb2cbd0a43e25896b1c67fa0386df2453ec04d49a339e10992417b3921ce3df8a6aa5abba7d2237d6188b018948b2a21ea2f04d37120ad36c31c7b7fc9f1c
2018-07-19 17:34:12 -04:00
practicalswift 27ee53c1ae wallet: Add error handling. Check return value of ParseUInt32(...) in ParseHDKeypath(...). 2018-07-19 21:13:03 +02:00
practicalswift 7223263899 wallet: Add tests for ParseHDKeypath(...) 2018-07-19 21:13:03 +02:00
Wladimir J. van der Laan 4a3e8c5aa6
Merge #13500: [wallet] Decouple wallet version from client version
cd3f4aa808 Decouple wallet version from client version (Andrew Chow)

Pull request description:

  Instead of comparing version numbers in the wallet to the client version number, compare them to the latest supported wallet version in the client. This allows for wallet version numbers to be unrelated to the client version number.

Tree-SHA512: 69c3e1f45a40bde01d622d504a803fea32fc14e2e27b14b0729725349d8592d56ebca26fd06f117fd6f5164fb4ce980122751b6370f6e25f1a947dbdf4143ddd
2018-07-18 20:58:54 +02:00
Wladimir J. van der Laan b654723461
Merge #13557: BIP 174 PSBT Serializations and RPCs
020628e3a4 Tests for PSBT (Andrew Chow)
a4b06fb42e Create wallet RPCs for PSBT (Andrew Chow)
c27fe419ef Create utility RPCs for PSBT (Andrew Chow)
8b5ef27937 SignPSBTInput wrapper function (Andrew Chow)
58a8e28918 Refactor transaction creation and transaction funding logic (Andrew Chow)
e9d86a43ad Methods for interacting with PSBT structs (Andrew Chow)
12bcc64f27 Add pubkeys and whether input was witness to SignatureData (Andrew Chow)
41c607f09b Implement PSBT Structures and un/serialization methods per BIP 174 (Andrew Chow)

Pull request description:

  This Pull Request fully implements the [updated](https://github.com/bitcoin/bips/pull/694) BIP 174 specification. It is based upon #13425 which implements the majority of the signing logic.

  BIP 174 specifies a binary transaction format which contains the information necessary for a signer to produce signatures for the transaction and holds the signatures for an input while the input does not have a complete set of signatures.

  This PR contains structs for PSBT, serialization, and deserialzation code. Some changes to `SignatureData` have been made to support detection of UTXO type and storing public keys.

  ***

  Many RPCs have been added to handle PSBTs.

  `walletprocesspsbt` takes a PSBT format transaction, updates the PSBT with any inputs related to this wallet, signs, and finalizes the transaction. There is also an option to not sign and just update.

  `walletcreatefundedpsbt` creates a PSBT from user provided data in the same form as createrawtransaction. It also funds the transaction and takes an options argument in the same form as `fundrawtransaction`. The resulting PSBT is blank with no input or output data filled in. It is analogous to a combination of `createrawtransaction` and `fundrawtransaction`

  `decodepsbt` takes a PSBT and decodes it to JSON. It is analogous to `decoderawtransaction`

  `combinepsbt` takes multiple PSBTs for the same tx and combines them. It is analogous to `combinerawtransaction`

  `finalizepsbt` takes a PSBT and finalizes the inputs. If all inputs are final, it extracts the network serialized transaction and returns that instead of a PSBT unless instructed otherwise.

  `createpsbt` is like `createrawtransaction` but for PSBTs instead of raw transactions.

  `convertpsbt` takes a network serialized transaction and converts it into a psbt. The resulting psbt will lose all signature data and an explicit flag must be set to allow transactions with signature data to be converted.

  ***

  This supersedes #12136

Tree-SHA512: 1ac7a79e5bc669933f0a6fcc93ded55263fdde9e8c144a30266b13ef9f62aacf43edd4cbca1ffbe003090b067e9643c9298c79be69d7c1b10231b32acafb6338
2018-07-18 20:25:44 +02:00
Wladimir J. van der Laan 585db54dd1
Merge #13655: bitcoinconsensus: invalid flags error should be set to bitcoinconsensus_err
417b6c1d29 bitcoinconsensus: invalid flags should be set to bitcoinconsensus_error type, add test cases covering bitcoinconsensus error codes (Thomas Kerin)

Pull request description:

  A check was added to the bitcoinconsensus verify_script codepath to ensure that callers only used _exposed_ interpreter flags. I think this error should be written to `bitcoinconsensus_err* err` and not returned by verify_script?

  I modified the check so it indicates the error using *err like the others, and added tests covering the error codes.

Tree-SHA512: 8ab370e56956a7d4740f83475e6078774affd663ac92383a02b85295da550f1b4f7a7a68f32ed5c5bcb39d98e2f15ec0b76de8399887e7763eb7c1e21d131093
2018-07-18 17:19:15 +02:00
Wladimir J. van der Laan 0d8d6be791
Merge #13672: Modified in_addr6 cast in CConman class to work with msvc
822a2a33a7 Modified in_addr6 cast in CConman class to work with msvc. (Aaron Clauson)

Pull request description:

  Fix to allow net.cpp to compile with MSVC. Without this fix the `(in6_addr)IN6ADDR_ANY_INIT` implicit cast generates a compilation error.

Tree-SHA512: f21c5002401dc93564dcf8d49fbafe7c03ad4182df1616d2ee201e2e172f1d696ca7982fb5b42a3b7d6878c8649823044a858401b4172239fb4b0cc2a38db282
2018-07-18 15:03:27 +02:00
practicalswift 3dee4cc509 Remove redundant statement 2018-07-18 09:39:31 +02:00
practicalswift 99be644966 Remove redundant unused variables 2018-07-18 09:39:31 +02:00
practicalswift 66ed242343 Remove redundant forward declaration 2018-07-18 09:39:31 +02:00
Chun Kuan Lee 11588c639e Replace boost program_options 2018-07-18 02:48:25 +00:00
Ben Woosley 33539cb34b
Extract MakeUnique into utilmemory.h
And use it to reduce chainparamsbase's direct reliance on util.h to
only args handling.

utilmemory.h can be replaced with <memory> once we move to C++14.
2018-07-17 13:56:21 -04:00
Wladimir J. van der Laan 30640f8c2d
Merge #13680: [doc] Remove outdated comment about miner ignoring CPFP
db6eb90094 [doc] Remove outdated comment about mining code ignoring CPFP (James O'Beirne)

Pull request description:

  BlockAssembler chooses transactions on the basis of packages (which incorporate
  unconfirmed ancestors into feerate), so the specified RBF comment about mining
  code ignoring CPFP is out of date.

Tree-SHA512: a4c1e60fee0a8f450526d565951187f869d000febce0eea8a8d2e18bb140c3c1b8602953d9dcab2d1e8d0c4fc8d392c67eb0773d67e52080d48e6b9bf13f9ee2
2018-07-17 17:20:37 +02:00
Wladimir J. van der Laan 8fceae0d6f
Merge #12196: Add scantxoutset RPC method
be98b2d9a8 [QA] Add scantxoutset test (Jonas Schnelli)
eec7cf7b33 scantxoutset: mention that scanning by address will miss P2PK txouts (Jonas Schnelli)
94d73d32ab scantxoutset: support legacy P2PK script type (Jonas Schnelli)
892de1dfea scantxoutset: add support for scripts (Jonas Schnelli)
78304941f7 Blockchain/RPC: Add scantxoutset method to scan UTXO set (Jonas Schnelli)
9048575511 Add FindScriptPubKey() to search the UTXO set (Jonas Schnelli)

Pull request description:

  Alternative to #9152.

  This takes `<n>` pubkeys and optionally  `<n>` xpubs (together with a definable lookup windows where the default is 0-1000) and looks up common scripts in the UTXO set of all given or derived keys.

  The output will be an array similar to `listunspent`. That array is compatible with `createrawtransaction` as well as with `signrawtransaction`.

  This makes it possible to prepare sweeps and have them signed in a secure (cold) space.

Tree-SHA512: a2b22a117cf6e27febeb97e5d6fe30184926d50c0c7cbc77bb4121f490fed65560c52f8eac67a9720d7bf8f420efa42459768685c7e7cc03722859f51a5e1e3b
2018-07-17 16:03:16 +02:00
MarcoFalke f8a32a316b
Merge #13682: bench: Remove unused variable
fa39f674ae bench: Remove unused variable (practicalswift)

Pull request description:

  Remove unused variable `vch`.

Tree-SHA512: 624d206d27453ec071d20ca52d7f9e142710ebe7529fc793beb98a61c6a74ad481f4433d14401b7761070746d99e0aa35dd67568a017b18617d6be88de6f3105
2018-07-17 08:55:46 -04:00
MarcoFalke cbc9b50734
Merge #13663: tests: Avoid read/write to default datadir
fa43a4138b bench_bitcoin: Avoid read/write to default datadir (MarcoFalke)
ea80b81e2e test_bitcoin: Avoid read/write to default datadir (MarcoFalke)

Pull request description:

  tests should never read or write and potentially corrupt the default datadir, so try to avoid it.

Tree-SHA512: ee446ff4bf59da2aed38c2e4758581d6103e9d4c35a118497e9ec21d566ba33d913e160c2d7ba2ea6f937f000343ecea3816154bd87ee47f64f5b0cf9e88f6e0
2018-07-17 08:05:26 -04:00
practicalswift d06330396f wallet: Avoid potential null pointer dereference in CWalletTx::GetAvailableCredit(...) 2018-07-17 10:58:22 +02:00
practicalswift fa39f674ae bench: Remove unused variable 2018-07-17 10:11:57 +02:00
Andrew Chow 020628e3a4 Tests for PSBT
Added functional tests for PSBT that test the RPCs. Also added all
of the BIP 174 test vectors (except for the updater tests) in the
functional tests.

Added a Unit test for the BIP 174 updater test vector.
2018-07-16 17:05:30 -07:00
Andrew Chow a4b06fb42e Create wallet RPCs for PSBT
walletprocesspsbt takes a PSBT format transaction, updates the
PSBT with any inputs related to this wallet, signs, and finalizes
the transaction. There is also an option to not sign and just
update.

walletcreatefundedpsbt creates a PSBT from user provided data
in the same form as createrawtransaction. It also funds the transaction
and takes an options argument in the same form as fundrawtransaction.
The resulting PSBT is blank with no input or output data filled
in.
2018-07-16 16:08:24 -07:00
Andrew Chow c27fe419ef Create utility RPCs for PSBT
decodepsbt takes a PSBT and decodes it to JSON

combinepsbt takes multiple PSBTs for the same tx and combines them.

finalizepsbt takes a PSBT and finalizes the inputs. If all inputs
are final, it extracts the network serialized transaction and returns
that instead of a PSBT unless instructed otherwise.

createpsbt is like createrawtransaction but for PSBTs instead of
raw transactions.

convertpsbt takes a network serialized transaction and converts it
into a psbt. The resulting psbt will lose all signature data and
an explicit flag must be set to allow transactions with signature
data to be converted.
2018-07-16 16:08:24 -07:00
James O'Beirne db6eb90094 [doc] Remove outdated comment about mining code ignoring CPFP
BlockAssembler chooses transactions on the basis of packages (which incorporate
unconfirmed ancestors into feerate), so the specified RBF comment about mining
code ignoring CPFP is out of date.
2018-07-16 18:34:28 -04:00
Pieter Wuille 347b4ff825 Initialize m_next_send_inv_to_incoming 2018-07-16 14:08:38 -07:00
Pieter Wuille f8d470e246
Merge #13298: Net: Bucketing INV delays (1 bucket) for incoming connections to hide tx time
d45b344ffd Bucket for inbound when scheduling invs to hide tx time (Gleb)

Pull request description:

  It has been brought up to my attention that current random delays mechanism (originally intended to obfuscate transaction metadata) allows to easily estimate the time a transaction was received by a node.

  It may be done by connecting multiple observer nodes to the same node. Each of those nodes will generate its own schedule of delays. Combined metadata regarding those events from different sources allows an observer to estimate transaction time.

  After this patch a spy won't gain additional information by just creating multiple connections to a target.

Tree-SHA512: c71dae5ff350b614cb40a8e201fd0562d3e03e3e72a5099718cd451f0d84c66d5e52bbaf0d5b4b75137514c8efdedcc6ef4df90142b360153f04ad0721545ab1
2018-07-16 10:37:02 -07:00
Wladimir J. van der Laan 17943f77bd
Merge #13652: rpc: Fix that CWallet::AbandonTransaction would leave the grandchildren, etc. active
89e70f9d7f Fix that CWallet::AbandonTransaction would only traverse one level (Ben Woosley)

Pull request description:

  Prior to this change, it would mark only the first layer of
  child transactions abandoned, due to always following the input `hashTx`
  rather than the current `now` tx.

Tree-SHA512: df068b49637d299ad73237c7244005fe5aa966d6beae57aff12e6948f173d9381e1b5d08533f7e3a1416991ed57f9f1f7b834057141d85c07dc60bb1f0872cea
2018-07-16 14:53:30 +02:00
Aaron Clauson 822a2a33a7 Modified in_addr6 cast in CConman class to work with msvc. 2018-07-16 16:29:27 +10:00
Mason Simon c64cc1bd94 scripted-diff: Fix references to share/rpcuser (now share/rpcauth)
Commit 3fdb29778a renamed share/rpcuser to share/rpcauth but left references to the old path in code; this commit fixes the old references.

Performed update using https://github.com/facebook/codemod with command: `codemod --extensions cpp,py,md 'share/rpcuser' 'share/rpcauth'`

-BEGIN VERIFY SCRIPT-
git grep --files-with-matches 'share/rpcuser' src/*.cpp | xargs sed -i -E 's:share/rpcuser:share/rpcauth:g'
git grep --files-with-matches 'share/rpcuser' test/functional/*.py | xargs sed -i -E 's:share/rpcuser:share/rpcauth:g'
-END VERIFY SCRIPT-
2018-07-15 17:56:02 -07:00
Jonas Schnelli eec7cf7b33
scantxoutset: mention that scanning by address will miss P2PK txouts 2018-07-15 21:18:11 +01:00
Jonas Schnelli 94d73d32ab
scantxoutset: support legacy P2PK script type 2018-07-15 21:18:10 +01:00
Jonas Schnelli 892de1dfea
scantxoutset: add support for scripts 2018-07-15 21:18:06 +01:00
Jonas Schnelli 78304941f7
Blockchain/RPC: Add scantxoutset method to scan UTXO set 2018-07-15 21:17:23 +01:00
Daniel Kraft a1a998cf24 wallet: Fix backupwallet for multiwallets
backupwallet was broken for multiwallets in their own directories
(i.e. something like DATADIR/wallets/mywallet/wallet.dat).  In this
case, the backup would use DATADIR/wallets/wallet.dat as source file
and not take the specific wallet's directory into account.

This led to either an error during the backup (if the wrong source
file was not present) or would silently back up the wrong wallet;
especially the latter behaviour can be quite bad for users.
2018-07-15 16:38:33 +02:00
Ben Woosley 3fe836b78d
[moveonly] Extract RescanWallet to handle a simple rescan
Where the outcome does not depend on the result, apart from a simple
success check.
2018-07-14 12:42:28 -04:00
Sjors Provoost 65a449f8e3
Explain when reindex-chainstate can be used instead of reindex 2018-07-14 17:48:16 +02:00
MarcoFalke fa43a4138b
bench_bitcoin: Avoid read/write to default datadir 2018-07-14 10:46:54 -04:00
MarcoFalke ea80b81e2e test_bitcoin: Avoid read/write to default datadir 2018-07-14 10:36:14 -04:00
Gleb d45b344ffd Bucket for inbound when scheduling invs to hide tx time 2018-07-13 23:14:35 -07:00
Pieter Wuille b25a4c2284
Merge #13072: Update createmultisig RPC to support segwit
f40b3b82df [tests] functional test for createmultisig RPC (Anthony Towns)
b9024fdda3 segwit support for createmultisig RPC (Anthony Towns)
d58055d25f Move AddAndGetDestinationForScript from wallet to outputype module (Anthony Towns)
9a44db2e46 Add outputtype module (Anthony Towns)

Pull request description:

  Adds an "address_type" parameter that accepts "legacy", "p2sh-segwit", and "bech32" to choose the type of address created. Defaults to "legacy" rather than the value of the `-address-type` option for backwards compatibility.

  As part of implementing this, OutputType is moved from wallet into its own module, and `AddAndGetDestinationForScript` is changed to apply to a `CKeyStore` rather than a wallet, and to invoke `keystore.AddCScript(script)` itself rather than expecting the caller to have done that.

  Fixes #12502

Tree-SHA512: a08c1cfa89976e4fd7d29caa90919ebd34a446354d17abb862e99f2ee60ed9bc19d8a21a18547c51dc3812cb9fbed86af0bef2f1e971f62bf95cade4a7d86237
2018-07-13 20:31:13 -07:00
Pieter Wuille 1329ef1f00
Merge #13651: [moveonly] Extract CWallet::MarkInputsDirty, and privatize AddToWalletIfInvolvingMe
17e6aa8e33 Privatize CWallet::AddToWalletIfInvolvingMe (Ben Woosley)
b7f5650942 Extract CWallet::MarkInputsDirty (Ben Woosley)

Pull request description:

  Thus reducing code and surface area of CWallet.

Tree-SHA512: 31a99acc77ef3438ef9b95d60030972b707bd69d6e7b1498a5f776b219d9aabc83464f75bfec7bad5cb635d0b2d686c389914e5cc57a4bb0b93c47bd82ca608c
2018-07-13 20:24:37 -07:00
Pieter Wuille 9a1ad2c5cb
Merge #11658: During IBD, when doing pruning, prune 10% extra to avoid pruning again soon after
ac51a26bdc During IBD, when doing pruning, prune 10% extra to avoid pruning again soon after (Luke Dashjr)

Pull request description:

  Pruning forces a chainstate flush, which can defeat the dbcache and harm performance significantly.

  Alternative to #11359

Tree-SHA512: 631e4e8f94f5699e98a2eff07204aa2b3b2325b2d92e8236b8c8d6a6730737a346e0ad86024e705f5a665b25e873ab0970ce7396740328a437c060f99e9ba4d9
2018-07-13 20:16:41 -07:00
Pieter Wuille 1e90862f5d
Merge #13417: [net] Tighten scope in net_processing
3339ba28e9 Make g_enable_bip61 a member variable of PeerLogicValidation (Jesse Cohen)
6690a28606 Restrict as much as possible in net_processing to translation unit (Jesse Cohen)
1d4df02b7e [move-only] Move things only referenced in net_processing out of header file (Jesse Cohen)
02bbc05310 Rescope g_enable_bip61 to net_processing (Jesse Cohen)

Pull request description:

  As part of a larger effort to decouple net_processing and validation a bit, these are a bunch of simple scope cleanups. I've moved things out of the header file that are only referenced in net_processing and added static (or anonymous namespace) modifiers to everything possible in net_processing.

  There are a handful of functions which could be static except that they are exposed for the sake of unit testing - these are explicitly commented. There has been some discussion of a compile time annotation, but no conclusion has been reached on that yet.

  This is somewhat related to other prs #12934 #13413 #13407 and will be followed by prs that reduce reliance on cs_main to synchronize data structures which are translation unit local to net_processing

Tree-SHA512: 46c9660ee4e06653feb42ba92189565b0aea17aac2375c20747c0d091054c63829cbf66d2daddf65682b58ce1d6922e23aefea051a7f2c8abbb6db253a609082
2018-07-13 20:10:55 -07:00
Pieter Wuille ad552a54c5
Merge #13566: Fix get balance
702ae1e21a [RPC] [wallet] allow getbalance to use min_conf and watch_only without accounts. (John Newbery)
cf15761f6d [wallet] GetBalance can take a min_depth argument. (John Newbery)
0f3d6e9ab7 [wallet] factor out GetAvailableWatchOnlyBalance() (John Newbery)
7110c830f8 [wallet] deduplicate GetAvailableCredit logic (John Newbery)
ef7bc8893c [wallet] Factor out GetWatchOnlyBalance() (John Newbery)
4279da4785 [wallet] GetBalance can take an isminefilter filter. (John Newbery)

Pull request description:

  #12953 inadvertently removed the functionality to call `getbalance "*" <int> <bool>` to get the wallet's balance with either minconfs or include_watchonly.

  This restores that functionality (when `-deprecatedrpc=accounts`), and also makes it possible to call ``getbalance minconf=<int> include_watchonly=<bool>` when accounts are not being used.

Tree-SHA512: 67e84de9291ed6d34b23c626f4dc5988ba0ae6c99708d02b87dd3aaad3f4b6baa6202a66cc2dadd30dd993a39de8036ee920fcaa8cbb1c5dfe606e6fac183344
2018-07-13 19:46:31 -07:00
Pieter Wuille d6b2235ca4
Merge #13630: Drop unused pindexRet arg to CMerkleTx::GetDepthInMainChain
d6f39b6c64 Drop unused pindexRet arg to CMerkleTx::GetDepthInMainChain (Ben Woosley)

Pull request description:

Tree-SHA512: 5f064a47e71113f90f296ab36dae92173ff3fc632ab4e1e85dc71d556cb9239d15939b1e542f4292dab93d336795b7f2e4ae64f6984303c852df8d24f54ccebe
2018-07-13 19:33:41 -07:00
Andrew Chow 8b5ef27937 SignPSBTInput wrapper function
The SignPSBTInput function takes a PSBTInput, SignatureData, SigningProvider,
and other data necessary for signing. It fills the SignatureData with data from
the PSBTInput, retrieves the UTXO from the PSBTInput, signs and finalizes the
input if possible, and then extracts the results from the SignatureData and
puts them back into the PSBTInput.
2018-07-13 14:27:31 -07:00
Andrew Chow 58a8e28918 Refactor transaction creation and transaction funding logic
In preparation for more create transaction and fund transcation RPCs,
refactor the transaction creation and funding logic into separate
functions.
2018-07-13 14:27:31 -07:00
Andrew Chow e9d86a43ad Methods for interacting with PSBT structs
Added methods which move data to/from SignaturData objects to
PSBTInput and PSBTOutput objects.

Added sanity checks for PSBTs as a whole which are done immediately
after deserialization.

Added Merge methods to merge a PSBT into another one.
2018-07-13 14:27:31 -07:00
Andrew Chow 12bcc64f27 Add pubkeys and whether input was witness to SignatureData
Stores pubkeys in SignatureData and retrieves them when using GetPubKey().

Stores whether the signatures in a SignatureData are for a witness input.
2018-07-13 14:27:31 -07:00
Andrew Chow 41c607f09b Implement PSBT Structures and un/serialization methods per BIP 174 2018-07-13 14:27:31 -07:00
Thomas Kerin 417b6c1d29 bitcoinconsensus: invalid flags should be set to bitcoinconsensus_error type, add test cases covering bitcoinconsensus error codes 2018-07-13 22:13:10 +01:00
Ben Woosley 17e6aa8e33
Privatize CWallet::AddToWalletIfInvolvingMe
And document in the header.
2018-07-13 16:18:14 -04:00
Ben Woosley b7f5650942
Extract CWallet::MarkInputsDirty
To avoid repeated implementations.
2018-07-13 16:18:13 -04:00
Jonas Schnelli 619cd29393
Merge #12944: [wallet] ScanforWalletTransactions should mark input txns as dirty
3c292cc19 ScanforWalletTransactions should mark input txns as dirty (Gregory Sanders)

Pull request description:

  I'm hitting a corner case in my mainnet wallet where I load a restore a wallet, call `rescanblockchain` from RPC, and it's "double counting" an output I've sent to myself since currently it never marks input transactions as dirty. This is fixed by a restart of the wallet.

  Note that this only happens with keys with birthdate *after* the blocks containing the spent funds which gets scanned on startup, so it's hard to test without a set seed function.

Tree-SHA512: ee1fa152bb054b57ab4c734e355df10d241181e0372c81d583be61678fffbabe5ae60b09b05dc1bbbcfb4838df9d8538791d4c1d80a09b84d78ad2f50dcb0a61
2018-07-13 20:34:43 +01:00
Ben Woosley 93de2891fa
wallet: assert to ensure accuracy of CMerkleTx::GetBlocksToMaturity
According to my understanding, it should not be possible for coinbase
transactions to be conflicting, thus it should not be possible for
GetDepthInMainChain to return a negative result. If it did, this would
also result in innacurate results for GetBlocksToMaturity due to the
math therein. asserting ensures accuracy.
2018-07-13 12:41:45 -04:00
Ben Woosley 89e70f9d7f
Fix that CWallet::AbandonTransaction would only traverse one level
Prior to this change, it would mark only the first layer of
child transactions abandoned, due to always following the input hashTx
rather than the current now tx.
2018-07-13 11:16:08 -04:00
Ben Woosley 5617840392
Drop dead code from Stacks
Stacks is local to this file, and only used in DataFromTransaction, so
it's easy to confirm this code is unused.
2018-07-12 18:44:33 -04:00
Jonas Schnelli 4704e5f074
[QA] add createwallet disableprivatekey test 2018-07-12 20:32:07 +01:00
Jonas Schnelli c7b8f343e9
[Qt] Disable creating receive addresses when private keys are disabled 2018-07-12 20:32:07 +01:00
Jonas Schnelli 2f15c2bc20
Add disable privatekeys option to createwallet 2018-07-12 20:32:07 +01:00
Jonas Schnelli cebefba085
Add option to disable private keys during internal wallet creation 2018-07-12 20:31:57 +01:00
Jonas Schnelli 9048575511
Add FindScriptPubKey() to search the UTXO set 2018-07-12 20:10:05 +01:00
Wladimir J. van der Laan dcb154e5aa
Merge #13177: GCC-7 and glibc-2.27 back compat code
253f592909 Add stdin, stdout, stderr to ignored export list (Chun Kuan Lee)
fc6a9f2ab1 Use IN6ADDR_ANY_INIT instead of in6addr_any (Cory Fields)
908c1d7745 GCC-7 and glibc-2.27 compat code (Chun Kuan Lee)

Pull request description:

  The `__divmoddi4` code was modified from https://github.com/gcc-mirror/gcc/blob/master/libgcc/libgcc2.c . I manually find the older glibc version of log2f by objdump, use `.symver` to specify the certain version.

Tree-SHA512: e8d875652003618c73e019ccc420e7a25d46f4eaff1c7a1a6bfc1770b3b46f074b368b2cb14df541b5ab124cca41dede4e28fe863a670589b834ef6b8713f9c4
2018-07-12 17:46:29 +02:00
Wladimir J. van der Laan 9b638c7ce1
Merge #13627: Free keystore.h from file scope level type aliases
d0b9405f96 Refactors `keystore.h` type aliases. (251)

Pull request description:

  This pull request frees `keystore.h` from type alias declarations that have been declared at file scope level.

  `keystore.h` has various type aliases that have been declared ~3 - 6 years ago at file scope level, which can either be encapsulated or removed.

  Where type alias declarations are encapsulated at the appropriate scope and access level, C++11's `using` notation is used in favor of the `typedef` notation.

Tree-SHA512: 1395cdc63e0c7ff5a1b1721675ad4416f71f507e999bd4ba019f03457cbfc08877848f10a8db7f5ccd2cd5ca3f5a291c986616f7703172fb6d79fba7447ffba8
2018-07-12 14:37:28 +02:00
MarcoFalke d3dae3ddf9
Merge #13145: Use common getPath method to create temp directory in tests.
075429a482 Use common SetDataDir method to create temp directory in tests. (winder)

Pull request description:

  Took a stab at #12574

  Created a `getPath` method which can be used with the `TestingSetup` fixture to create a temp directory. Updated tests using temp directories to use this method.

  I tried setting up a `BOOST_GLOBAL_FIXTURE` to create a truly global path for all tests but was getting linker errors when including `boost/test/unit_test.hpp` in `test_bitcoin.cpp`. Even if I had gotten the linking to work, it looks like `make check` invokes the test binary a bunch of times, so it may not have worked anyway.

Tree-SHA512: b51d0f5fada5d652ccc9362596cf98a742aa47f5daf94f189b5f034d8c035c85d095377befdcff7fb4247154d5160e8c500d70f554a2158e2c185a9d24f694f1
2018-07-12 07:47:53 -04:00
Jonas Schnelli 9995a602a6
Add facility to store wallet flags (64 bits) 2018-07-12 10:30:21 +01:00
winder 075429a482 Use common SetDataDir method to create temp directory in tests. 2018-07-11 23:44:12 -04:00
251 d0b9405f96 Refactors keystore.h type aliases.
This squashed commit either encapsulates type alias declarations at the appropriate scope; or removes type aliases that are not used.

The encapsulated type aliases are declared using C++11's `using` notation in favor of the `typedef` notation.
2018-07-12 00:48:49 +02:00
MarcoFalke 5ba77df15d
Merge #13114: wallet/keystore: Add Clang thread safety annotations for variables guarded by cs_KeyStore
968b76f77c Add missing cs_KeyStore lock (practicalswift)
4bcd5bb87d Add locking annotations for variables guarded by cs_KeyStore (practicalswift)

Pull request description:

  * Add Clang thread safety annotations for variables guarded by `cs_KeyStore`
  * Add missing `cs_KeyStore` lock

Tree-SHA512: 7d93513c2da0cd564b9f1e75aa5156a454a4133eb845020fde8872e685dd5758353e93c33364aeea4a812c08353a810494e503a5ce160cc5be0af5af4bb2e6d7
2018-07-11 15:09:24 -04:00
Wladimir J. van der Laan e538a952d5
Merge #13622: Remove mapRequest tracking that just effects Qt display.
beef7ec4be Remove useless mapRequest tracking that just effects Qt display. (Matt Corallo)

Pull request description:

  I thought we had removed this a long time ago, TBH, its really
  confusing feedback to users that we display whether a tx was
  broadcast to immediate neighbor nodes, given that has little
  indication of whether the tx propagated very far.

Tree-SHA512: c9d0808fb60146919bb78d0860ec2193601966c944887eaae7837408422f7e85dfdb306407a613200cdd4726aec66da18df618ebc6a8cfe8650bf08d4a8dc155
2018-07-11 16:36:15 +02:00
MarcoFalke fa4bf92be9
Remove dead service bits code 2018-07-11 10:32:25 -04:00
Wladimir J. van der Laan acc68bc631
Merge #13586: refactor: add benchmarks to bech32::Encode/Decode
189cf35f3e Add simple bech32 benchmarks (Karl-Johan Alm)

Pull request description:

  This PR adds benchmarks to `Encode()`/`Decode()`.

  The benchmark commit is duplicated in #13632.

Tree-SHA512: 102a193e4af58c9cb23c66d3dc7e174aa6328edab0ed74f92deb7804db5c3d0601807b3e25a5472b5c72d6113cde0dbc9976315644671a8f14ecf349967dbaaa
2018-07-11 11:44:10 +02:00
Ben Woosley d6f39b6c64
Drop unused pindexRet arg to CMerkleTx::GetDepthInMainChain 2018-07-11 00:22:10 -04:00
practicalswift bd9d0690dc Remove unused argument to WitnessSigOps(...) 2018-07-10 18:12:57 +02:00
practicalswift d1d7cfebd2 Remove unused argument to DefaultOptions(...) 2018-07-10 18:12:57 +02:00
practicalswift 05dbb0c042 Remove unused argument to ThreadHTTP(...) 2018-07-10 18:12:57 +02:00
Wladimir J. van der Laan fad42e8c4a
Merge #13547: Make signrawtransaction* give an error when amount is needed but missing
685d1d8115 [tests] Check signrawtransaction* errors on missing prevtx info (Anthony Towns)
a3b065b51f Error on missing amount in signrawtransaction* (Anthony Towns)

Pull request description:

  Signatures using segregated witness commit to the amount being spent, so that value must be passed into signrawtransactionwithkey and signrawtransactionwithwallet. This ensures an error is issued if that doesn't happen, rather than just assuming the value is 0 and producing a signature that is almost certainly invalid.

  Based on Ben Woosley's #12458, Fixes: #12429.

Tree-SHA512: 8e2ff89d5bcf79548e569210af0d850028bc98d86c149b92207c9300ab1d63664a7e2b222c1be403a15941aa5cf36ccc3c0d570ee1c1466f3496b4fe06c17e11
2018-07-10 17:04:11 +02:00
MarcoFalke b05ded1764
Merge #13565: test: Fix AreInputsStandard test to reference the proper scriptPubKey
f95989b3ed Fix AreInputsStandard test to reference the proper scriptPubKey (Ben Woosley)

Pull request description:

  This value doesn't affect the outcome of the test, because the values are
  properly set on line 351 (https://github.com/bitcoin/bitcoin/pull/13565/files#diff-b7061098b41bd31ef5db043705441133R351), but this makes the test values internally coherent.

Tree-SHA512: 5a5fda843475abd91f6c366315536d3573e70420d7c6abeebd74a54939d4de774c33faad4560d1fd4b2c35006224d9e7b3a8c925fe9926013586fd1f7aa886cc
2018-07-10 10:23:11 -04:00
Wladimir J. van der Laan c05c93c5d8
Merge #13118: RPCAuth Detection in Logs
dae0d13bbb RPCAuth Detection in Logs (Linrono)

Pull request description:

  This adds a log entry for when RPCAuth is detected.
  This keeps everything working as it currently is. I suppose it could be added as a nested if to also stop the creation of the cookie file if this would be wanted.

Tree-SHA512: 61a893b2e06ae5e7db2ddedc63819d34047fad0df764184b1b2b3f49016581e6bbf2c94a59374ca2c300190cd4e827f01da286aad5a4cc8fe5140e258b1cf8c4
2018-07-10 16:19:30 +02:00
Jesse Cohen 3339ba28e9 Make g_enable_bip61 a member variable of PeerLogicValidation 2018-07-09 21:09:58 -04:00
Matt Corallo beef7ec4be Remove useless mapRequest tracking that just effects Qt display.
I thought we had removed this a long time ago, TBH, its really
confusing feedback to users that we display whether a tx was
broadcast to immediate neighbor nodes, given that has little
indication of whether the tx propagated very far.
2018-07-09 20:06:39 -04:00
Wladimir J. van der Laan b641f60425
Merge #13481: doc: Rewrite some validation docs as lock annotations
fa324a8b15 doc: Rewrite some validation doc as lock annotations (MarcoFalke)

Pull request description:

  #13402 added some lock annotations in comments. This pull removes them and adds clang-readable locking annotations instead.

Tree-SHA512: 2d392efa8ac4978830a9df08b2009e69d6f1ac031f62be2275ae8d7c7e483331c7f8d458d865443af907a7af27a592421c6cca6b2df3f2877e0f369b9198f383
2018-07-09 21:53:48 +02:00
Wladimir J. van der Laan 3a3eabef40
Merge #13386: SHA256 implementations based on Intel SHA Extensions
66b2cf1ccf Use immintrin.h everywhere for intrinsics (Pieter Wuille)
4c935e2eee Add SHA256 implementation using using Intel SHA intrinsics (Pieter Wuille)
268400d318 [Refactor] CPU feature detection logic for SHA256 (Pieter Wuille)

Pull request description:

  Based on #13191.

  This adds SHA256 implementations that use Intel's SHA Extension instructions (using intrinsics). This needs GCC 4.9 or Clang 3.4.

  In addition to #13191, two extra implementations are provided:
  * (a) A variable-length SHA256 implementation using SHA extensions.
  * (b) A 2-way 64-byte input double-SHA256 implementation using SHA extensions.

  Benchmarks for 9001-element Merkle tree root computation on an AMD Ryzen 1800X system:
  * Using generic C++ code (pre-#10821): 6.1ms
  * Using SSE4 (master, #10821): 4.6ms
  * Using 4-way SSE4 specialized for 64-byte inputs (#13191): 2.8ms
  * Using 8-way AVX2 specialized for 64-byte inputs (#13191): 2.1ms
  * Using 2-way SHA-NI specialized for 64-byte inputs (this PR): 0.56ms

  Benchmarks for 32-byte SHA256 on the same system:
  * Using SSE4 (master, #10821): 190ns
  * Using SHA-NI (this PR): 53ns

  Benchmarks for 1000000-byte SHA256 on the same system:
  * Using SSE4 (master, #10821): 2.5ms
  * Using SHA-NI (this PR): 0.51ms

Tree-SHA512: 2b319e33b22579f815d91f9daf7994a5e1e799c4f73c13e15070dd54ba71f3f6438ccf77ae9cbd1ce76f972d9cbeb5f0edfea3d86f101bbc1055db70e42743b7
2018-07-09 21:17:18 +02:00
Wladimir J. van der Laan 7e74c54fed
Merge #13452: rpc: have verifytxoutproof check the number of txns in proof structure
d280617bf5 [qa] Add a test for merkle proof malleation (Suhas Daftuar)
ed82f17000 have verifytxoutproof check the number of txns in proof structure (Gregory Sanders)

Pull request description:

  Recent publication of a weakness in Bitcoin's merkle tree construction demonstrates many SPV applications vulnerable to an expensive to pull off yet still plausible attack: https://bitslog.wordpress.com/2018/06/09/leaf-node-weakness-in-bitcoin-merkle-tree-design/

  This change would at least allow `verifytxoutproof` to properly validate that the proof matches a known block, with known number of transactions any time after the full block is processed. This should neuter the attack entirely.

  The negative is that a header-only processed block/future syncing mode would cause this to fail until the node has imported the data required.

  related: #13451

  `importprunedfunds` needs this check as well. Can expand it to cover this if people like the idea.

Tree-SHA512: 0682ec2b622a38b29f3f635323e0a8b6fc071e8a6fd134c954579926ee7b516e642966bafa667016744ce49c16e19b24dbc8801f982a36ad0a6a4aff6d93f82b
2018-07-09 20:25:50 +02:00
Wladimir J. van der Laan 453ae5ec9f
Merge #13603: bitcoin-tx: Stricter check for valid integers
57889e688d bitcoin-tx: Stricter check for valid integers (Daniel Kraft)

Pull request description:

  Just calling `atoi` to convert strings to integers does not check for valid integers very thoroughly; in particular, it just ignores everything starting from the first non-numeral character.  Even a string like "foo" is fine and silently returns 0.

  This meant that `bitcoin-tx` would not fail if such a string was passed in various places where an integer is expected (like the `locktime` or an input/output index); this means that it would, for instance, silently accept a typo and interpret it in an unexpected way.

  In this change, we use `ParseInt64` for parsing strings to integers, which actually verifies that the full string is valid as number.  New tests in the `bitcoin-util-test` cover the new error paths.

  This fixes #13599.

Tree-SHA512: 146a0af275e9f57784e5d0582d3defbac35551b54b6b7232f8a0b20db04aa611125e52aa4512ef2f8ed2cafc2a12fe586f9d10ed66d641cff090288f279b1988
2018-07-09 20:08:15 +02:00
Wladimir J. van der Laan a247594e75
Merge #13570: RPC: Add new "getzmqnotifications" method
161e8d40a4 RPC: Add new getzmqnotifications method. (Daniel Kraft)
caac39b0ac Make ZMQ notification interface instance global. (Daniel Kraft)

Pull request description:

  This adds a new RPC method `getzmqnotifications`, which returns information about all active ZMQ notification endpoints.  This is useful for software that layers on top of bitcoind, so it can verify that ZeroMQ is enabled and also figure out where it should listen.

  See #13526.

Tree-SHA512: edce722925741c84ddbf7b3a879fc9db1907e5269d0d97138fe724035d93ee541c2118c24fa92f4197403f380d0e25c2fda5ca6c62d526792ea749cf527a99a0
2018-07-09 17:21:03 +02:00
Wladimir J. van der Laan 17e9106c86
Merge #13614: doc: Update command line help for -printtoconsole and -debuglogfile (satwo)
5e362c0cf0 Fix command line help for -printtoconsole and -debuglogfile (Samuel B. Atwood)

Pull request description:

  This is a rebased version of #13589 with the changes to the 0.16.x release notes removed.

  > #13004 changed the default behavior for printtoconsole but this has not been reflected in the command line help.

  > This fixes the description of -printtoconsole to reflect this change, and also provides the user with missing information on how to explicitly disable logging to debug.log.

  > At present I have made the latter update to two separate places (-printtoconsole and -debuglogfile) because a user looking for information on how to disable logging is probably going to look in the "Debugging/Testing Options" section. Moving -debuglogfile from the "General" options category to the "Debugging/Testing" section could potentially remove the need for this redundancy but may be out of the scope of this PR.

Tree-SHA512: 7461d59a1864039d5a9dfcce765a1169df882f51a4ca50a6066416c0803821cd821be07be534e0bd57f0a22c0b45adb881a93abbe91962bc37d2d228f35ee712
2018-07-09 17:03:12 +02:00