Commit Graph

10029 Commits

Author SHA1 Message Date
Andrew Chow 07164bbead
Pass serialization flags and whether to include hex to TxToUniv
Github-Pull: #11027
Rebased-From: 6bbdafcdc4
Tree-SHA512: 8ed049a0945c4f56c518aef6d60efebda5cde09ef63d8e472b363821170d71fb4d16414b360824d7537fc7c7b5e5277bbbd092a20899446e97c188ab8df58c1b
2017-08-21 09:49:16 +02:00
Andrew Chow eb9c21ed79
Only return hex field once in getrawtransaction
The hex is already returned in TxToUniv, no need to give it out a
second independent time in getrawtransaction itself.

Github-Pull: #11027
Rebased-From: e029c6e709
Tree-SHA512: 4f7892431ddb9b59bcc59756890b97a20d046d1d4898f8a80c564223e1cde1c922da403cea4b8ae79d70741d1a9ff337f077043e5bb538cdc4d34fbe09301240
2017-08-21 09:49:14 +02:00
John Newbery 6ab120cc6c
[wallet] Add logging to MarkReserveKeysAsUsed
Github-Pull: #11044
Rebased-From: 67ceff4039
Tree-SHA512: 850c5b1010c84e164edf24a83ae36e46309b2eb7a67854bad509265ed590ba67d5f743a8416590da6ecca85fe4bda7f20e8c3152e422638eb7898db11a416af7
2017-08-21 09:49:12 +02:00
John Newbery 4ef8374559
[wallet] Remove keypool_topup_cleanups
Unused function. Mostly reverts c25d90f125

c25d90f... was merged as part of PR 11022 but is not required.

Github-Pull: #11044
Rebased-From: 1221f60c94
Tree-SHA512: da229b128bee5f124c009a1a2adfb4fa879366c81789824c426c9ce5209c835888a7e6cfeb1724551320a98cd08406a605372f84487a0d289cd6e02f9ac3ea21
2017-08-21 09:49:10 +02:00
Jonas Schnelli 9fe1f6bd89
Add length check for CExtKey deserialization
Github-Pull: #11081
Rebased-From: 07685d1bc1
Tree-SHA512: 7f6b9ca6714d059d500531eb842c1c25edfa04ecba0ea1d9a28010fced657c066cea67d2016bbaa9b96c431a05ca9c0dcf2ba301898ecf96a65a4e01aac7fae9
2017-08-21 09:49:05 +02:00
Jonas Nick 6c2b0085fb
Fix combinerawtransaction RPC help result section
Github-Pull: #11083
Rebased-From: f9ca0fe44e
Tree-SHA512: ef94958d7de11e091db456e253fa4a188b0b0e713149bd568aa2de11a8a3c1585b34bbfb78aaac12f969533f05602ed8b1cd16275429d86a80c36bb594ce6526
2017-08-21 09:49:04 +02:00
Marko Bencun fcbde9091e remove unused gArgs wrappers 2017-08-14 17:02:36 +02:00
Marko Bencun bb81e17355 scripted-diff: stop using the gArgs wrappers
They were temporary additions to ease the transition.

-BEGIN VERIFY SCRIPT-
find src/ -name "*.cpp" ! -wholename "src/util.h" ! -wholename "src/util.cpp" | xargs perl -i -pe 's/(?<!\.)(ParseParameters|ReadConfigFile|IsArgSet|(Soft|Force)?(Get|Set)(|Bool|)Arg(s)?)\(/gArgs.\1(/g'
-END VERIFY SCRIPT-
2017-08-14 17:02:10 +02:00
Wladimir J. van der Laan ce74799a3c
Merge #10483: scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL
90d4d89 scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL (practicalswift)

Pull request description:

  Since C++11 the macro `NULL` may be:
  * an integer literal with value zero, or
  * a prvalue of type `std::nullptr_t`

  By using the C++11 keyword `nullptr` we are guaranteed a prvalue of type `std::nullptr_t`.

  For a more thorough discussion, see "A name for the null pointer: nullptr" (Sutter &
  Stroustrup), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf

  With this patch applied there are no `NULL` macro usages left in the repo:

  ```
  $ git grep NULL -- "*.cpp" "*.h" | egrep -v '(/univalue/|/secp256k1/|/leveldb/|_NULL|NULLDUMMY|torcontrol.*NULL|NULL cert)' | wc -l
  0
  ```

  The road towards `nullptr` (C++11) is split into two PRs:
  * `NULL` → `nullptr` is handled in PR #10483 (scripted, this PR)
  * `0` → `nullptr` is handled in PR #10645 (manual)

Tree-SHA512: 3c395d66f2ad724a8e6fed74b93634de8bfc0c0eafac94e64e5194c939499fefd6e68f047de3083ad0b4eff37df9a8a3a76349aa17d55eabbd8e0412f140a297
2017-08-14 16:30:59 +02:00
Wladimir J. van der Laan 0e5cff6f2b
Merge #11012: Make sure to clean up mapBlockSource if we've already seen the block
3f8fa7f Make sure to clean up mapBlockSource if we've already seen the block (Cory Fields)

Pull request description:

  Otherwise we may leave them dangling.

  Credit TheBlueMatt.

Tree-SHA512: 8be77e08ebfc4f5b206d5ee7cfbe87f92c1eb5bc2b412471993658fe210306789aaf0f3d1454c635508a7d8effede2cf5ac144d622b0157b872733d9661d65c3
2017-08-14 16:19:35 +02:00
Wladimir J. van der Laan 6bdf4b3c7c
Merge #11028: Avoid masking of difficulty adjustment errors by checkpoints
85c82b5 Avoid masking of difficulty adjustment errors by checkpoints (Pieter Wuille)

Pull request description:

  Currently difficulty adjustment violations are not reported for chains that branch off before the last checkpoint. Change this by moving the checkpoint check after the difficulty check.

Tree-SHA512: 33666f2c3459151b28c42041a463779e6df18f61d3dd5b1879a0af4e5b199ef74d1e33e06af68bebfdfb211569ad5fb56556bfebe9d63b5688d910ea211b839a
2017-08-14 16:12:55 +02:00
Wladimir J. van der Laan 653a46dd91
Merge #11022: Basic keypool topup
d34957e [wallet] [tests] Add keypool topup functional test (Jonas Schnelli)
095142d [wallet] keypool mark-used and topup (John Newbery)
c25d90f [wallet] Add HasUnusedKeys() helper (John Newbery)
f2123e3 [wallet] Cache keyid -> keypool id mappings (John Newbery)
83f1ec3 [wallet] Don't hold cs_LastBlockFile while calling setBestChain (John Newbery)
2376bfc [wallet] [moveonly] Move LoadKeyPool to cpp (Matt Corallo)
cab8557 [wallet] [moveonly] Move CAffectedKeysVisitor (Jonas Schnelli)

Pull request description:

  This PR contains the first part of #10882 :

  - if a key from the keypool is used, mark all keys up to that key as used, and then try to top up the keypool
  - top up the keypool on startup

  Notably, it does not stop the node or prevent the best block from advancing if the keypool drops below a threshold (which means that transactions may be missed and funds lost if restoring from an old HD wallet backup).

Tree-SHA512: ac681fefeaf7ec2aab2fa1da93d12273ea80bd05eb48d7b3b551ea6e5d975dd97ba7de52b7fba52993823280ac4079cc36cf78a27dac708107ebf8fb6326142b
2017-08-14 16:08:44 +02:00
MarcoFalke 2c811e08db
Merge #10765: Tests: address placement should be deterministic by default
c5ebddd11 Tests: address placement should be deterministic by default (René Nyffenegger)

Pull request description:

  Better version of wrong and closed pull request https://github.com/bitcoin/bitcoin/pull/10764

Tree-SHA512: dfda6ea4a9dd0f4c8b96212ad43a716ff1dddf115cd2712a2a7e42c97fc9494079c746906b39d880a9827c05d2b75c728afd4ca4519ce4d365f0dae0c4aec24c
2017-08-11 17:45:47 +02:00
Felix Weis 86279464b4 [RPC] trivial: gettxout no longer shows version of tx
Since the switch to a per-txout chainstate db in #10195, the tx version information is no longer stored. Updated `gettxout` rpc help text accordingly.
2017-08-11 12:16:55 +08:00
Pieter Wuille 85c82b50d1 Avoid masking of difficulty adjustment errors by checkpoints
Currently difficulty adjustment violations are not reported for
chains that branch off before the last checkpoint. Change this
by moving the checkpoint check after the difficulty check.
2017-08-10 15:39:36 -07:00
John Newbery 095142d1f9 [wallet] keypool mark-used and topup
This commit adds basic keypool mark-used and topup:

- try to topup the keypool on initial load
- if a key in the keypool is used, mark all keys before that as used and
try to top up
2017-08-10 13:44:02 -04:00
MarcoFalke e526ca6284
Merge #10835: Rename member field according to the style guide
4d4fb33fc Rename member field according to the style guide. (Pavel Janík)

Pull request description:

  After #10193, approx. five instances of this warning are printed when compiling with `-Wshadow`:

  ```
  In file included from txmempool.cpp:14:
  ./reverse_iterator.h:20:22: warning: declaration shadows a field of 'reverse_range<T>' [-Wshadow]
      reverse_range(T &x) : x(x) {}
                       ^
  ./reverse_iterator.h:17:8: note: previous declaration is here
      T &x;
         ^
  1 warning generated.
  ```

Tree-SHA512: 6c07c2ed6f4f232a3a8bdcdd6057040967c74552fd29d80f42e8a453b95baf203c410aa31dccc08ff2e765cbba02b1a282f6ea7804955f09b31ab20ef383792e
2017-08-09 12:42:10 +02:00
Wladimir J. van der Laan 67f6f1c2d5
qt: Periodic translations update
Tree-SHA512: f967af98ba40908f3ba1286659a7ffedd1319d8d7d5c8d658f266897cb61ea28bace3f20f8ec77b83a69ac311c7e65467e40c3ee8b320a88768afa15e8c802cc
2017-08-09 12:04:41 +02:00
MarcoFalke ecd21357f1
Merge #10963: [bench] Restore format state of cout after printing with std::fixed/setprecision
fd05132e5 Restore default format state of cout after printing with std::fixed/setprecision (practicalswift)

Pull request description:

  Restore default format state of `std::cout` after printing with `std::fixed`/`std::setprecision`.

Tree-SHA512: 445b5b42aff58e2350939e8febc9b4a6fff478616abfe831aec42bee906cefac7a153c93d506407fb213d04dae9c7afbb5bfd344be63ca0f40ae39b331a4144f
2017-08-09 11:52:19 +02:00
Cory Fields 3f8fa7f58b Make sure to clean up mapBlockSource if we've already seen the block
Credit TheBlueMatt
2017-08-08 21:45:18 -04:00
Wladimir J. van der Laan 2507fd5556
Merge #10998: Fix upgrade cancel warnings
861f9a2 Skip remainder of init if upgrade is cancelled (Matt Corallo)

Pull request description:

  Based on #10919.
  Without this, if you cancel upgrade, you get a needless error:
  ERROR: VerifyDB(): *** irrecoverable inconsistency in block data at

Tree-SHA512: aa47665682c6605ada376f1c100ce17cf8c4312427929eb2e75306f2199b47cbcdb4e0d98d5efcfefff03947b2c0fcbd3aab487a4ed14d50607df685c91a03d0
2017-08-08 11:58:31 +02:00
Wladimir J. van der Laan 4268426b45
Merge #11002: [wallet] return correct error code from resendwallettransaction
055d95f [wallet] return correct error code from resendwallettransaction (John Newbery)

Pull request description:

  New code in #10995 uses `RPC_INVALID_REQUEST`. According to the comment in rpc/protocol.h:
  ```
  // RPC_INVALID_REQUEST is internally mapped to HTTP_BAD_REQUEST (400).
  // It should not be used for application-layer errors.
  ```
  Change the returned error code to `RPC_WALLET_ERROR`

  #11000 will need to be updated to test for the correct error code.

Tree-SHA512: 0201b3a2091adf17ad301825da5bd29f0ea7e284b5394cbef80483fc293a558acc849f74a0780bb8501acab324fc722e41ae049cffec7afb76884e26df4b809e
2017-08-08 11:41:29 +02:00
Wladimir J. van der Laan 627c3c0e49
Merge #10999: Fix amounts formatting in `decoderawtransaction`
ce07638 doc: Add comment to use ValueFromAmount/AmountFromValue for JSON, not utilmoneystr (Wladimir J. van der Laan)
ec05c50 rpc: Use ValueFromAmount instead of FormatMoney in TxToUniv (Wladimir J. van der Laan)
46347ad rpc: Move ValueFromAmount to core_write (Wladimir J. van der Laan)
dac3782 doc: Correct AmountFromValue/ValueFromAmount names (Wladimir J. van der Laan)

Pull request description:

  With this, the amounts returned in `decoderawtransaction` will be padded to 8 digits like anywhere else in the API.

  This is accomplished by using `ValueFromAmount` in `TxToUniv`, instead of `FormatMoney` which it currently (mistakingly) uses. The `FormatMoney` function is only for debugging/logging use!

  To avoid dependency issues, `ValueFromAmount` is moved to `core_write.cpp`, where it also fits better. I don't move `AmountFromValue` to `core_read.cpp` at the same time, as this would have more impact due to the RPCError dependency there.

  (n.b.: large number of changed files is solely due to the util_tests JSONs needing update)

Tree-SHA512: 10fc2d27d33a77dbcb57aa7eccd4f53110c05d38eb7df6d40f10f14c08fad4274472e93af75aa59fe68ad0720fdf0930f0108124abef518e0dd162b3d2b2b292
2017-08-08 11:27:29 +02:00
John Newbery 055d95f842 [wallet] return correct error code from resendwallettransaction 2017-08-07 15:50:01 -04:00
Matt Corallo 861f9a28bc Skip remainder of init if upgrade is cancelled 2017-08-07 08:31:41 -07:00
Wladimir J. van der Laan 318392ca7c
Merge #10301: Check if sys/random.h is required for getentropy.
ee2d10a Check if sys/random.h is required for getentropy on OSX. (James Hilliard)

Pull request description:

  This should check and include sys/random.h if required for osx as mentioned [here](https://github.com/bitcoin/bitcoin/pull/9821#issuecomment-290936636).

Tree-SHA512: e9491f67f2e8b2e6bcdbcbb8063295e844d5627daf5336e3e17b4a8027d888fa65a08e4580a745abdc35ffd8d86b4fc7434daaac172c4a06ab7566a2ed0bfb92
2017-08-07 17:24:55 +02:00
Wladimir J. van der Laan ce076383a8 doc: Add comment to use ValueFromAmount/AmountFromValue for JSON, not utilmoneystr 2017-08-07 17:10:42 +02:00
Wladimir J. van der Laan ec05c508c6 rpc: Use ValueFromAmount instead of FormatMoney in TxToUniv
With this, the amounts returned in `decoderawtransaction` will be
padded to 8 digits like anywhwere else in the API.
2017-08-07 17:01:21 +02:00
Wladimir J. van der Laan 46347add43 rpc: Move ValueFromAmount to core_write
This is necessary because core_write has to write amounts in
TxToUniv, and mistakingly uses FormatMoney for that
(which is only for debugging).

We don't move AmountFromValue at the same time, as
this is more challenging due to the RPCError depencency
there.
2017-08-07 17:01:21 +02:00
Wladimir J. van der Laan fa64636948
Merge #10995: Fix resendwallettransactions assert failure if -walletbroadcast=0
01699fb Fix resendwallettransactions assert failure if -walletbroadcast=0 (Matt Corallo)

Pull request description:

  This fixes #10981 in my preferred way.

Tree-SHA512: 2e43d3ac78d13c5d59db23a82c76c722cc3344767a8237617080e489296d27a98bb1b3bd469b2c9b289b57a9da3709c90448d7a23bcc2e1dfb791c4fd16be015
2017-08-07 09:06:06 +02:00
Wladimir J. van der Laan c1c671feb1
Merge #10919: Fix more init bugs.
e7539f8 Fix some broken init-time prints/constants (Matt Corallo)
13ab353 Check for empty coinsview instead of just-reset coinsview in init (Matt Corallo)
fce3f4f Fix resume-of-reindex-after-restart (Matt Corallo)
efac91e Always wait for threadGroup to exit in bitcoind shutdown (Matt Corallo)

Pull request description:

  This is a follow-on to #10758 to help move 10758 along. The first fixes a regression in master that was partially fixed in 10758, the second I'm not sure if its a regression or not, but its clearly a bug that should be fixed.

Tree-SHA512: aca7b97a97dca66e1a218a33cc6f4aa002292ff1bb0af64e35b81fbaa91b9504f2605375808b43e93a63fc73634ad079b30ef6c9f4ba338d3b5f72d816dfeaff
2017-08-07 09:04:19 +02:00
Wladimir J. van der Laan c8b62c7de3
Merge #10982: Disconnect network service bits 6 and 8 until Aug 1, 2018
1de73f4 Disconnect network service bits 6 and 8 until Aug 1, 2018 (Matt Corallo)

Pull request description:

  Immediately disconnect peers that use service bits 6 and 8 until August 1st, 2018
  These bits have been used as a flag to indicate that a node is running incompatible
  consensus rules instead of changing the network magic, so we're stuck disconnecting
  based on the service bits, at least for a while.

  Staying connected to nodes on other networks only prevents both sides from reaching consensus quickly, wastes network resources on both sides, etc.

  Didn't add constants to protocol.h as the code there notes that "service bits should be allocated via the BIP process".

Tree-SHA512: 2d887774fcf20357019ffc2a8398464c76c1cff2c4e448c92bd5f391d630312301977fea841e0534df6641c7c5547605a5aad82859c59c4bd68be865e6d5a4c6
2017-08-07 08:49:56 +02:00
practicalswift 90d4d89230 scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL
-BEGIN VERIFY SCRIPT-
sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h
sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp
sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp
sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp
sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp
sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp
-END VERIFY SCRIPT-
2017-08-07 07:36:37 +02:00
Matt Corallo 01699fb283 Fix resendwallettransactions assert failure if -walletbroadcast=0 2017-08-06 21:40:56 -04:00
Matt Corallo 1de73f4e19 Disconnect network service bits 6 and 8 until Aug 1, 2018
These have been used to indicate incompatible consensus rules
instead of changing network magic, so we're stuck disconnecting them.
2017-08-06 11:48:19 -04:00
Wladimir J. van der Laan a9dd111441
Merge #10988: qt: Increase BLOCK_CHAIN_SIZE constants
1967d2a qt: Increase BLOCK_CHAIN_SIZE constants (Wladimir J. van der Laan)

Pull request description:

  - Increase `BLOCK_CHAIN_SIZE` from 120GB to 150GB
  - Increase `CHAIN_STATE_SIZE` from 2GB to 4GB

  I took the local sizes of the blocks and chainstate directory, and added a bit extra to accomodate the near future (15GB for the chain and 1GB for the chainstate).

Tree-SHA512: 76ec7770bd3a30380b0224a0f307cdad14c8227ef726dd55738cebe9d894430865aff11e05a793fd3e60d8fe019dbb392f574c1fb63ec746618b4460ed64bd0c
2017-08-05 13:36:44 +02:00
Wladimir J. van der Laan 02f4c4a42e
Merge #10977: [net] Fix use of uninitialized value in getnetworkinfo(const JSONRPCRequest&)
11dd29b [net] Fix use of uninitialized value in getnetworkinfo(const JSONRPCRequest& request) (practicalswift)

Pull request description:

  When running `test_bitcoin` under Valgrind I found the following issue:

  ```
  $ valgrind src/test/test_bitcoin
  ...
  ==10465== Use of uninitialised value of size 8
  ==10465==    at 0x6D09B61: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
  ==10465==    by 0x6D0B1BB: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<unsigned long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, unsigned long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
  ==10465==    by 0x6D0B36C: std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, unsigned long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
  ==10465==    by 0x6D17699: std::ostream& std::ostream::_M_insert<unsigned long>(unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
  ==10465==    by 0x4CAAD7: operator<< (ostream:171)
  ==10465==    by 0x4CAAD7: formatValue<ServiceFlags> (tinyformat.h:345)
  ==10465==    by 0x4CAAD7: void tinyformat::detail::FormatArg::formatImpl<ServiceFlags>(std::ostream&, char const*, char const*, int, void const*) (tinyformat.h:523)
  ==10465==    by 0x1924D4: format (tinyformat.h:510)
  ==10465==    by 0x1924D4: tinyformat::detail::formatImpl(std::ostream&, char const*, tinyformat::detail::FormatArg const*, int) (tinyformat.h:803)
  ==10465==    by 0x553A55: vformat (tinyformat.h:947)
  ==10465==    by 0x553A55: format<ServiceFlags> (tinyformat.h:957)
  ==10465==    by 0x553A55: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > tinyformat::format<ServiceFlags>(char const*, ServiceFlags const&) (tinyformat.h:966)
  ==10465==    by 0x54C952: getnetworkinfo(JSONRPCRequest const&) (net.cpp:462)
  ==10465==    by 0x28EDB5: CallRPC(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (rpc_tests.cpp:31)
  ==10465==    by 0x293947: rpc_tests::rpc_togglenetwork::test_method() (rpc_tests.cpp:88)
  ==10465==    by 0x2950E5: rpc_tests::rpc_togglenetwork_invoker() (rpc_tests.cpp:84)
  ==10465==    by 0x182496: invoke<void (*)()> (callback.hpp:56)
  ==10465==    by 0x182496: boost::unit_test::ut_detail::callback0_impl_t<boost::unit_test::ut_detail::unused, void (*)()>::invoke() (callback.hpp:89)
  ...
  ```

  The read of the uninitialized variable `nLocalServices` is triggered by `g_connman->GetLocalServices()` in `getnetworkinfo(const JSONRPCRequest& request)` (`net.cpp:462`):

  ```c++
  UniValue getnetworkinfo(const JSONRPCRequest& request)
  {
  ...
      if(g_connman)
          obj.push_back(Pair("localservices", strprintf("%016x", g_connman->GetLocalServices())));
  ...
  }
  ```

  The reason for the uninitialized `nLocalServices` is that `CConnman::Start(...)` is not called
  by the tests, and hence the initialization normally performed by `CConnman::Start(...)` is
  not done.

  This commit adds a method `Init(const Options& connOptions)` which is called by both the
  constructor and `CConnman::Start(...)`. This method initializes `nLocalServices` and the other
  relevant values from the supplied `Options` object.

Tree-SHA512: d8742363acffd03b2ee081cc56840275569e17edc6fa4bb1dee4a5971ffe4b8ab1d2fe7b68f98a086bf133b7ec46f4e471243ca08b45bf82356e8c831a5a5f21
2017-08-05 13:23:19 +02:00
Wladimir J. van der Laan 2361208424
Merge #10986: Update chain transaction statistics
b1973d6 Update chain transaction statistics (Pieter Wuille)

Pull request description:

Tree-SHA512: f906173f4d602210f4a3e3d33eb2551158e353089a3d0b46dba93e6c6fbcb8bc785839be2917a60abe288e5728949e24bca355cbbe7600dc5a7ed30a873fff5a
2017-08-05 13:14:44 +02:00
Wladimir J. van der Laan 1967d2a4da qt: Increase BLOCK_CHAIN_SIZE constants
- Increase `BLOCK_CHAIN_SIZE` from 120GB to 150GB
- Increase `CHAIN_STATE_SIZE` from 2GB to 4GB

I took the local sizes of the blocks and chainstate directory, and added
a bit extra to accomodate the near future (15GB for the chain and 1GB
for the chainstate).
2017-08-05 08:42:43 +02:00
John Newbery c25d90f125 [wallet] Add HasUnusedKeys() helper 2017-08-04 16:42:53 -04:00
John Newbery f2123e3a7b [wallet] Cache keyid -> keypool id mappings 2017-08-04 11:08:39 -04:00
Pieter Wuille 8842d1a5d4 Add undocumented -forcecompactdb to force LevelDB compactions 2017-08-03 23:42:26 -07:00
Pieter Wuille b1973d6181 Update chain transaction statistics 2017-08-03 16:39:58 -07:00
Wladimir J. van der Laan 2e857bb619
Merge #10942: Eliminate fee overpaying edge case when subtracting fee from recipients
49d903e Eliminate fee overpaying edge case when subtracting fee from recipients (Alex Morcos)

Pull request description:

  I'm not sure if this is the cause of the issue in #10034 , but this was a known edge case.  I just didn't realize how simple the fix is.

  Could use a couple more eyes to make sure nothing silly can go wrong here, but if we all agree it's this simple, we can add this as another 0.15 bug fix.

Tree-SHA512: db1dd1e83363a3c231267b626d3a388893ee70ba1972056fe2c339c5c9e4fbfd30f7fe837c30cc7be884d454797fd4c619b9d631a8d5eeb55cdb07402a83acb3
2017-08-03 12:26:12 +02:00
John Newbery 83f1ec33ce [wallet] Don't hold cs_LastBlockFile while calling setBestChain
cs_LastBlockFile shouldn't be held while calling wallet functions.
2017-08-02 17:31:35 -04:00
Matt Corallo 2376bfcf24 [wallet] [moveonly] Move LoadKeyPool to cpp 2017-08-02 17:31:35 -04:00
Jonas Schnelli cab8557e35 [wallet] [moveonly] Move CAffectedKeysVisitor 2017-08-02 17:31:35 -04:00
practicalswift 11dd29b658 [net] Fix use of uninitialized value in getnetworkinfo(const JSONRPCRequest& request)
When running test_bitcoin under Valgrind I found the following issue:

```
$ valgrind src/test/test_bitcoin
...
==10465== Use of uninitialised value of size 8
==10465==    at 0x6D09B61: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==10465==    by 0x6D0B1BB: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<unsigned long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, unsigned long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==10465==    by 0x6D0B36C: std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, unsigned long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==10465==    by 0x6D17699: std::ostream& std::ostream::_M_insert<unsigned long>(unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==10465==    by 0x4CAAD7: operator<< (ostream:171)
==10465==    by 0x4CAAD7: formatValue<ServiceFlags> (tinyformat.h:345)
==10465==    by 0x4CAAD7: void tinyformat::detail::FormatArg::formatImpl<ServiceFlags>(std::ostream&, char const*, char const*, int, void const*) (tinyformat.h:523)
==10465==    by 0x1924D4: format (tinyformat.h:510)
==10465==    by 0x1924D4: tinyformat::detail::formatImpl(std::ostream&, char const*, tinyformat::detail::FormatArg const*, int) (tinyformat.h:803)
==10465==    by 0x553A55: vformat (tinyformat.h:947)
==10465==    by 0x553A55: format<ServiceFlags> (tinyformat.h:957)
==10465==    by 0x553A55: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > tinyformat::format<ServiceFlags>(char const*, ServiceFlags const&) (tinyformat.h:966)
==10465==    by 0x54C952: getnetworkinfo(JSONRPCRequest const&) (net.cpp:462)
==10465==    by 0x28EDB5: CallRPC(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (rpc_tests.cpp:31)
==10465==    by 0x293947: rpc_tests::rpc_togglenetwork::test_method() (rpc_tests.cpp:88)
==10465==    by 0x2950E5: rpc_tests::rpc_togglenetwork_invoker() (rpc_tests.cpp:84)
==10465==    by 0x182496: invoke<void (*)()> (callback.hpp:56)
==10465==    by 0x182496: boost::unit_test::ut_detail::callback0_impl_t<boost::unit_test::ut_detail::unused, void (*)()>::invoke() (callback.hpp:89)
...
```

The read of the uninitialized variable nLocalServices is triggered by g_connman->GetLocalServices()
in getnetworkinfo(const JSONRPCRequest& request) (net.cpp:462):

```c++
UniValue getnetworkinfo(const JSONRPCRequest& request)
{
...
    if(g_connman)
        obj.push_back(Pair("localservices", strprintf("%016x", g_connman->GetLocalServices())));
...
}
```

The reason for the uninitialized nLocalServices is that CConnman::Start(...) is not called
by the tests, and hence the initialization normally performed by CConnman::Start(...) is
not done.

This commit adds a method Init(const Options& connOptions) which is called by both the
constructor and CConnman::Start(...). This method initializes nLocalServices and the other
relevant values from the supplied Options object.
2017-08-02 23:28:15 +02:00
Wladimir J. van der Laan 659c096134
Merge #10958: Update to latest Bitcoin patches for LevelDB
b13a68e Squashed 'src/leveldb/' changes from 196962ff0..c521b3ac6 (Pieter Wuille)

Pull request description:

  Includes:
  * https://github.com/bitcoin-core/leveldb/pull/2: Prefer std::atomic over MemoryBarrier (Pieter Wuille)
  * https://github.com/bitcoin-core/leveldb/pull/5: Move helper functions out of sse4.2 object (Cory Fields)
  * https://github.com/bitcoin-core/leveldb/pull/6: Fixes typo (Dimitris Tsapakidis)
  * https://github.com/bitcoin-core/leveldb/pull/10: Clean up compile-time warnings (gcc 7.1) (Matt Corallo)
  * https://github.com/bitcoin-core/leveldb/pull/11: fixup define checks. Cleans up some oopses from #5 (Cory Fields)

Tree-SHA512: 2b88a99a86ed8c74c860de13a123ea7f5424d35d314be564820cf83aaae8308383403f7cd56f17c241cfee4885699796141fed666559c21044eaabaeea073315
2017-08-02 09:00:49 +02:00
Masahiko Hyuga 7f121a079b Fix typo in sendcoinsdialog. 2017-08-02 12:19:50 +09:00