Commit graph

10437 commits

Author SHA1 Message Date
Wladimir J. van der Laan 42307c4bf3
qt: Periodic translations update
Tree-SHA512: 08b255a0f90eac4a68dbcd7f8cb497c8f0c70a9248ba29f460b31fd4dafcdf14589cbd4518ba803233349643749a03c7fbd3829caf6dc2cdadac8737f3440819
2017-07-31 12:19:05 +02:00
Wladimir J. van der Laan af563971fc
Merge #10949: Clarify help message for -discardfee
bdd5543 Clarify help message for -discardfee (Alex Morcos)

Pull request description:

Tree-SHA512: 7c2f644d1c18e18f11fd85a7b6ca38c480e1ee3932daa4bb19a3965b88146dda899ead0f34d8da02db640598197167bcf69d511501b729e3a8b5b7b6adf08d4e
2017-07-31 12:03:17 +02:00
Wladimir J. van der Laan df3a6f4ee4
Merge #10948: p2p: Hardcoded seeds update pre-0.15 branch
f0acedd p2p: Hardcoded seeds update pre-0.15 branch (Wladimir J. van der Laan)

Pull request description:

  Just the usual
  ```bash
      curl -s http://bitcoin.sipa.be/seeds.txt.gz | gzip -dc > seeds_main.txt
      python3 makeseeds.py < seeds_main.txt > nodes_main.txt
      python3 generate-seeds.py . > ../../src/chainparamsseeds.h
  ```

Tree-SHA512: d73bbdca7de9cf9dd674abb402d6389ac961cb3daf7e3f32534524f6584cdb99b269320b8ab8f42f5d461f611948c6b80ae51ffe3a1312e8fc5e5266bd98be72
2017-07-31 11:33:55 +02:00
Wladimir J. van der Laan 2a50b11586
Merge #10945: Update defaultAssumeValid according to release-process.md.
9a8b054 Update defaultAssumeValid according to release-process.md. (Gregory Maxwell)

Pull request description:

  Updated for block 477890.

Tree-SHA512: 70bca3d81ac170506fba984a97cd44fccaae7da2e709925747fed0e3f763a799b0e89f0b9ed8869b1a55892580594be7b648d3b3635faaee6d85ef6db468dee5
2017-07-31 10:46:22 +02:00
Wladimir J. van der Laan f0aceddf88 p2p: Hardcoded seeds update pre-0.15 branch 2017-07-30 14:04:51 +02:00
Alex Morcos bdd5543ad6 Clarify help message for -discardfee 2017-07-28 09:54:59 -04:00
John Newbery d84e78ec39 [wallet] Specify wallet name in wallet loading errors 2017-07-28 11:25:38 +01:00
João Barbosa a6da027d83 Reject invalid wallet files 2017-07-28 11:23:43 +01:00
João Barbosa 3ef77a0c12 Reject duplicate wallet filenames 2017-07-28 11:23:42 +01:00
Pieter Wuille efeb273305 Force on-the-fly compaction during pertxout upgrade 2017-07-27 21:07:19 -07:00
Alex Morcos 49d903e696 Eliminate fee overpaying edge case when subtracting fee from recipients 2017-07-27 22:04:17 -04:00
Gregory Maxwell 9a8b054185 Update defaultAssumeValid according to release-process.md.
Updated for block 477890.
2017-07-28 01:11:14 +00:00
Andrew Chow e222dc2aee Replace ismine with producesignature check in witnessifier
Instead of using ismine to check whether an address can be spent by us,
make the witness version of the script or address first and then use
ProduceSignature with the DummySignatureCreator to check if we can
solve for the script.

Also fixes test cases to reflect this change.
2017-07-27 15:04:00 -07:00
Matt Corallo c0025d0a92 Fix segfault when shutting down before fully loading
This was introduced by 3192975f1d.
It can be triggered easily when canceling DB upgrade from
pre-per-utxo.
2017-07-27 15:03:05 -04:00
Matt Corallo 138569722c Order chainstate init more logically.
* Order chainstate init more logically - first all of the
  blocktree-related loading, then coinsdb, then
  pcoinsTip/chainActive. Only create objects as needed.

* More clearly document exactly what is and isn't called in
  -reindex and -reindex-chainstate both with comments noting
  calls as no-ops and by adding if guards.

* Move LoadGenesisBlock further down in init. This is a more logical
  location for it, as it is after all of the blockindex-related
  loading and checking, but before any of the UTXO-related loading
  and checking.

* Move all of the VerifyDB()-related stuff into a -reindex +
  -reindex-chainstate if guard. It couldn't do anything useful
  as chainActive.Tip() would be null at this point anyway.
2017-07-27 15:03:05 -04:00
Matt Corallo ff3a21919d Call RewindBlockIndex even if we're about to run -reindex-chainstate
RewindBlockIndex works over both chainActive - disconnecting blocks
from the tip that need witness verification - and mapBlockIndex -
requiring redownload of blocks missing witness data.

It should never have been the case that the second half is skipped
if we're about to run -reindex-chainstate.
2017-07-27 15:03:05 -04:00
Matt Corallo b0f32497b8 More user-friendly error message if UTXO DB runs ahead of block DB
This gives LoadChainTip a return value - allowing it to indicate that
the UTXO DB ran ahead of the block DB. This just provides a nicer
error message instead of the previous mysterious
assert(!setBlockIndexCandidates.empty()) error.

This also calls ActivateBestChain in case we just loaded the genesis
block in LoadChainTip, avoiding relying on the ActivateBestChain
in ThreadImport before continuing init process.
2017-07-27 15:03:05 -04:00
Matt Corallo eda888e573 Fix some LoadChainTip-related init-order bugs.
* Move the writing of fTxIndex to LoadBlockIndex - this fixes a
  bug introduced in d6af06d68a where
  InitBlockIndex was writing to fTxIndex which had not yet been
  checked (because LoadChainTip hadn't yet initialized the
  chainActive, which would otherwise have resulted in
  InitBlockIndex being a NOP), allowing you to modify -txindex
  without reindex, potentially corrupting your chainstate!

* Rename InitBlockIndex to LoadGenesisBlock, which is now a more
  natural name for it. Also check mapBlockIndex instead of
  chainActive, fixing a bug where we'd write the genesis block out
  on every start.
2017-07-27 15:03:05 -04:00
Wladimir J. van der Laan 0b11a07848
Merge #10931: Fix misleading "Method not found" multiwallet errors
df389bc Change wallet method disabled error text (Russell Yanofsky)
e526b3d Fix misleading "Method not found" multiwallet errors (Russell Yanofsky)

Pull request description:

  Raise RPC_WALLET_NOT_SPECIFIED instead of RPC_METHOD_NOT_FOUND when a required
  wallet filename was not specified in an RPC call.

  Also raise more specific RPC_WALLET_NOT_FOUND error instead of
  RPC_INVALID_PARAMETER in case an invalid wallet was specified, for consistency.

Tree-SHA512: 6a8d885283f69bcfc28f2e08ac03eff02f9f8160a312ce2a90d868aa52533434fc0b4c4ab86547c2f09392338956df915637eaf7136a4fc105e6c8179f2d0ac8
2017-07-27 18:58:24 +02:00
James Hilliard ee2d10ad0c Check if sys/random.h is required for getentropy on OSX. 2017-07-27 15:34:09 +03:00
Wladimir J. van der Laan ba1bbb049b
Merge #10892: Replace traditional for with ranged for in block and transaction primitives
72f0060 Replace traditional for with ranged for in primitives (Dag Robole)

Pull request description:

  Replace traditional for with ranged for in block and transaction primitives to improve readability

Tree-SHA512: c0fff603d2939149ca48b6aa72b59738a3658d49bd58b2d4ffbc85bdb774d8d5bb808fe526fe22bb9eb214de632834d373e2aab44f6019a83c0b09440cea6528
2017-07-27 14:00:24 +02:00
Wladimir J. van der Laan 8a99fe053a
Merge #10501: remove some unused functions
f228b8e remove some unused functions (Marko Bencun)

Pull request description:

  Identified with `cppcheck --enable=unusedFunction .`.

   - GetSendBufferSize()'s last use removed in
     991955e
   - SetPort()'s last use removed in
     7e195e8
   - GetfLargeWorkInvalidChainFound() was introduced in
     e3ba0ef and never used

Tree-SHA512: ea8e5498bec981e42e1342c171c37723c2f5e575c7d6c1a524d9c6cd9b332bdd0d84fddf9e14ca011bb49fb82bd037386382c9afc546b3c2231ae548358bd4f4
2017-07-27 13:19:32 +02:00
Russell Yanofsky df389bca20 Change wallet method disabled error text
Not strictly backwards compatible because the error is not new in this release.
2017-07-26 09:35:17 -04:00
Wladimir J. van der Laan 5c8eb7916d
Merge #10912: [tests] Fix incorrect memory_cleanse(…) call in crypto_tests.cpp
065039d [tests] Fix incorrect memory_cleanse(…) call in crypto_tests.cpp (practicalswift)

Pull request description:

  `chKey` and `chIV` are pointers, not arrays :-)

  Probably the result of copy-pasting of old code where the code was operating on arrays instead of pointers.

  If I'm reading the code correctly the absence/presence of these `memory_cleanse(…)` calls won't alter the outcome of the test in question (`TestPassphraseSingle`) even if fixed. Therefore removing.

Tree-SHA512: a053b2817bedf6ef889744e546ce9a0f165dee94aef6850d9d6a6bb05b0018789597371ecf154a4aec8588c0ef5626ef08c23c35e35927f6b0497b5f086146fe
2017-07-26 12:06:13 +02:00
Wladimir J. van der Laan 9dd6a2be41
Merge #10824: Avoid unnecessary work in SetNetworkActive
a2420ae Avoid unnecessary work in SetNetworkActive (João Barbosa)

Pull request description:

  This PR adds an early return to avoid unnecessary notifications when the status doesn't change.

Tree-SHA512: 85d05ca6fa36cb581f94bc154d08bd72cd53f6a857173c6fb2f184058f9c0208c4cf5e5d196825a78339902d8f256688eb6793f99abc7be9c7cfac85136180d9
2017-07-26 11:11:42 +02:00
Russell Yanofsky e526b3d34c Fix misleading "Method not found" multiwallet errors
Raise RPC_WALLET_NOT_SPECIFIED instead of RPC_METHOD_NOT_FOUND when a required
wallet filename was not specified in an RPC call.

Also raise more specific RPC_WALLET_NOT_FOUND error instead of
RPC_INVALID_PARAMETER in case an invalid wallet was specified, for consistency.
2017-07-26 02:48:15 -04:00
Wladimir J. van der Laan 04d395e832
Merge #10854: Avoid using sizes on non-fixed-width types to derive protocol constants.
095b917 Avoid using sizes on non-fixed-width types to derive protocol constants. (Gregory Maxwell)

Pull request description:

  Thanks to awemany for pointing this out.

  This replaces #10172 which appears to be abandoned, but uses the constants as requested on that PR.

Tree-SHA512: 032c0d75b3aaf807a7d0c7fb8ff5515acc45ad58bd00fe81413f900fe02bad900534a970403b9bb568e132c9eddea6043e958daf625e8acc84375bd41ee2e2ef
2017-07-26 08:48:15 +02:00
Wladimir J. van der Laan 78f307b664
Merge #10655: Properly document target_confirmations in listsinceblock
9f8a46f Properly document target_confirmations in listsinceblock (Ryan Havar)

Pull request description:

  There seems to be some misunderstandings about this, but it's a heavily used function so I'd like to make sure the docs are clear about how it works.

  For a later issue:
  * Change the default of target_confirmations to 6  (1 is a pretty silly default)
  * Change the name of target_confirmations (it's really a horrible name)

Tree-SHA512: a2fba2fab30019cea9db56cd7e31de95ba31090617ab336bdf130f9591bfcf3fc5fbd9e7e1e40b6c7bd2f74b9b4658afb1fdc7fc44e1f79520d1319758982a1c
2017-07-26 08:45:01 +02:00
Wladimir J. van der Laan b995a374f7
Merge #10914: Add missing lock in CScheduler::AreThreadsServicingQueue()
a56f8b0 Add missing lock in CScheduler::AreThreadsServicingQueue() (Matt Corallo)

Pull request description:

  Not an actual bug as this is only used in asserts right now, but
  nice to not have a missing lock.

Tree-SHA512: 7e542b150a0be716783e196493d239f2ad15e5376abf54b67d735dc3ef1b10849c090337b849f530c9f7497ddcfb8389b47d64a5dcf6382b7d38838f88cc1100
2017-07-26 08:15:11 +02:00
Wladimir J. van der Laan f29d5dbd04
Merge #10899: [test] Qt: Use _putenv_s instead of setenv on Windows builds
0be03c7 Qt: Use _putenv_s instead of setenv on Windows builds (Brian McMichael)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/10836

  Error message I would get on `make`:
  ```
  ...
    CXXLD    bench/bench_bitcoin.exe
    OBJCXXLD qt/bitcoin-qt.exe
  qt/test/test_main.cpp: In function ‘int main(int, char**)’:
  qt/test/test_main.cpp:64:43: error: ‘setenv’ was not declared in this scope
       setenv("QT_QPA_PLATFORM", "minimal", 0);
                                             ^
  make[2]: *** [qt/test/qt_test_test_bitcoin_qt-test_main.o] Error 1
  make[2]: *** Waiting for unfinished jobs....
  make[2]: Leaving directory `/home/bmcmichael/Projects/bcoin/src'
  make[1]: *** [all-recursive] Error 1
  make[1]: Leaving directory `/home/bmcmichael/Projects/bcoin/src'
  make: *** [all-recursive] Error 1
  ```

  `setenv` function is not available from the Microsoft runtime library. Need to use `_putenv_s` instead.

  This solution tells the compiler to use `_putenv_s` on `WIN32` compilation (Note: this also works on 64-bit Windows instances.) and `setenv` everywhere else.

  I've tested builds on Windows 10 x64 and Ubuntu 16.04 with this code.

Tree-SHA512: d53c996c890e3c6f22b4f2dcca718bef9168f19a6d4a29b8ff13391bfc0c8ea9c1cd16782b47c25b156dcbdff18bb19e23bfd5f6fefb1f373c9d5454a13fc969
2017-07-26 08:12:01 +02:00
practicalswift 065039da1f [tests] Fix incorrect memory_cleanse(…) call in crypto_tests.cpp
chKey and chIV are pointers, not arrays :-)

Probably the result of copy-pasting of old code which was
operating on arrays instead of pointers.
2017-07-26 01:48:40 +02:00
Wladimir J. van der Laan 8537187d42
Merge #10799: Prevent user from specifying conflicting parameters to fundrawtx
99c7fc3 Prevent user from specifying conflicting parameters to fundrawtx (Matt Corallo)

Pull request description:

  estimate_mode/conf_target both are overridden by feeRate, so should
  not be specified together with feeRate.

  Based on #10706

Tree-SHA512: 8ccd08575fd1f2a0d45112538ffbbc73983ee172963230b0cc7ac41d13c6f3c740917f82b212c41ded3a64d873452e7f2c7af49f3b47cab897f8e85117f21333
2017-07-25 22:02:58 +02:00
Ryan Havar 9f8a46f077 Properly document target_confirmations in listsinceblock 2017-07-25 07:25:07 -12:00
Wladimir J. van der Laan 88af227687 test: Make sure wallet.backup is created in temp path
This assures that we don't overwrite a random file called
`wallet.backup` that happens to be in the current directory. It also
assures that the temporary file will be cleaned up.

Noticed by Evan Klitzke, came up in discussion here:
https://github.com/bitcoin/bitcoin/pull/10880#discussion_r128460722
2017-07-25 14:44:19 +02:00
Wladimir J. van der Laan 412b466d11
Merge #10870: [Qt] Use wallet 0 in rpc console if running with multiple wallets
9737572 [Qt] Use wallet 0 in rpc console if running with multiple wallets (Jonas Schnelli)

Pull request description:

  Current master with multiwallet results in accessing wallet 0 in QT (send / receive / tx history / etc.), **but** the RPC console cannot access that wallet (only non-wallet commands work).

  This is a quick solution to re-allow accessing the same wallet (Index 0) via RPC console in multiwallet.

  The solutions design is not "state of the art" (should go over WalletModel). Ideally we work on an overall multiwallet support for the GUI (which then would remove this change).

  I think we should consider this as a bugfix.

Tree-SHA512: 16cf844662248ffd3d82c7d0cbe5879f231fbc7d4f5a4aab4180a9087018519c98301e4ac311eaec2cc39dddf25d3edf9be99a6622ea682c138a820a9b21fd0c
2017-07-25 14:10:57 +02:00
practicalswift 6e8c48dc59 Add const to methods that do not modify the object for which it is called 2017-07-25 13:46:52 +02:00
Wladimir J. van der Laan 1124328ad1
Merge #10789: Punctuation/grammer fixes in rpcwallet.cpp
a5ecaf1 Fix misspellings and remove safety verbiage (Steven D. Lander)

Pull request description:

  Standardizing punctuation on CLI output and also including a few fixes for grammer.  This PR is for text only changes and includes no code edits.

Tree-SHA512: afde551bf1212838822188b6723f2bf1b7222decfa1cd7aa6b04967489108a29f80833af6059252af028c53437755f258275af0614e0d4d0311e09421cd8e131
2017-07-25 09:49:06 +02:00
João Barbosa a622a17683 Fix constness of ArgsManager methods 2017-07-24 23:56:50 +01:00
Wladimir J. van der Laan 0c70e845aa
Merge #10865: Move CloseSocket out of SetSocketNonBlocking and pass socket as const reference
05e023f Move CloseSocket out of SetSocketNonBlocking and pass SOCKET by const reference in SetSocket* functions (Dag Robole)

Pull request description:

  Rationale:

  Readability, SetSocketNonBlocking does what it says on the tin.

  Consistency, More consistent with the rest of the API in this unit.

  Reusability, SetSocketNonBlocking can also be used by clients that may not want to close the socket on failure.

  This also moves the responsibility of closing the socket back to the caller that opened it, which in general should know better how and when to close it.

Tree-SHA512: 85027137f1b626e2b636549ee38cc757a587adcf464c84be6e65ca16e3b75d7ed1a1b21dd70dbe34c7c5d599af39e53b89932dfe3c74f91a22341ff3af5ea80a
2017-07-24 16:54:42 +02:00
Dag Robole 72f00608d0 Replace traditional for with ranged for in primitives 2017-07-24 16:32:21 +02:00
Wladimir J. van der Laan 6ef3c7ec62
Merge #9622: [rpc] listsinceblock should include lost transactions when parameter is a reorg'd block
876e92b Testing: listsinceblock should display all transactions that were affected since the given block, including transactions that were removed due to a reorg. (Karl-Johan Alm)
f999c46 listsinceblock: optionally find and list any transactions that were undone due to reorg when requesting a non-main chain block in a new 'removed' array. (Karl-Johan Alm)

Pull request description:

  The following scenario will not notify the caller of the fact `tx0` has been dropped:

  1. User 1 receives BTC in tx0 from utxo1 in block aa1.
  2. User 2 receives BTC in tx1 from utxo1 (same) in block bb1
  3. User 1 sees 2 confirmations at block aa3.
  4. Reorg into bb chain.
  5. User 1 asks `listsinceblock aa3` and does not see that tx0 is now invalidated.

  See `listsinceblock.py` commit for related test.

  The proposed fix is to iterate from the given block down to the fork point, and to check each transaction in the blocks against the wallet, in addition to including all transactions from the fork point to the active chain tip (the current behavior). Any transactions that were present will now also be listed in the `listsinceblock` output in a new `replaced` array. This operation may be a bit heavy but the circumstances (and perceived frequency of occurrence) warrant it, I believe.

  Example output:
  ```Python
  {
    'transactions': [],
    'replaced': [
      {
        'walletconflicts': [],
        'vout': 1,
        'account': '',
        'timereceived': 1485234857,
        'time': 1485234857,
        'amount': '1.00000000',
        'bip125-replaceable': 'unknown',
        'trusted': False,
        'category': 'receive',
        'txid': 'ce673859a30dee1d2ebdb3c05f2eea7b1da54baf68f93bb8bfe37c5f09ed22ff',
        'address': 'miqEt4kWp9zSizwGGuUWLAmxEcTW9bFUnQ',
        'label': '',
        'confirmations': -7
      }
    ],
    'lastblock': '7a388f27d09e3699102a4ebf81597d974fc4c72093eeaa02adffbbf7527f6715'
  }
  ```

  I believe this addresses the comment by @luke-jr in https://github.com/bitcoin/bitcoin/pull/9516#issuecomment-274190081 but I could be wrong..

Tree-SHA512: 607b5dcaeccb9dc0d963d3de138c40490f3e923050b29821e6bd513d26beb587bddc748fbb194503fe618cfe34a6ed65d95e8d9c5764a882b6c5f976520cff35
2017-07-24 12:59:48 +02:00
Marko Bencun fe09b0197c add missing lock to crypter GetKeys()
Issue: #10905
2017-07-23 23:38:55 +02:00
Marko Bencun 5cb3da04b8 keystore GetKeys(): return result instead of writing to reference
Issue: #10905

By returning the result, a few useless lines can be removed.

Return-value-optimization means there should be no copy.
2017-07-23 23:38:52 +02:00
Matt Corallo a56f8b0be3 Add missing lock in CScheduler::AreThreadsServicingQueue()
Not an actual bug as this is only used in asserts right now, but
nice to not have a missing lock.
2017-07-23 14:51:22 -04:00
Marko Bencun f228b8e163 remove some unused functions
Identified with `cppcheck --enable=unusedFunction .`.

 - GetSendBufferSize()'s last use removed in
   991955ee81
 - SetPort()'s last use removed in
   7e195e8459
 - GetfLargeWorkInvalidChainFound() was introduced in
   e3ba0ef956 and never used
2017-07-22 09:55:57 +02:00
Dag Robole 05e023f2ec Move CloseSocket out of SetSocketNonBlocking and pass SOCKET by const reference in SetSocket* functions 2017-07-22 09:11:55 +02:00
Brian McMichael 0be03c71bd Qt: Use _putenv_s instead of setenv on Windows builds 2017-07-21 17:20:14 -04:00
Wladimir J. van der Laan 420238d310
Merge #10604: [wallet] [tests] Add listwallets RPC, include wallet name in getwalletinfo and add multiwallet test
3707fcd [wallet] [tests] Add listwallets to multiwallet test (John Newbery)
9508761 [wallet] [rpc] Add listwallets RPC (John Newbery)
4a05715 [wallet] [rpc] print wallet name in getwalletinfo (John Newbery)
09eacee [wallet] fix comment for CWallet::Verify() (John Newbery)

Pull request description:

  - fix comment for CWallet::Verify (cleanup after #8694)
  - expose the wallet name in `getwalletinfo` rpc
  - add `listwallets` rpc - returns array of wallet names
  - add functional test for multiwallet using new rpc functionality

Tree-SHA512: 52f864726bf8a28421d4f3604a6cb95fffb3f4e19edbce18efaef06142c48dd4adb9e7a65a10de2955c80f13c00803ce27c78ccbc8434d92ef12cd36c4ccb4aa
2017-07-21 15:37:49 +02:00
Karl-Johan Alm f999c46cae
listsinceblock: optionally find and list any transactions that were undone due to reorg when requesting a non-main chain block in a new 'removed' array. 2017-07-21 09:50:59 +09:00
Wladimir J. van der Laan 6adc3a3732
qt: Periodic translations update
Tree-SHA512: 6f2548776007ebe172d43fd26673c62d0db34af815fcf4451cb293f19c0d8cf84a6761dc2636ffb5a906074d70988b3cd805e21b2471de5eb1697fadc82d0205
2017-07-20 23:33:53 +02:00
John Newbery 9508761ed6 [wallet] [rpc] Add listwallets RPC
This commit adds a listwallets RPC, which lists the names of the
currently loaded wallets. This command intentionally shows no
information about the wallet other then the name. Information on
individual wallets can be obtained using the getwalletinfo RPC.
2017-07-20 16:55:12 -04:00
John Newbery 4a057152d2 [wallet] [rpc] print wallet name in getwalletinfo 2017-07-20 16:55:12 -04:00
John Newbery 09eacee6b2 [wallet] fix comment for CWallet::Verify() 2017-07-20 16:55:12 -04:00
Wladimir J. van der Laan 16240f43a5
Merge #10821: Add SSE4 optimized SHA256
6b8d872 Protect SSE4 code behind a compile-time flag (Pieter Wuille)
fa9be90 Add selftest for SHA256 transform (Pieter Wuille)
c1ccb15 Add SSE4 based SHA256 (Pieter Wuille)
2991c91 Add SHA256 dispatcher (Pieter Wuille)
4d50f38 Support multi-block SHA256 transforms (Pieter Wuille)

Pull request description:

  This adds an SSE4 assembly version of the SHA256 transform by Intel, and uses it at run time if SSE4 instructions are available, and use a fallback C++ implementation otherwise. Nearly every x86_64 CPU supports SSE4. The feature is only enabled when compiled with `--enable-experimental-asm`.

  In order to avoid build dependencies and other complications, the original Intel YASM code was translated to GCC extended asm syntax.

  This gives around a 50% speedup on the SHA256 benchmark for me.

  It is based on an earlier patch by @laanwj, though only includes a single assembly version (for now), and removes the YASM dependency.

Tree-SHA512: d31c50695ceb45264291537b93c0d7497670be38edf021ca5402eaa7d4e1e0e1ae492326e28d4e93979d066168129e62d1825e0384b1b906d36f85d93dfcb43c
2017-07-20 20:28:35 +02:00
Jonas Schnelli 97375727b8
[Qt] Use wallet 0 in rpc console if running with multiple wallets 2017-07-20 20:24:52 +02:00
Pieter Wuille 6b8d872e5e Protect SSE4 code behind a compile-time flag 2017-07-20 09:03:53 -07:00
Pieter Wuille fa9be909c9 Add selftest for SHA256 transform 2017-07-20 09:03:53 -07:00
Pieter Wuille c1ccb15b0e Add SSE4 based SHA256 2017-07-20 09:03:53 -07:00
Pieter Wuille 2991c91d88 Add SHA256 dispatcher 2017-07-20 09:03:53 -07:00
Pieter Wuille 4d50f38fe0 Support multi-block SHA256 transforms
Extracted from a patch by Wladimir van der Laan.
2017-07-20 09:03:53 -07:00
Wladimir J. van der Laan 7c2400cb8a
Merge #10775: nCheckDepth chain height fix
d9d1bd3 nCheckDepth chain height fix (romanornr)

Pull request description:

  ````
  if (nCheckDepth <= 0)
      nCheckDepth = 1000000000; // suffices until the year 19000
  if (nCheckDepth > chainActive.Height())
      nCheckDepth = chainActive.Height();
  ````

  These lines confuse me.
  Correct me if I am wrong, but we can't check any more blocks than we have right?
  If someone requests <= 0 it get set it into some huge number and then immediately limit it to the chain height in the following statement.
  ````
  if (nCheckDepth > chainActive.Height())
      nCheckDepth = chainActive.Height();
  ````
  when using ````--checkblocks=Z```` When Z is ````0```` or any other negative number, it will check all blocks.

  I think it should be changed to this maybe.
  ````
  if (nCheckDepth <= 0 || nCheckDepth > chainActive.Height())
      nCheckDepth = chainActive.Height();
  ````
  Which gets rid of that huge number which is confusing for any other altcoins that have a different block time.

Tree-SHA512: 8ee0ae5f33b399fa74dc16926709694ccfe1fc8a043cba2f5d00884220ac1b9b13f2df4588041f4133be634e5c7b14f4eebe24294028dafe91581a97dbe627f3
2017-07-20 17:34:54 +02:00
Wladimir J. van der Laan 041dad94b0
Merge #10783: [RPC] Various rpc argument fixes
4dc1915 check for null values in rpc args and handle appropriately (Gregory Sanders)
999ef20 importmulti options are optional (Gregory Sanders)
a70d025 fixup some rpc param counting for rpc help (Gregory Sanders)

Pull request description:

  Audited where named args will fail to use correct default values or may fail when additional optional arguments are added.

  Previously for these parameters, it was fine to omit them as positional arguments, but it would trigger UniValue runtime errors to set them to null, or to omit them while passing named parameters with greater positions (which would internally set earlier missing arguments to null). Now null values are treated the same as missing values so these errors do not occur.

  Included a few other small fixes while working on it.

  I didn't bother fixing account-based rpc calls.

Tree-SHA512: 8baf781a35bd48de7878d4726850a580dab80323d3416c1c146b4fa9062f8a233c03f37e8ae3f3159e9d04a8f39c326627ca64c14e1cb7ce72538f934ab2ae1e
2017-07-20 17:02:07 +02:00
Wladimir J. van der Laan fd2814ef11
Merge #10862: Remove unused variable int64_t nEnd. Fix typo: "conditon" → "condition".
5a6671c Fix typo: "conditon" → "condition" (practicalswift)
35aff43 Remove unused variable int64_t nEnd (practicalswift)

Pull request description:

  * Remove unused variable `int64_t nEnd`. Last use of `nEnd` removed in commit 1fc8c3d.
  * Fix typo: "conditon" → "condition". Typo introduced in commit 439c4e8.

Tree-SHA512: 61624e6f70828c485fe46dbe00df76f1a07b7a5849d41bf7d279323b687420e60e9b85192f611a37211f17f3dea8eb3f6f6dc65d90c92e5516404fd81d37785a
2017-07-20 16:56:45 +02:00
Wladimir J. van der Laan adf170daf9
Merge #10571: [RPC]Move transaction combining from signrawtransaction to new RPC
6b4f231 Move transaction combining from signrawtransaction to new RPC (Andrew Chow)

Pull request description:

  Create a combinerawtransaction RPC which accepts a json array of hex raw transactions to combine them into one transaction. Signrawtransaction is changed to no longer combine transactions and only accept one transaction at a time.

  The tests have been updated to test this. Tests for the signrawtransaction merge have also been removed.

  This is part of #10570

Tree-SHA512: 035aebbd6537c1c017d5c8e06d309228b4c23fe52d5b31ffde19741c81a11a6346ddbbdc582b77b02a47f4c22b1952b69d3c2ee1109c29b3f0f1b612d8de53ed
2017-07-20 16:42:27 +02:00
Marko Bencun 352d582ba2 Add vConnect to CConnman::Options
Split the "-connect" argument parsing out of CConnman and put it into
AppInitMain().
2017-07-19 23:34:50 +02:00
Steven D. Lander a5ecaf1490
Fix misspellings and remove safety verbiage 2017-07-19 16:50:26 -04:00
Alex Morcos 2264236da0 Rename -usewallet to -rpcwallet 2017-07-19 15:44:20 -04:00
Wladimir J. van der Laan d445a2c2ea
Merge #10857: [RPC] Add a deprecation warning to getinfo's output
1c9b818 getinfo deprecation warning (Andrew Chow)

Pull request description:

  This is an alternative to #10841

  This PR implements @gmaxwell's suggestion of a `nag` field for getinfo which warns about the deprecation. Instead of calling it `nag`, I have named it `deprecation-warning`. The output of `getinfo` will look like this:
  ```
  {
    "version": 149900,
    "protocolversion": 70015,
    "walletversion": 139900,
    "balance": 0.00000000,
    "blocks": 476281,
    "timeoffset": 0,
    "connections": 2,
    "proxy": "",
    "difficulty": 804525194568.1318,
    "testnet": false,
    "keypoololdest": 1496858803,
    "keypoolsize": 197,
    "unlocked_until": 0,
    "paytxfee": 0.00000000,
    "relayfee": 0.00001000,
    "errors": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications",
    "deprecation-warning": "WARNING: getinfo is deprecated and will be fully removed in 0.16. Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16"
  }
  ```

  I think this should be tagged for 0.15

Tree-SHA512: ea1bac96a67f797519e8748ddd661cf0a1127cbc38f145b98f10cf9b54dcf0519b353062ce9888e1f51875497299c75ff5147566944451bc3fc117620e773489
2017-07-19 17:01:19 +02:00
Wladimir J. van der Laan 9022aa3722
Merge #10817: Redefine Dust and add a discard_rate
f4d00e6 Add a discard_rate (Alex Morcos)
b138585 Remove factor of 3 from definition of dust. (Alex Morcos)

Pull request description:

  The definition of dust is redefined to remove the factor of 3.

  Dust is redefined to be the value of an output such that it would
  cost that value in fees to (create and) spend the output at the dust
  relay rate.  The previous definition was that it would cost 1/3 of the
  value.  The default dust relay rate is correspondingly increased to
  3000 sat/kB so the actual default dust output value of 546 satoshis
  for a non-segwit output remains unchanged.  This commit is a refactor
  only unless a dustrelayfee is passed on the commandline in which case
  that number now needs to be increased by a factor of 3 to get the same
  behavior.  -dustrelayfee is a hidden command line option.

  Note: It's not exactly a refactor due to edge case changes in rounding
  as evidenced by the required change to the unit test.

  A discard_rate is added which defaults to 10,000 sat/kB

  Any change output which would be dust at the discard_rate you are
  willing to discard completely and add to fee (as well as continuing to
  pay the fee that would have been needed for creating the change)

  This would be a nice addition for 0.15 and I think will remain useful for 0.16 with the new coin selection algorithms in discussion, but its not crucial.

  It does add translation strings, but we could (should?) avoid that by hiding the option

Tree-SHA512: 5b6f655354d0ab6b8b6cac1e8d1fe3136d10beb15c6d948fb15bfb105155a9d03684c6240624039b3eed6428b7e60e54216cc8b2f90c4600701e39f646284a9b
2017-07-19 16:46:49 +02:00
Jonas Schnelli a6ec5802b0
Merge #10864: Avoid redundant redeclaration of GetWarnings(const string&)
e0d459264 Avoid redundant redeclaration of GetWarnings(const string&) (practicalswift)

Pull request description:

  Avoid redundant redeclaration of `GetWarnings(const string&)`.

  `std::string GetWarnings(const std::string& strFor)` is declared in `warnings.h` and defined in `warnings.cpp`.

Tree-SHA512: d1503e00a2073cf080d66eafa303dc9c660a7ac15d4d2abcf2e4aa69cf9622d89a8e3f09324139bb7b8debaa6d1ee4a1c1681d347cebd99b1d3672a4da6d1ace
2017-07-19 11:53:44 +02:00
Andrew Chow 1c9b818756 getinfo deprecation warning 2017-07-18 12:34:37 -07:00
Andrew Chow 6b4f231f5f Move transaction combining from signrawtransaction to new RPC
Create a combinerawtransaction RPC which accepts a json array of hex raw
transactions to combine them into one transaction. Signrawtransaction is changed
to no longer combine transactions and only accept one transaction at a time.
2017-07-18 10:59:06 -07:00
Wladimir J. van der Laan 9e8d6a3fb4
Merge #10784: Do not allow users to get keys from keypool without reserving them
cf82a9e Do not allow users to get keys from keypool without reserving them (Matt Corallo)

Pull request description:

  fundrawtransaction allows users to add a change output and then
  not have it removed from keypool. While it would be nice to have
  users follow the normal CreateTransaction/CommitTransaction process
  we use internally, there isnt much benefit in exposing this option,
  especially with HD wallets, while there is ample room for users to
  misunderstand or misuse this option.

  This partially reverts #9377. Would be nice to get this for 15 since its kinda crazy we have this option to begin with IMO, will need release notes as an RPC option is now ignored.

Tree-SHA512: 72b5ee9c4a229b84d799dfb00c56fe80d8bba914ce81a433c3f5ab325bf9bf2b839ee658c261734f0ee183ab19435039481014d09c41dbe155e6323e63beb01d
2017-07-18 17:31:06 +02:00
Matt Corallo cf82a9e704 Do not allow users to get keys from keypool without reserving them
fundrawtransaction allows users to add a change output and then
not have it removed from keypool. While it would be nice to have
users follow the normal CreateTransaction/CommitTransaction process
we use internally, there isnt much benefit in exposing this option,
especially with HD wallets, while there is ample room for users to
misunderstand or misuse this option.

This could be particularly nasty in some use-cases (especially
pre-HD-split) - eg a user might fundrawtransaction, then call
getnewaddress, hand out the address for someone to pay them, then
sendrawtransaction. This may result in the user thinking they have
received payment, even though it was really just their own change!

This could obviously result in needless key-reuse.
2017-07-18 11:20:47 -04:00
Wladimir J. van der Laan bde4f937ae
Merge #10849: Multiwallet: simplest endpoint support
6b9faf7 [QA] add basic multiwallet test (Jonas Schnelli)
979d0b8 [tests] [wallet] Add wallet endpoint support to authproxy (John Newbery)
76603b1 Select wallet based on the given endpoint (Jonas Schnelli)
32c9710 Fix test_bitcoin circular dependency issue (Jonas Schnelli)
31e0720 Add wallet endpoint support to bitcoin-cli (-usewallet) (Jonas Schnelli)
dd2185c Register wallet endpoint (Jonas Schnelli)

Pull request description:

  Alternative for #10829 and #10650.
  It adds the most simplest form of wallet based endpoint support (`/wallet/<filename>`).
  No v1 and no node/wallet endpoint split.

Tree-SHA512: 23de1fd2f9b48d94682928b582fb6909e16ca507c2ee19e1f989d5a4f3aa706194c4b1fe8854d1d79ba531b7092434239776cae1ae715ff536e829424f59f9be
2017-07-18 17:18:49 +02:00
practicalswift e0d459264f Avoid redundant redeclaration of GetWarnings(const string&)
std::string GetWarnings(const std::string& strFor) is declared in
warnings.h and defined in warnings.cpp.
2017-07-18 15:54:38 +02:00
practicalswift 5a6671c4ca Fix typo: "conditon" → "condition"
Typo introduced in commit 439c4e8ad5.
2017-07-18 14:02:42 +02:00
practicalswift 35aff43217 Remove unused variable int64_t nEnd
Last use of nEnd removed in commit 1fc8c3de0c.
2017-07-18 14:02:15 +02:00
Wladimir J. van der Laan 7b6e8bc442
Merge #10795: No longer ever reuse keypool indexes
1fc8c3d No longer ever reuse keypool indexes (Matt Corallo)

Pull request description:

  This fixes an issue where you could reserve a keypool entry, then
  top up the keypool, writing out a new key at the given index, then
  return they key from the pool. This isnt likely to cause issues,
  but given there is no reason to ever re-use keypool indexes
  (they're 64 bits...), best to avoid it alltogether.

  Builds on #10235, should probably get a 15 tag.

Tree-SHA512: c13a18a90f1076fb74307f2d64e9d80149811524c6bda259698ff2c65adaf8c6c3f2a3a07a5f4bf03251bc942ba8f5fd33a4427aa4256748c40b062991682caf
2017-07-18 09:30:33 +02:00
Wladimir J. van der Laan 81560b07ce
Merge #10855: random: only use getentropy on openbsd
077d01f random: only use getentropy on openbsd (Cory Fields)

Pull request description:

  Follow-up from #10335. I can confirm that this fixes my issue when building against a new glibc + old linux headers for back-compat.

Tree-SHA512: a0fcf26995fbd3636f970e729a172c6e1d7c0de371e703f0653cd9776600f438ec43acd2b1eb92f2678a011968da8fbbeef8a54599434851f4c6ffe78291c172
2017-07-18 08:29:35 +02:00
Pieter Wuille 75b5643c47
Merge #10707: Better API for estimatesmartfee RPC
06bcdb8da Convert named argument from nblocks to conf_target (Alex Morcos)
439c4e8ad Improve api to estimatesmartfee (Alex Morcos)

Pull request description:

  Through 0.14 branch, the estimatesmartfee API was tagged "WARNING: This interface is unstable and may disappear or change!" and this warning is removed for 0.15, so any wanted API updates should happen now.

  The changes here are to make the additional parameter for conservative estimates a more general estimate_mode string , to omit the feerate and include an error string instead of returning -1 on error, and to do better parameter checking initially.

  ~It is only the last 2 commits, but it's built on #10706 and #10543~.

  See https://github.com/bitcoin/bitcoin/pull/10707#issuecomment-314869251 for renaming of nblocks argument to conf_target.  Will need to be included before string freeze.

  PR description edited for clarity

Tree-SHA512: 6d8ebee8bb410e2950ffd59663eebfed8d1611d995dc935bb91e430d9da7e2f306796f45631458376027d26341c660f09e825e61748103d2f2736ec6dc3df3ae
2017-07-17 16:54:20 -07:00
Pieter Wuille fee0d803fb
Merge #9980: Fix mem access violation merkleblock
8276e70de Adding assert to avoid a memory access violation inside of PartialMerkleTree::CalcHash() (Chris Stewart)

Pull request description:

  Fixing a possible memory access violation in CPartialMerkleTree::CalcHash().

  This can happen if we some how a merkle tree with zero txids. I don't think this can happen in practice as we only send merkle block messages on the p2p network as of now -- we cannot receive them.

  This was found with #8469, specifically using this [generator](https://github.com/Christewart/bitcoin/blob/rapidcheck/src/test/gen/merkleblock_gen.h#L52-L77) which will cause a memory access violation on [this test case](https://github.com/Christewart/bitcoin/blob/rapidcheck/src/test/merkleblock_properties.cpp#L48).

Tree-SHA512: b95904ec45ea3f082c7722161d93ee06b24c706fbffa909a6e995ed14788aed2830f91b626da6f0347660c45874a0735dab61c9440b59c949c690af4165c83fb
2017-07-17 15:12:39 -07:00
Matt Corallo 99c7fc39a5 Prevent user from specifying conflicting parameters to fundrawtx
estimate_mode/conf_target both are overridden by feeRate, so should
not be specified together with feeRate.
2017-07-17 13:47:45 -04:00
Alex Morcos f4d00e63f7 Add a discard_rate
Any change output which would be dust at the discard_rate you are
willing to discard completely and add to fee (as well as continuing to
pay the fee that would have been needed for creating the change).
2017-07-17 13:40:30 -04:00
Cory Fields 077d01f2fc random: only use getentropy on openbsd 2017-07-17 13:14:53 -04:00
Gregory Maxwell 095b917464 Avoid using sizes on non-fixed-width types to derive protocol constants.
Thanks to awemany for pointing this out.
2017-07-17 17:00:00 +00:00
practicalswift b82c55af78 Add attribute [[noreturn]] (C++11) to functions that will not return
Rationale:
* Reduce the number of false positives from static analyzers
* Potentially enable additional compiler optimizations
2017-07-17 18:46:18 +02:00
Matt Corallo 1fc8c3de0c No longer ever reuse keypool indexes
This fixes an issue where you could reserve a keypool entry, then
top up the keypool, writing out a new key at the given index, then
return they key from the pool. This isnt likely to cause issues,
but given there is no reason to ever re-use keypool indexes
(they're 64 bits...), best to avoid it alltogether.
2017-07-17 12:12:48 -04:00
Jonas Schnelli 76603b1325
Select wallet based on the given endpoint 2017-07-17 17:42:21 +02:00
Jonas Schnelli 32c9710c50
Fix test_bitcoin circular dependency issue 2017-07-17 17:42:21 +02:00
Jonas Schnelli 31e07203bd
Add wallet endpoint support to bitcoin-cli (-usewallet) 2017-07-17 17:42:09 +02:00
practicalswift 40a0f9fb96 Enable devirtualization opportunities by using the final specifier (C++11)
* Declaring CCoinsViewErrorCatcher final enables devirtualization of two calls
* Declaring CReserveKey final enables devirtualization of one call
2017-07-17 11:35:13 -04:00
Cory Fields 9a1675ee5b optim: mark a few classes final 2017-07-17 11:34:38 -04:00
Wladimir J. van der Laan 0b019357ff
Merge #10831: Batch flushing operations to the walletdb during top up and increase keypool size.
b0e8e2d Print one log message per keypool top-up, not one per key. (Gregory Maxwell)
41dc163 Increase wallet default keypool size to 1000. (Gregory Maxwell)
30d8f3a Pushdown walletdb though CWallet::AddKeyPubKey to avoid flushes. (Gregory Maxwell)
3a53f19 Pushdown walletdb object through GenerateNewKey/DeriveNewChildKey. (Gregory Maxwell)

Pull request description:

  This carries the walletdb object from top-up through GenerateNewKey/DeriveNewChildKey/CWallet::AddKeyPubKey, which allows us to avoid the flush on destruction until the top up finishes instead of flushing the wallet for every key.

  This speeds up adding keys by well over 10x on my laptop (actually something like 17x), I wouldn't be surprised if it were an even bigger speedup on spinning rust.

  Then it increases the keypool size to 1000. I would have preferred to use 10,000 but in the case where the user creates a new wallet and then turns on encryption it seems kind of dumb to have >400KB of marked-used born unencrypted keys just laying around.

  (Thanks to Matt for cluesticking me on how to bypass the crypter spaghetti)

Tree-SHA512: 868303de38fce4c3f67d7fe133f765f15435c94b39d252d7450b5fee5c607a3cc2f5e531861a69d8c8877bf130e0ff4c539f97500a6bc0ff6d67e4a42c9385c7
2017-07-17 17:16:12 +02:00
Wladimir J. van der Laan 89bb0365b9
Merge #10832: init: Factor out AppInitLockDataDirectory and fix startup core dump issue
dba485d init: Factor out AppInitLockDataDirectory (Wladimir J. van der Laan)

Pull request description:

  Alternative to #10818, alternative solution to #10815.

  After this change: All the AppInit steps before and inclusive AppInitLockDataDirectory must not have Shutdown() called in case of failure. Only when AppInitMain fails, Shutdown should be called.

  Changes the GUI and bitcoind code to consistently do this.

Tree-SHA512: 393e1a0ae05eb8e791025069e3ac4f6f3cdeb459ec63feda85d01cf6696ab3fed7632b6a0ac3641b8c7015af51d46756b5bba77f5e5f0c446f0c2dea58bbc92e
2017-07-17 17:13:11 +02:00
René Nyffenegger c5ebddd114 Tests: address placement should be deterministic by default 2017-07-17 16:57:14 +02:00
Alex Morcos 06bcdb8da6 Convert named argument from nblocks to conf_target
in estimatesmartfee and estimaterawfee.  Also reuse existing bounds checking.
2017-07-17 10:52:14 -04:00
Alex Morcos 439c4e8ad5 Improve api to estimatesmartfee
Change parameter for conservative estimates to be an estimate_mode string.
Change to never return a -1 for failure but to instead omit the feerate and
return an error string.  Throw JSONRPC error on invalid nblocks parameter.
2017-07-17 10:52:14 -04:00
Gregory Maxwell b0e8e2de84 Print one log message per keypool top-up, not one per key. 2017-07-17 13:46:15 +00:00
Gregory Maxwell 41dc163587 Increase wallet default keypool size to 1000. 2017-07-17 13:46:14 +00:00
Gregory Maxwell 30d8f3a18e Pushdown walletdb though CWallet::AddKeyPubKey to avoid flushes.
This prevents the wallet from being flushed between each and
 every key during top-up.  This results in a >10x speed-up
 for the top-up.
2017-07-17 13:46:07 +00:00
MarcoFalke 2b0179d8a9
Merge #10834: Remove declaration of unused method: void UpdatedTransaction(const uint256 &)
e061d8d Remove declaration of unused function: void UpdatedTransaction(const uint256 &) (practicalswift)

Pull request description:

  Remove declaration of unused method: `void UpdatedTransaction(const uint256 &)`

  Removed in 9fececb2cb.

Tree-SHA512: a328e00ccecc2a31cda7e204ab8c29ea34811afc2090f3dfd88d6d58543761dba8a289585d30b98e05236c67b1a04844e556a3b05d6e8e706233bc502f31af1d
2017-07-17 15:03:33 +02:00
Wladimir J. van der Laan dba485d651
init: Factor out AppInitLockDataDirectory
Alternative to #10818, alternative solution to #10815.

After this change: All the AppInit steps before and inclusive
AppInitLockDataDirectory must not have Shutdown() called in case of
failure. Only when AppInitMain fails, Shutdown should be called.

Changes the GUI and bitcoind code to consistently do this.
2017-07-17 14:56:52 +02:00
Gregory Sanders 4dc1915bce check for null values in rpc args and handle appropriately 2017-07-17 08:53:18 -04:00
Gregory Sanders 999ef2073a importmulti options are optional 2017-07-17 08:53:06 -04:00
Gregory Sanders a70d025366 fixup some rpc param counting for rpc help 2017-07-17 08:53:06 -04:00
Wladimir J. van der Laan 8bc6d1f179
Merge #10837: Fix resource leak on error in GetDevURandom
a8ae0b2 Fix resource leak (Dag Robole)

Pull request description:

  Fixes a potential file handle leak when size of entropy is invalid

Tree-SHA512: 692d24daaf370bba1f842925b037275126f9494f54769650bcf5829c794a0fb8561a86f42347bdf088a484e4f107bce7fa14cd7bdbfb4ecfbeb51968953da3ae
2017-07-17 13:14:09 +02:00
Alex Morcos b1385852ef Remove factor of 3 from definition of dust.
This redefines dust to be the value of an output such that it would
cost that value in fees to (create and) spend the output at the dust
relay rate.  The previous definition was that it would cost 1/3 of the
value.  The default dust relay rate is correspondingly increased to
3000 sat/kB so the actual default dust output value of 546 satoshis
for a non-segwit output remains unchanged.  This commit is a refactor
only unless a dustrelayfee is passed on the commandline in which case
that number now needs to be increased by a factor of 3 to get the same
behavior.  -dustrelayfee is a hidden command line option.

Note: It's not exactly a refactor due to edge case changes in rounding
as evidenced by the required change to the unit test.
2017-07-17 07:10:03 -04:00
Jonas Schnelli dd2185c291
Register wallet endpoint 2017-07-17 11:56:00 +02:00
Wladimir J. van der Laan 6859ad2936
Merge #10706: Improve wallet fee logic and fix GUI bugs
11590d3 Properly bound check conf_target in wallet RPC calls (Alex Morcos)
fd29d3d Remove checking of mempool min fee from estimateSmartFee. (Alex Morcos)
2fffaa9 Make QT fee displays use GetMinimumFee instead of estimateSmartFee (Alex Morcos)
1983ca6 Use CoinControl to pass custom fee setting from QT. (Alex Morcos)
03ee701 Refactor to use CoinControl in GetMinimumFee and FeeBumper (Alex Morcos)
ecd81df Make CoinControl a required argument to CreateTransaction (Alex Morcos)

Pull request description:

  This builds on #10589  (first 5 commits from that PR, last 5 commits are new)

  The first couple commits refactor to use the CCoinControl class to pass fee calculation parameters around.

  This allows for fixing the buggy interaction in QT between the global payTxFee which can be modified by the RPC call settxfee or temporarily modified by the QT custom fee settings.  Before these changes the GUI could sometimes send a transaction with a recently set payTxFee and not respect the settings displayed in the GUI.   After these changes, using the GUI does not involve the global transaction confirm target or payTxFee.

  The prospective fee displays in the smart fee slider and the coin control dialog are changed to use the fee calculation from GetMinimumFee, this simplifies the code and makes them slightly more correct in edge cases.

  Maxing the fee calculation with the mempool min fee is move from estimateSmartFee to GetMinimumFee.

  This fixes a long standing bug, and should be tagged for 0.15 as it is holding up finalizing the estimatesmartfee RPC API before release.

Tree-SHA512: 4d36a1bd5934aa62f3806d380fcafbef73e9fe5bdf190fc5259a3e3a13349e5ce796e50e7068c46dc630ccf56d061bce5804f0bfe2e082bb01ca725b63efd4c1
2017-07-17 09:25:33 +02:00
MarcoFalke bf0a08be28
Merge #10330: [wallet] fix zapwallettxes interaction with persistent mempool
4c3b538 [logs] fix zapwallettxes startup logs (John Newbery)
e7a2181 [wallet] fix zapwallettxes interaction with persistent mempool (John Newbery)
ff7365e [tests] fix flake8 warnings in zapwallettxes.py (John Newbery)

Pull request description:

  zapwallettxes previously did not interact well with persistent mempool.
  zapwallettxes would cause wallet transactions to be zapped, but they
  would then be reloaded from the mempool on startup. This commit softsets
  persistmempool to false if zapwallettxes is enabled so transactions are
  actually zapped.

  This PR also fixes the zapwallettxes.py functional test, which did not properly test this feature. The test line:

  ```py
       assert_raises(JSONRPCException, self.nodes[0].gettransaction, [txid3])
       #there must be a expection because the unconfirmed wallettx0 must be gone by now
  ```
  is not actually testing the presence of the transaction since the RPC is being called incorrectly (with an array instead of a string). The `assert_raises()` passes since an assert is raised, but it's not the one the test writer had in mind!

  Fixes #9710 .

Tree-SHA512: e3236efc7a2fd2b3bf1d9e2e8a7726d470c57f5d95cf41b7bde264edc8817bd36a6f3feff52f8de8db0ef64b7247c88b24e7ff7cefaa706cba86fe4e2135a508
2017-07-17 04:23:52 +02:00
MarcoFalke 3895e25a77
Merge #10842: Fix incorrect Doxygen tag (@ince → @since). Doxygen parameter name matching.
2c2e90d Fix incorrect Doxygen tag (@ince → @since). Make Doxygen parameter names match actual parameter names. (practicalswift)

Pull request description:

  Doxygen fixes:
  * Fix incorrect Doxygen tag (`@ince` → `@since`).
  * Make Doxygen parameter names match actual parameter names.

Tree-SHA512: cb1d37a7d15a90d24affaf5c2bcf462663f0b0c13868bb25401e5d8cb303fcb41e53fdeee8012b2271a509112ef98fc0c070b4194f42cd55361f7e6bc7996342
2017-07-16 23:41:58 +02:00
MarcoFalke 1fc783fc08
Merge #10739: test: Move variable state down where it is used
5618b7d Do not shadow upper local variable `state`. (Pavel Janík)

Pull request description:

  Tests added in #10192 emit few shadowing warnings:

  ```
  test/txvalidationcache_tests.cpp:268:26: warning: declaration shadows a local variable [-Wshadow]
  test/txvalidationcache_tests.cpp:296:26: warning: declaration shadows a local variable [-Wshadow]
  test/txvalidationcache_tests.cpp:357:26: warning: declaration shadows a local variable [-Wshadow]
  ```

  Remove shadowing declarations and reuse the upper local declaration as in other already present test cases.

Tree-SHA512: 1e3c52cf963f8f33e729900c8ecdcd5cc6fe28caa441ba53c4636df9cc3d1a351ca231966d36384589f1340ae8ddd447424c2ee3e8527d334d0412f0d1a10c8f
2017-07-16 22:47:33 +02:00
practicalswift 2c2e90d1d4 Fix incorrect Doxygen tag (@ince → @since). Make Doxygen parameter names match actual parameter names. 2017-07-16 21:22:05 +02:00
Pieter Wuille 565494619d
Merge #10735: Avoid static analyzer warnings regarding uninitialized arguments
6835cb0ab Avoid static analyzer warnings regarding uninitialized arguments (practicalswift)

Pull request description:

  Avoid static analyzer warnings regarding _"Function call argument is a pointer to uninitialized value"_ in cases where we are intentionally using such arguments.

  This is achieved by using `f(b.begin(), b.end())` (`std::array<char, N>`) instead of `f(b, b + N)` (`char b[N]`).

  Rationale:
  * Reduce false positives by guiding static analyzers regarding our intentions.

  Before this commit:

  ```shell
  $ clang-tidy-3.5 -checks=* src/bench/base58.cpp
  bench/base58.cpp:23:9: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage]
          EncodeBase58(b, b + 32);
          ^
  $ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp
  bench/verify_script.cpp:59:5: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage]
      key.Set(vchKey, vchKey + 32, false);
      ^
  $
  ```

  After this commit:

  ```shell
  $ clang-tidy-3.5 -checks=* src/bench/base58.cpp
  $ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp
  $
  ```

Tree-SHA512: 5814a320ca8b959d0954bb64393424bcad73f942d2e988de1cd6788f39153b93900325532f2e340de02d740a3953385d212ae08e7ec72bb4c394a40475f251df
2017-07-16 12:15:11 -07:00
Pieter Wuille ad6fce67b9
Merge #10844: Use range based for loop
d0413c670 Use range based for loop (René Nyffenegger)

Pull request description:

  Instead of iterating over 0 .. 1 and then deciding on an actual desired
  value, use a range based for loop for the desired value.

Tree-SHA512: 0a7a4a80516c9f16cf97fa7d257088b8386360e19b93c4deac3d745b6270ea452c513821686d7d14a159a235763e034f9b14eef222ca15f7eb71c37bd1c2c380
2017-07-16 12:03:30 -07:00
Pieter Wuille 99c7db8731
Merge #10840: Remove duplicate include
c53369cc2 Remove duplicate include (practicalswift)

Pull request description:

  Remove duplicate include.

  Introduced in 5c643241e5.

Tree-SHA512: c273cb60824b3a2b2bdebdc4fc84b309d66042d616ccfc9a7b1ee55380af0ab7d1ae059391b3b46063847087a1985e2491d4ce203a31a2b1c586e8fd531d9336
2017-07-16 12:00:19 -07:00
Pieter Wuille ef37f2033c
Merge #10820: Use cpuid intrinsics instead of asm code
674848fe1 Clarify entropy source (Pieter Wuille)
a9e82f651 Use cpuid intrinsics instead of asm code (Pieter Wuille)

Pull request description:

  Less platform-specific code is better.

Tree-SHA512: 14f1b9accd9882859acdf516d2ada7ccb0ad92a3b3edf95b9cb8a8e514d4b1748d4555bcfb560779792c4f664f920d681ae42e9cebd0e6410f13f94c3a8729a0
2017-07-16 11:50:49 -07:00
practicalswift 41bf1598f1 Remove unreachable code 2017-07-16 19:42:37 +02:00
René Nyffenegger d0413c670b Use range based for loop
Instead of iterating over 0 .. 1 and then deciding on an actual desired
value, use a range based for loop for the desired value.
2017-07-16 17:03:33 +02:00
practicalswift c53369cc24 Remove duplicate include 2017-07-16 02:25:25 +02:00
Gregory Maxwell 3a53f19718 Pushdown walletdb object through GenerateNewKey/DeriveNewChildKey.
This is needed but not sufficient for batching the wallet flushing
 when topping up the keypool.
2017-07-16 00:11:31 +00:00
Pieter Wuille 5cfdda2503
Merge #10235: Track keypool entries as internal vs external in memory
d40a72ccb Clarify *(--.end()) iterator semantics in CWallet::TopUpKeyPool (Matt Corallo)
28301b978 Meet code style on lines changed in the previous commit (Matt Corallo)
4a3fc3562 Track keypool entries as internal vs external in memory (Matt Corallo)

Pull request description:

  This is an alternative version of #10184. As @jonasschnelli points out there, the performance regressions are pretty minimal, but given that this is a pretty simple, mechanical change, its probably worth doing.

Tree-SHA512: e83f9ebf2998f8164d1b2eebe5e6dcdeadea8c30b7612861f830758c08bf4093cd6a67b3bcfa9cfcb139e5e0b106fc8898a975fc69f334981aefc756568ab613
2017-07-15 14:02:05 -07:00
Pieter Wuille c5904e8714
Merge #10812: [utils] Allow bitcoin-cli's -rpcconnect option to be used with square brackets
5c643241e [utils] allow square brackets for ipv6 addresses in bitcoin-cli (John Newbery)
fe4fabaf1 [refactor] move SplitHostPort() into utilstrencodings (John Newbery)

Pull request description:

  bitcoin-cli's `-rpcconnect` can accept ipv6 addresses (as long as the libevent version is new enough), but fails to parse ipv6 with square brackets. This PR makes `bitcoin-cli` parse ipv6 in square brackets correctly.

  `bitcoin-cli -rpcconnect=[::1] <command>`

  should now be equivalent to

  `bitcoin-cli -rpcconnect=::1 <command>`

  This is useful so the `bitcoin-cli` option can now be in the same format as the `bitcoind` option.

  Doesn't include tests. I have a branch that fully tests `bitcoin-cli`, but that's queued behind several intermediate PRs.

  - first commit moves `SplitHostPort()` from libbitcoin_common into libbitcoin_util
  - second commit adds proper ipv6 parsing to bitcoin-cli

Tree-SHA512: 249d409f10360c989474283341f458cc97364a56a7d004ae6d5f13d8bffe3a51b5dc2484d42218848e2d42cd9c0b13a1b92e94ea19b209f7e91c875c208d8409
2017-07-15 13:26:49 -07:00
Dag Robole a8ae0b252a Fix resource leak 2017-07-15 21:34:52 +02:00
John Newbery 4c3b538c61 [logs] fix zapwallettxes startup logs 2017-07-15 15:31:26 -04:00
Pieter Wuille 10b22e3141
Merge #10760: Avoid dereference-of-casted-pointer
0aadc11fd Avoid dereference-of-casted-pointer (Pieter Wuille)

Pull request description:

  And prefer a static_cast to the intended reference type.

Tree-SHA512: e83b20023a4dca6029b46f7040a8a6fd54e1b42112ec0c87c3c3b567ed641de97a9e2335b57a2efb075491f641e5b977bc226a474276bea0c3c3c71d8d6ac54d
2017-07-15 12:22:50 -07:00
Pavel Janík 4d4fb33fce Rename member field according to the style guide. 2017-07-15 21:19:44 +02:00
John Newbery e7a2181b49 [wallet] fix zapwallettxes interaction with persistent mempool
zapwallettxes previously did not interact well with persistent mempool.
zapwallettxes would cause wallet transactions to be zapped, but they
would then be reloaded from the mempool on startup. This commit softsets
persistmempool to false if zapwallettxes is enabled so transactions are
actually zapped.
2017-07-15 15:15:25 -04:00
Pieter Wuille afd2fca911
Merge #10807: getbalance example covers at least 6 confirms
228987d84 getbalance example covers at least 6 confirms (Gregory Sanders)

Tree-SHA512: 328d60b007ee75d809f4d28a7d9e5537d3c1446bd30c4c2ae57c690b8e83f6287cbcd3d8c955e8ba07ab62e27f9d27497c55219ff14fd5af7759dec465673fa2
2017-07-15 11:12:24 -07:00
practicalswift e061d8d7ab Remove declaration of unused function: void UpdatedTransaction(const uint256 &) 2017-07-15 20:04:04 +02:00
practicalswift 0189d8ed19 Fix typos 2017-07-15 14:28:40 +02:00
practicalswift 6835cb0ab2 Avoid static analyzer warnings regarding uninitialized arguments
Avoid static analyzer warnings regarding "Function call argument
is a pointer to uninitialized value" in cases where we are
intentionally using such arguments.

This is achieved by using ...

`f(b.begin(), b.end())` (`std::array<char, N>`)

... instead of ...

`f(b, b + N)` (`char b[N]`)

Rationale:
* Reduce false positives by guiding static analyzers regarding our
  intentions.

Before this commit:

```
$ clang-tidy-3.5 -checks=* src/bench/base58.cpp
bench/base58.cpp:23:9: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage]
        EncodeBase58(b, b + 32);
        ^
$ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp
bench/verify_script.cpp:59:5: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage]
    key.Set(vchKey, vchKey + 32, false);
    ^
$
```

After this commit:

```
$ clang-tidy-3.5 -checks=* src/bench/base58.cpp
$ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp
$
```
2017-07-15 14:26:50 +02:00
Alex Morcos 11590d39b9 Properly bound check conf_target in wallet RPC calls 2017-07-14 23:41:40 -04:00
Alex Morcos fd29d3df29 Remove checking of mempool min fee from estimateSmartFee.
This check has been moved to the wallet logic GetMinimumFee. The rpc call to
estimatesmartfee will now no longer return a result maxed with the mempool min
fee, but automated fee calculations from the wallet will produce the same result
as before and coincontrol and sendcoins dialogs in the GUI will correctly
display the right prospective fee.

changes to policy/fees.cpp include a big whitespace indentation change.
2017-07-14 23:41:40 -04:00
Alex Morcos 2fffaa9738 Make QT fee displays use GetMinimumFee instead of estimateSmartFee
Remove helper function (CalculateEstimateType) for determining whether
estimates should be conservative or not, now that this is only called
once from GetMinimumFee and incorporate the logic directly there.
2017-07-14 23:41:37 -04:00
Alex Morcos 1983ca6cb3 Use CoinControl to pass custom fee setting from QT.
This fixes buggy behavior where we were temporarily setting and unsetting the
global payTxFee when trying to send a transaction with a custom fee from the
GUI. The previous behavior was inconsistent depending on the order of using the
RPC call settxfee and clicking various radio buttons in the sendcoinsdialog.
The new behavior is that transactions sent with the GUI will always use either
the smartfee slider value or the custom fee set on the GUI and they will not
affect the global defaults which are only for RPC and initial GUI values.
2017-07-14 23:40:33 -04:00
Alex Morcos 03ee701161 Refactor to use CoinControl in GetMinimumFee and FeeBumper
Improve parameter precedence in coin_control
2017-07-14 23:10:58 -04:00
Alex Morcos ecd81dfa3c Make CoinControl a required argument to CreateTransaction 2017-07-14 23:07:18 -04:00
Pieter Wuille 8fdd23a224
Merge #10769: [Qt] replace fee slider with a Dropdown, extend conf. targets
2aef1f182 [Qt] migrate old fee slider value to new dropbown Always round up (conservative) (Jonas Schnelli)
bc1be90e3 [Qt] replace fee slider with a Dropdown, extend conf. targets (Jonas Schnelli)

Tree-SHA512: 53796cf0b434dd3db5d4680dbeb6231a7df8f15d88187178fd4db8917cd7fc60091ce2c1589fd93668fc94bb13f989aba5b7ef3792fa95ee1f9f21a15709e2d3
2017-07-14 19:24:09 -07:00
Pieter Wuille 1c011ff430
Merge #10816: Properly forbid -salvagewallet and -zapwallettxes for multi wallet.
dd97a529a Properly forbid -salvagewallet and -zapwallettxes for multi wallet. (Alex Morcos)

Tree-SHA512: dcde8f854ae957b4d3af4bcf1b811e0b6e9b93602764f86499e46a28d304cd4ee93ba058c03f6ca74ccb60e1310c83e53b698c64d93e5503115377655b80d44d
2017-07-14 19:07:42 -07:00
Matt Corallo d40a72ccbb Clarify *(--.end()) iterator semantics in CWallet::TopUpKeyPool 2017-07-14 21:25:24 -04:00
Matt Corallo 28301b9780 Meet code style on lines changed in the previous commit 2017-07-14 21:25:24 -04:00
Matt Corallo 4a3fc35629 Track keypool entries as internal vs external in memory
This resolves a super minor performance regressions in several
keypool-handling functions
2017-07-14 21:25:21 -04:00
Pieter Wuille ec8a50b8d7
Merge #10808: Avoid some new gcc warnings in 15
c73b8be24 Explicitly initialize prevector::_union to avoid new warning (Matt Corallo)
1016dacfa Fix signed/unsigned comparison warning introduced in c8e29d7ff0. (Matt Corallo)

Tree-SHA512: d1574b0fdc9bfddc3517c382d34418b1d8ed80c81d2f6fd19378c064af8d7704fb84ef8b740ff97f7ec7609bd6de76348921fcc227e1ce97127947a0d22c7887
2017-07-14 18:07:59 -07:00
Matt Corallo c73b8be244 Explicitly initialize prevector::_union to avoid new warning
Warning from gcc 7.1 is ./prevector.h:450:25: warning:
'*((void*)(&<anonymous>)+8).prevector<28, unsigned char>::_union.prevector<28, unsigned char>::direct_or_indirect::<anonymous>.prevector<28, unsigned char>::direct_or_indirect::<unnamed struct>::indirect'
may be used uninitialized in this function [-Wmaybe-uninitialized]
2017-07-14 20:52:38 -04:00
Pieter Wuille f90603ac6d
Merge #10618: Remove confusing MAX_BLOCK_BASE_SIZE.
3babbcb48 Remove confusing MAX_BLOCK_BASE_SIZE. (Gregory Maxwell)

Tree-SHA512: 361293fc4e1e379cd5a0908ed0866a00e1c7a771bdf02fded158fca21b492a29c7a67fea0d13dc40b2a04204c89823bf1836fe5b63a17c9747751b9c845a3527
2017-07-14 17:49:48 -07:00
Pieter Wuille b7d6623c76
Merge #10819: Fix uninitialized atomic variables
465279114 Fix uninitialized atomic variables (João Barbosa)

Tree-SHA512: 5dd8924bc8743a094abdbc2464b835a0e7fd4948c102ea7c2251c6330bea5615c4459ba322a656fd6ac5f8d695b69d3709d225ddccef226cf8afc7de5e3d3019
2017-07-14 14:54:07 -07:00
Gregory Maxwell 3babbcb487 Remove confusing MAX_BLOCK_BASE_SIZE.
Some people keep thinking that MAX_BLOCK_BASE_SIZE is a separate
 size limit from the weight limit when it fact it is superfluous,
 and used in early tests before the witness data has been
 validated or just to compute worst case sizes.  The size checks
 that use it would not behave any differently consensus wise
 if they were eliminated completely.

Its correct value is not independently settable but is a function
 of the weight limit and weight formula.

This patch just eliminates it and uses the scale factor as
 required to compute the worse case constants.

It also moves the weight factor out of primitives into consensus,
 which is a more logical place for it.
2017-07-14 19:24:17 +00:00
Pieter Wuille 674848fe1c Clarify entropy source 2017-07-14 12:17:33 -07:00
Pieter Wuille 66270a416e
Merge #10557: Make check to distinguish between orphan txs and old txs more efficient.
18bacec6c Make check to distinguish between orphan txs and old txs more efficient. (Alex Morcos)

Tree-SHA512: b6b4bad89aa561975dce7b68b2fdad5623af5ebcb9c38fd6a72b5f6d0544ed441df4865591ac018f7ae0df9b5c60820cb4d9e55664f5667c9268458df70fd554
2017-07-14 11:54:50 -07:00
João Barbosa a2420ae2f1 Avoid unnecessary work in SetNetworkActive 2017-07-14 15:01:05 +01:00
Wladimir J. van der Laan db825d293b
Merge #10806: build: verify that the assembler can handle crc32 functions
d34d77a build: verify that the assembler can handle crc32 functions (Cory Fields)

Pull request description:

  Also, enable crc32 even if -msse4.2 wasn't added by us, as long as it works. This allows custom flags (such as -march=native) to work as expected.

  Addresses #10670.

Tree-SHA512: e1a41a87b078d270bc645814315b229ad9c16556a4d14fb66b27a65b28d0caf9bf324f8c1e221854992aa17f53466eece06faebbf74d59b3d4ff2e6db6c614a4
2017-07-14 09:23:59 +02:00
Pieter Wuille a9e82f6512 Use cpuid intrinsics instead of asm code 2017-07-13 16:43:05 -07:00
João Barbosa 4652791141 Fix uninitialized atomic variables 2017-07-13 23:25:56 +01:00
John Newbery 5c643241e5 [utils] allow square brackets for ipv6 addresses in bitcoin-cli
-rpcconnect can now accept ipv6 addresses with and without square
brackets.
2017-07-13 17:15:36 -04:00
Alex Morcos dd97a529ad Properly forbid -salvagewallet and -zapwallettxes for multi wallet. 2017-07-13 13:48:28 -04:00
Cory Fields d34d77a51b build: verify that the assembler can handle crc32 functions
Also, enable crc32 even if -msse4.2 wasn't added by us, as long as it works.
This allows custom flags (such as -march=native) to work as expected.
2017-07-13 12:49:05 -04:00
Jonas Schnelli 2aef1f1829
[Qt] migrate old fee slider value to new dropbown
Always round up (conservative)
2017-07-13 12:21:22 +02:00
Jonas Schnelli bc1be90e37
[Qt] replace fee slider with a Dropdown, extend conf. targets 2017-07-13 12:20:09 +02:00
Jonas Schnelli 7666250ffb
Merge #10810: missing white space in function arg
69a4339ef missing white space in function arg (Lawrence Nahum)

Pull request description:

Tree-SHA512: 94d832eca0b5429cf48c7c1d4489942b53182c5b7ad9f24264867e7631301173c23a48f7b2e8fd22ff1b3137bafacb3f9d4320f4df235668c9096aaefff7afe8
2017-07-13 09:21:14 +02:00
Pieter Wuille e4fcbf797e
Merge #10780: Simplify "!foo || (foo && bar)" as "!foo || bar"
1e3a3200a Simplify "!foo || (foo && bar)" as "!foo || bar" (practicalswift)

Tree-SHA512: d5ce6d7a9f3741e7abe8542b840268aa683e276aac7587041d32385a4c1273e20c236bec7590e27540dde72defb3f879d4695822bb7bfdb092cc20d9aefa64c1
2017-07-12 18:25:35 -07:00
Jeremy Rubin 37495e0d8d Reorder C{,Mutable}Transaction for better packing 2017-07-12 17:18:35 -07:00
Lawrence Nahum 69a4339ef5
missing white space in function arg 2017-07-13 01:36:39 +02:00
Pieter Wuille 479afa0f84
Merge #9804: Fixes subscript 0 (&var[0]) where should use (var.data()) instead.
30ac7688e Fix subscript[0] potential bugs in key.cpp (Jeremy Rubin)
4b1c0f2e2 Remove unnecessary branches in utilstrencodings string constructors. (Jeremy Rubin)
e19db7b5a Fix subscript[0] in utilstrencodings.cpp (Jeremy Rubin)
bc2e7fd98 Fix subscript[0] in streams.h (Jeremy Rubin)
4cac0d1e0 Fix subscript[0] in validation.cpp (Jeremy Rubin)
ac658e55f Fix subscript[0] in torcontrol (Jeremy Rubin)
b6856ebed Fix subscript[0] in netaddress.cpp (Jeremy Rubin)
361d95265 Fix subscript[0] in base58.cpp (Jeremy Rubin)
6896dbf16 Cleanup (safe, it was checked) subscript[0] in MurmurHash3 (and cleanup MurmurHash3 to be more clear). (Jeremy Rubin)
96f2119e6 Fix subscript[0] in compressor.cpp (Jeremy Rubin)
500710bd2 Fix 2 subscript[0] bugs in pubkey.cpp, and eliminate one extra size check (Jeremy Rubin)
e0451e3e2 Fix subscript[0] bug in net.cpp if GetGroup returns a 0-sized vector (Jeremy Rubin)

Tree-SHA512: 5b9103652cf8c615bd8f4f32b3573d291d6b67c39e0308ce00100bc6625f346e8e016b4c999f4f34f5c37ae059490a83c3b513deb21f838af785227d06e02362
2017-07-12 16:29:48 -07:00
Pieter Wuille 2a09a3891f
Merge #10714: Avoid printing incorrect block indexing time due to uninitialized variable
959dd8781 Avoid printing incorrect block indexing time due to uninitialized variable (practicalswift)

Tree-SHA512: a76e43c3ffa734ed5c7eadf363f345f268aa0e6ce775aba8f856fe3bbc82f240dc7c734c5ca3ac500a12eb41fae00623413e79f484d5acf809b6e400851d771d
2017-07-12 15:17:24 -07:00
John Newbery fe4fabaf12 [refactor] move SplitHostPort() into utilstrencodings
This moves SplitHostPort from libbitcoin_common to libbitcoin_util so it
is available to bitcoin-cli.
2017-07-12 17:06:15 -04:00
Gregory Sanders 228987d84c getbalance example covers at least 6 confirms 2017-07-12 14:40:02 -04:00
Matt Corallo 1016dacfac Fix signed/unsigned comparison warning introduced in c8e29d7ff0. 2017-07-12 14:03:42 -04:00
Chris Stewart 8276e70de1 Adding assert to avoid a memory access violation inside of PartialMerkleTree::CalcHash()
Adding comment to assert in PartialMerkleTree::CalcHash()

Adding comment on CMerkleBlock indicating it calls something that contains an assert

Removing EOL whitespace
2017-07-12 10:48:37 -05:00
Alex Morcos 0f402b9263 Fix rare edge case of paying too many fees when transaction has no change.
Due to the iterative process of selecting new coins in each loop a new fee is
calculated that needs to be met each time.  In the typical case if the most
recent iteration of the loop produced a much smaller transaction and we have now
gathered inputs with too many fees, we can just reduce the change.  However in
the case where there is no change output, it is possible to end up with a
transaction which drastically overpays fees.  This commit addresses that case,
by creating a change output if the overpayment is large enough to support it,
this is accomplished by rerunning the transaction creation loop without
selecting new coins.

Thanks to instagibbs for working on this as well
2017-07-11 12:20:41 -04:00
Alex Morcos 253cd7ec4f Only reserve key for scriptChange once in CreateTransaction
This does not affect behavior but allows us to have access to an output to
scriptChange even if we currently do not have change in the transaction.
2017-07-11 12:17:56 -04:00
Wladimir J. van der Laan b27b004532
Merge #10543: Change API to estimaterawfee
5e3b7b5 Improve error reporting for estimaterawfee (Alex Morcos)
1fafd70 Add function to report highest estimate target tracked per horizon (Alex Morcos)
9c85b91 Change API to estimaterawfee (Alex Morcos)

Tree-SHA512: e624c6e7967e9e48abe49f5818bd674e5710e571cc093029d2f90d39fdfba3c1f30e83bf89f6dce97052b59a7d9636a64642ccfb26effd149c417d0afbed0c0b
2017-07-11 15:36:56 +02:00
Wladimir J. van der Laan badd81bd31
Merge #10792: Replace MAX_OPCODE for OP_NOP10.
c8e29d7 Replace MAX_OPCODE for OP_NOP10. (Mark Friedenbach)

Tree-SHA512: f6a4129db24fe3feb044acaec3b94194cc4fa909de3d0a45a664b32f886a7d8ab997c9cb6ff0870c4aee66d8e038cf0453dbbb518316829d15e84da9882f3e69
2017-07-11 15:24:11 +02:00
Wladimir J. van der Laan 104f5f21dc
Merge #10589: More economical fee estimates for RBF and RPC options to control
f135923 Add RPC options for RBF, confirmation target, and conservative fee estimation. (Alex Morcos)
f0bf33d Change default fee estimation mode. (Alex Morcos)
e0738e3 remove default argument from estimateSmartFee (Alex Morcos)
d507c30 Introduce a fee estimate mode. (Alex Morcos)
cfaef69 remove default argument from GetMinimumFee (Alex Morcos)

Tree-SHA512: 49c3a49a6893790a7e8b4e93a48f123dd5307af26c2017800683b76b4df8fc904ba73402917878676242c7440e3e04288d0c1ff3c2c907418724efc03cedab50
2017-07-11 11:58:02 +02:00
Wladimir J. van der Laan 379aed0e53
Merge #10676: document script-based return fields for validateaddress
f2f1d0a document script-based return fields for validateaddress (Gregory Sanders)

Tree-SHA512: 3310bb82b63ef20e46dd7ebcc9e15828cc7b6767ef19ddd869eeb5e4ee5b31ee307d21a44a9c81dbfe9d031bd48219e3ee1d330fc7b343d63d5365b68639c062
2017-07-11 11:43:37 +02:00
Mark Friedenbach c8e29d7ff0 Replace MAX_OPCODE for OP_NOP10.
That OP_NOP10 is the last executable opcode is a bit of a obscure trivia, and the MAX_OPCODE constant already exists. This merely standardizes use of MAX_OPCODE over OP_NOP10 where it makes sense and is more clear.
2017-07-11 16:45:42 +09:00
Wladimir J. van der Laan 21ed30a314
Merge #10179: Give CValidationInterface Support for calling notifications on the CScheduler Thread
1f668b6 Expose if CScheduler is being serviced, assert its not in EmptyQueue (Matt Corallo)
3192975 Flush CValidationInterface callbacks prior to destruction (Matt Corallo)
08096bb Support more than one CScheduler thread for serial clients (Matt Corallo)
2fbf2db Add default arg to CScheduler to schedule() a callback now (Matt Corallo)
cda1429 Give CMainSignals a reference to the global scheduler (Matt Corallo)
3a19fed Make ValidationInterface signals-type-agnostic (Matt Corallo)
ff6a834 Use TestingSetup to DRY qt rpcnestedtests (Matt Corallo)

Tree-SHA512: fab91e34e30b080ed4d0a6d8c1214910e383c45440676e37be61d0bde6ae98d61e8903d22b846e95ba4e73a6ce788798350266feba246d8a2ab357e8523e4ac5
2017-07-11 09:38:51 +02:00
Matt Corallo 1f668b6468 Expose if CScheduler is being serviced, assert its not in EmptyQueue 2017-07-10 21:08:19 -04:00
Alex Morcos 5e3b7b5686 Improve error reporting for estimaterawfee 2017-07-10 20:07:17 -04:00
Alex Morcos 1fafd704da Add function to report highest estimate target tracked per horizon 2017-07-10 20:07:17 -04:00
Alex Morcos 9c85b91dc1 Change API to estimaterawfee
Report results for all 3 possible time horizons instead of specifying time horizon as an argument.
2017-07-10 20:07:13 -04:00
Alex Morcos f135923ee2 Add RPC options for RBF, confirmation target, and conservative fee estimation.
Add support for setting each of these attributes on a per RPC call basis to sendtoaddress, sendmany, fundrawtransaction (already had RBF), and bumpfee (already had RBF and conf target).
2017-07-10 12:40:02 -04:00
Wladimir J. van der Laan 9edda0c5f5
Merge #10747: [rpc] fix verbose argument for getblock in bitcoin-cli
58e9864 [rpc] fix verbose argument for getblock in bitcoin-cli (John Newbery)

Tree-SHA512: 7f176e1ddd9f3f7722ea0d268549629567ecf0c30bebf368824997566df0bfa01d31cf761abc9ca355e48c0bf0cb06d49d15a02b858999fcb7472dc7df2fbbf2
2017-07-10 17:50:21 +02:00
practicalswift 1e3a3200af Simplify "!foo || (foo && bar)" as "!foo || bar" 2017-07-09 13:39:58 +02:00
practicalswift 49eb0916da [tests] Avoid redundant assignments. Remove unused variables. 2017-07-09 13:05:01 +02:00
Jeremy Rubin 30ac7688e3 Fix subscript[0] potential bugs in key.cpp 2017-07-08 13:37:06 -07:00
Jeremy Rubin 4b1c0f2e2e Remove unnecessary branches in utilstrencodings string constructors. 2017-07-08 13:33:01 -07:00
Jeremy Rubin e19db7b5ad Fix subscript[0] in utilstrencodings.cpp 2017-07-08 13:33:01 -07:00
Jeremy Rubin bc2e7fd984 Fix subscript[0] in streams.h 2017-07-08 13:33:01 -07:00
Jeremy Rubin 4cac0d1e04 Fix subscript[0] in validation.cpp 2017-07-08 13:33:01 -07:00
Jeremy Rubin ac658e55ff Fix subscript[0] in torcontrol 2017-07-08 13:33:01 -07:00
Jeremy Rubin b6856ebedc Fix subscript[0] in netaddress.cpp 2017-07-08 13:33:01 -07:00
Jeremy Rubin 361d95265a Fix subscript[0] in base58.cpp 2017-07-08 13:33:01 -07:00
Jeremy Rubin 6896dbf169 Cleanup (safe, it was checked) subscript[0] in MurmurHash3 (and cleanup MurmurHash3 to be more clear). 2017-07-08 13:33:01 -07:00
Jeremy Rubin 96f2119e6c Fix subscript[0] in compressor.cpp 2017-07-08 13:33:01 -07:00
Jeremy Rubin 500710bd29 Fix 2 subscript[0] bugs in pubkey.cpp, and eliminate one extra size check 2017-07-08 13:31:47 -07:00
Jeremy Rubin e0451e3e2a Fix subscript[0] bug in net.cpp if GetGroup returns a 0-sized vector 2017-07-08 13:31:47 -07:00
romanornr d9d1bd3267
nCheckDepth chain height fix 2017-07-08 19:49:11 +02:00
Pavel Janík 5618b7d1ad Do not shadow upper local variable state. 2017-07-08 09:30:35 +02:00
Pieter Wuille 0aadc11fd8 Avoid dereference-of-casted-pointer 2017-07-07 10:45:31 -07:00
Matt Corallo 3192975f1d Flush CValidationInterface callbacks prior to destruction
Note that the CScheduler thread cant be running at this point,
it has already been stopped with the rest of the init threadgroup.
Thus, just calling any remaining loose callbacks during Shutdown()
is sane.
2017-07-07 12:55:57 -04:00
Matt Corallo 08096bbbc6 Support more than one CScheduler thread for serial clients
This will be used by CValidationInterface soon.

This requires a bit of work as we need to ensure that most of our
callbacks happen in-order (to avoid synchronization issues in
wallet) - we keep our own internal queue and push things onto it,
scheduling a queue-draining function immediately upon new
callbacks.
2017-07-07 11:33:18 -04:00
Matt Corallo 2fbf2dbe15 Add default arg to CScheduler to schedule() a callback now 2017-07-07 11:33:18 -04:00
Matt Corallo cda1429d5b Give CMainSignals a reference to the global scheduler
...so that it can run some signals in the background later
2017-07-07 11:33:18 -04:00
MarcoFalke ed88e3194c
Merge #10744: Use method name via __func__ macro
9bbf600 Use method name from __func__ macro (darksh1ne)

Tree-SHA512: da6d0714f458b538189bbc2b53252ba353dcc1ef15fa780cb7f690a034b58ab0dbaa3a89f83f044c746241ee265a70fc092449f1cc7be4f190775423fbca5fc5
2017-07-07 13:13:45 +02:00
Alex Morcos f0bf33da83 Change default fee estimation mode.
Fee estimates will default to be non-conservative if the transaction in question is opt-in-RBF.
2017-07-06 22:20:23 -04:00
Alex Morcos e0738e3d31 remove default argument from estimateSmartFee 2017-07-06 22:20:23 -04:00
Alex Morcos d507c301bc Introduce a fee estimate mode.
GetMinimumFee now passes the conservative argument into estimateSmartFee.
Call CalculateEstimateType(mode) before calling GetMinimumFee or estimateSmartFee to determine the value of this argument.
CCoinControl can now be used to control this mode.
2017-07-06 22:20:23 -04:00
Alex Morcos cfaef69ace remove default argument from GetMinimumFee 2017-07-06 22:20:23 -04:00
Wladimir J. van der Laan 5af6572534
Merge #10698: Be consistent in calling transactions "replaceable" for Opt-In RBF
73c942e Use "replaceable" instead of "rbfoptin" in bitcoin-tx. (Matt Corallo)
fb915d5 Use "replaceable" instead of "optIntoRbf" in fundrawtransaction. (Matt Corallo)
928c681 Use "replaceable" instead of "optintorbf" in createrawtransaction. (Matt Corallo)

Tree-SHA512: 8922451c00abb63aaa08b4a9e314e89c22233b32f207259fbc25367f7d5b67efbaccc7e2a4958c18611ad498da302296242860c7be965a0e996dcde3e89efa07
2017-07-06 20:37:40 +02:00
Wladimir J. van der Laan 30bc0f6726
Merge #10710: REST/RPC example update
b8bb425 REST/RPC example update (Michael Rotarius)

Tree-SHA512: 3a7003f5996f58d9881e7b7a9155f8b1c233faea2977cd02c481567b60fa47105433184da3d887ef3ec28775ad33719b779bff2753d64b775b29d8a7a6214fda
2017-07-06 18:17:51 +02:00
Wladimir J. van der Laan 191d12b073
qt: First translations update for 0.15 2017-07-06 09:43:05 +02:00
Kyuntae Ethan Kim 581c41157d Properly comment about shutdown process in init.cpp file 2017-07-06 13:36:11 +09:00
Matt Corallo 73c942ecd3 Use "replaceable" instead of "rbfoptin" in bitcoin-tx.
To be consistent with RPC naming
2017-07-05 18:11:22 -04:00
Matt Corallo fb915d5b18 Use "replaceable" instead of "optIntoRbf" in fundrawtransaction.
To be consistent with other RPCs
2017-07-05 18:11:22 -04:00
Matt Corallo 928c6811f2 Use "replaceable" instead of "optintorbf" in createrawtransaction.
To be consistent with other places (and add the missing named
args entry for it).
2017-07-05 18:11:19 -04:00
John Newbery 58e9864083 [rpc] fix verbose argument for getblock in bitcoin-cli 2017-07-05 12:09:58 +01:00
darksh1ne 9bbf60047e Use method name from __func__ macro
Use __func__ macro in std::runtime_exception to:
1. fix method name in CWalletTx::GetAvailableWatchOnlyCredit()
2. refactor CWalletTx::GetAvailableCredit()
2017-07-04 22:22:53 +03:00
Wladimir J. van der Laan 6dbcc74a0e
Merge #10193: scripted-diff: Remove #include <boost/foreach.hpp>
b1268a1 clang-format: Delete ForEachMacros (Jorge Timón)
5995735 scripted-diff: Remove #include <boost/foreach.hpp> (Jorge Timón)
3eff827 scripted-diff: Remove BOOST_REVERSE_FOREACH (Jorge Timón)
33aed5b Fix const_reverse_iterator constructor (pass const ptr) (Jorge Timón)
300851e Introduce src/reverse_iterator.hpp and include it... (Jorge Timón)

Tree-SHA512: df3405328e9602d0a433ac134ba59a5c9a6202ef64188df2f94a59b2ce58dec7c988b25d0671c7937de516a96b2e6daeb9d04c82fa363b616ee4cf6e9cb0fac6
2017-07-04 18:05:18 +02:00
Matt Corallo 3a19fed9db Make ValidationInterface signals-type-agnostic
(by hiding boost::signals stuff in the .cpp)

This allows us to give it a bit more intelligence as we move
forward, including routing some signals through CScheduler. While
the introduction of a "internals" pointer in the class is pretty
ugly, the fact that we no longer need to include boost/signals
directly from validationinterface.h is very much worth the loss.
2017-07-03 20:54:36 -04:00
Matt Corallo ff6a834fc3 Use TestingSetup to DRY qt rpcnestedtests 2017-07-03 20:52:25 -04:00
Jonas Schnelli 7397af9d31
Merge #10728: fix typo in help text for removeprunedfunds
ecb4fc382 fix typo in help text for removeprunedfunds (Akio Nakamura)

Tree-SHA512: 2603851f1ac90bc0b90ced6355b0056e4cb658303cb2cd03ee0827ed0053157ebb87de48076f4d4f556991bfdbdb65d0a68a8dbd275c501cee4c9b5746a9562b
2017-07-03 14:20:42 +02:00
Wladimir J. van der Laan d81bec7666
Merge #10683: rpc: Move the generate RPC call to rpcwallet
2a96283 rpc: Update `generate` for developer notes (Wladimir J. van der Laan)
df7e2f0 rpc: Move the `generate` RPC call to rpcwallet (Wladimir J. van der Laan)

Tree-SHA512: ec658d6178f8435dc54b9d9c6dd59f873055a8ae0c3f177c02049d77b93107dd5fc17a1ff56d50f051810d52fdf306846eaba2ef4fc8d2a6cfa831f57a1045c4
2017-07-03 13:59:50 +02:00
Akio Nakamura ecb4fc382b fix typo in help text for removeprunedfunds 2017-07-03 16:29:13 +09:00
practicalswift 959dd8781e Avoid printing incorrect block indexing time due to uninitialized variable
Fixes:

init.cpp: In function ‘bool AppInitMain(boost::thread_group&, CScheduler&)’:
init.cpp:1499:56: warning: ‘nStart’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart);
                                                        ^
2017-07-02 22:00:27 +02:00
Gregory Sanders f2f1d0a83e document script-based return fields for validateaddress 2017-06-30 08:43:23 -04:00
Michael Rotarius b8bb4257fe REST/RPC example update 2017-06-30 13:21:08 +02:00
Wladimir J. van der Laan 2935b469ae
Merge #10192: Cache full script execution results in addition to signatures
e3f9c05 Add CheckInputs() unit tests (Suhas Daftuar)
a3543af Better document CheckInputs parameter meanings (Matt Corallo)
309ee1a Update -maxsigcachesize doc clarify init logprints for it (Matt Corallo)
b014668 Add CheckInputs wrapper CCoinsViewMemPool -> non-consensus-critical (Matt Corallo)
eada04e Do not print soft-fork-script warning with -promiscuousmempool (Matt Corallo)
b5fea8d Cache full script execution results in addition to signatures (Matt Corallo)
6d22b2b Pull script verify flags calculation out of ConnectBlock (Matt Corallo)

Tree-SHA512: 0c6c3c79c64fcb21e17ab60290c5c96d4fac11624c49f841a4201eec21cb480314c52a07d1e3abd4f9c764785cc57bfd178511f495aa0469addb204e96214fe4
2017-06-29 20:19:21 +02:00
Wladimir J. van der Laan 0c3542e5de
Merge #10660: Allow to cancel the txdb upgrade via splashscreen keypress 'q'
542ce6e Report [CANCELLED] instead of [DONE] when shut down during txdb upgrade (Jonas Schnelli)
83fbea3 Report txdb upgrade not more often then every 10% (Jonas Schnelli)
06c5b6e Show txdb upgrade progress in debug log (Jonas Schnelli)
316fcb5 Allow to cancel the txdb upgrade via splashscreen callback (Jonas Schnelli)
ae09d45 Allow to shut down during txdb upgrade (Jonas Schnelli)
00cb69b [Qt] allow to execute a callback during splashscreen progress (Jonas Schnelli)

Tree-SHA512: 23190f23f441bfd60821e49f8b3698a6bef97eb0e0ee659328e4a7395769ecd1616420eacc38aa1fa0ff62b9de5f13a0098dc798cdec6bff649575cefebc0db2
2017-06-29 19:55:21 +02:00
Jonas Schnelli 542ce6e246
Report [CANCELLED] instead of [DONE] when shut down during txdb upgrade 2017-06-29 17:48:13 +02:00
Jonas Schnelli 83fbea3f25
Report txdb upgrade not more often then every 10% 2017-06-29 17:48:13 +02:00
Jonas Schnelli 06c5b6edd3
Show txdb upgrade progress in debug log 2017-06-29 17:48:12 +02:00
Jonas Schnelli 316fcb5106
Allow to cancel the txdb upgrade via splashscreen callback 2017-06-29 17:48:12 +02:00
Jonas Schnelli ae09d4583b
Allow to shut down during txdb upgrade 2017-06-29 17:48:11 +02:00
Jonas Schnelli 00cb69bc86
[Qt] allow to execute a callback during splashscreen progress 2017-06-29 17:48:08 +02:00
Wladimir J. van der Laan 4c72cc33eb
Merge #10673: [qt] Avoid potential null pointer dereference in TransactionView::exportClicked()
fd9599b [qt] Avoid potential null pointer dereference in TransactionView::exportClicked() (practicalswift)

Tree-SHA512: 33cbb65bd86aceb58918eb0a19e1727599a22285e7c89d4e7d3b2639c879dc8939708fd506006c6c092f624050d1131f997cc37f837cb980aa440f8abe5a3c18
2017-06-29 15:03:15 +02:00
Wladimir J. van der Laan 2a962834fe rpc: Update generate for developer notes
Fix nits by John Newbery.
2017-06-29 12:02:44 +02:00
Wladimir J. van der Laan df7e2f057b rpc: Move the generate RPC call to rpcwallet
This makes it possible to mine to any wallet when multi-wallet mode is added.
Solves the same problem as #10649, but IMO in a cleaner way.

It also gets rid of the circuitous `ScriptForMining` method on
`CValidationInterface`, which really doesn't belong there.

After this change it's still possible to mine without wallet through
`generatetoaddress`.
2017-06-29 12:02:43 +02:00
Pieter Wuille 90a002ea64
Merge #10558: Address nits from per-utxo change
21d4afa12 Comment clarifications in coins.cpp (Alex Morcos)
3c8a9aeff Add belt-and-suspenders in DisconnectBlock (Alex Morcos)

Tree-SHA512: d83e12ed71674faaaaebc03ffa1e2276984c35a29db419268ac9e14a45b33ccab716e3606dff8cfe1dcee4bec6e4794d2ca90341f10d5684be80e3fee61addf8
2017-06-28 11:44:22 -07:00
Pieter Wuille 30c21306c1
Merge #10685: Clarify CCoinsViewMemPool documentation.
381b8fc36 Clarify CCoinsViewMemPool documentation. (Matt Corallo)

Tree-SHA512: 0d1520595a03ea4038b4119871d79dfc28a50f42ac7667b30a583805d4fe4b0480a6912b9b4f7660c7223778ef85f2f9d1870551383a35c5e8c88cd2935f59d3
2017-06-28 11:22:00 -07:00
Wladimir J. van der Laan d4e551adfe
Merge #10148: Use non-atomic flushing with block replay
176c021 [qa] Test non-atomic chainstate writes (Suhas Daftuar)
d6af06d Dont create pcoinsTip until after ReplayBlocks. (Matt Corallo)
eaca1b7 Random db flush crash simulator (Pieter Wuille)
0580ee0 Adapt memory usage estimation for flushing (Pieter Wuille)
013a56a Non-atomic flushing using the blockchain as replay journal (Pieter Wuille)
b3a279c [MOVEONLY] Move LastCommonAncestor to chain (Pieter Wuille)

Tree-SHA512: 47ccc62303f9075c44d2a914be75bd6969ff881a857a2ff1227f05ec7def6f4c71c46680c5a28cb150c814999526797dc05cf2701fde1369c06169f46eccddee
2017-06-28 18:26:41 +02:00
Wladimir J. van der Laan 9a941a1010
Merge #10631: Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class
aa95947 Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class (practicalswift)

Tree-SHA512: 3835e9b4ceaa4b2db485a25dfa3e5fe50c2e3ecb22ca9d5331aed7728aa496d4378fb84c0a1a3c47b0adecc10a00bca99cc239cbaf94cf2ce5b4cda497db6023
2017-06-28 15:05:23 +02:00
practicalswift aa95947ded Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class 2017-06-28 02:12:06 +02:00
Alex Morcos 21d4afa12f Comment clarifications in coins.cpp 2017-06-27 16:08:06 -04:00
Suhas Daftuar e3f9c05b96 Add CheckInputs() unit tests
Check that cached script execution results are only valid for the same
script flags; that script execution checks are returned for non-cached
transactions; and that cached results are only valid for transactions
with the same witness hash.
2017-06-27 16:05:04 -04:00
Alex Morcos 3c8a9aefff Add belt-and-suspenders in DisconnectBlock
These extra variables were previously checked before the move to per-txout database.
2017-06-27 15:04:56 -04:00
Matt Corallo 381b8fc365 Clarify CCoinsViewMemPool documentation.
Thanks to @sdaftuar for correcting my misunderstanding.
2017-06-27 14:47:07 -04:00
Alex Morcos 18bacec6c2 Make check to distinguish between orphan txs and old txs more efficient.
Checking for the existence in the CCoinsViewCache of the outputs of a new tx
will result in a disk hit for every output since they will not be found.  On the
other hand if those outputs exist already, then the inputs must also have been
missing, so we can move this check inside the input existence check so in the
common case of a new tx it doesn't need to run.

The purpose of the check is to avoid spamming the orphanMap with slightly old
txs which we have already seen in a block, but it is already only optimistic
(depending on the outputs not being spent), so make it even more efficient by
only checking the cache and not the entire pcoinsTip.
2017-06-27 14:14:15 -04:00
Alex Morcos 22378adbe5 Remove no longer used mempool.exists(outpoint) 2017-06-27 14:10:03 -04:00
esneider ca67ddf0b7 Move the AreInputsStandard documentation next to its implementation 2017-06-27 11:41:34 -03:00
Wladimir J. van der Laan ac52492cd2
Merge #10118: Util: Remove redundant calls to argsGlobal.IsArgSet()
ed866ab Indentation after 'Remove redundant calls to gArgs.IsArgSet()' (Jorge Timón)
506b700 Util: Remove redundant calls to gArgs.IsArgSet() (Jorge Timón)

Tree-SHA512: 4f97a0bf2a76c0f351a6343db62898cf057d745c848de00fa09465e870a120f28e0d836cafd6a047f4ec0da7ab671aebee43fa7410c9f0e66382edd1bb2009ba
2017-06-27 16:29:11 +02:00
practicalswift fd9599b135 [qt] Avoid potential null pointer dereference in TransactionView::exportClicked() 2017-06-27 15:06:39 +02:00
Wladimir J. van der Laan 1680ee0edf
Merge #10400: [RPC] Add an uptime command that displays the amount of time (in seconds) bitcoind has been running
c074752 [RPC] Add an uptime command that displays the amount of time that bitcoind has been running (Ricardo Velhote)

Tree-SHA512: 8f59d4205042885f23f5b87a0eae0f5d386e9c6134e5324598e7ee304728d4275f383cd154bf1fb25350f5a88cc0ed9f97edb099e9b50c4a0ba72d63ec5ca5b4
2017-06-27 11:34:15 +02:00
Jorge Timón ed866ab923
Indentation after 'Remove redundant calls to gArgs.IsArgSet()' 2017-06-27 07:39:52 +02:00
Jorge Timón 506b700dcb
Util: Remove redundant calls to gArgs.IsArgSet()
Return empty std::vector<std::string> with ArgsManager::GetArgs if
nothing is set for that string
2017-06-27 02:54:19 +02:00
Pieter Wuille 21180ff734 Simplify return values of GetCoin/HaveCoin(InCache)
This removes the possibility for GetCoin/HaveCoin/HaveCoinInCache to return
true while the respective coin is spent. By doing it across all calls, some
extra checks can be eliminated.

coins_tests is modified to call HaveCoin sometimes before and sometimes
after AccessCoin. A further change is needed because the semantics for
GetCoin slightly changed, causing a pruned entry in the parent cache to not
be pulled into the child in FetchCoin.
2017-06-26 16:16:26 -07:00
Suhas Daftuar 176c021d08 [qa] Test non-atomic chainstate writes
Adds new functional test, dbcrash.py, which uses -dbcrashratio to exercise the
logic for recovering from a crash during chainstate flush.

dbcrash.py is added to the extended tests, as it may take ~10 minutes to run

Use _Exit() instead of exit() for crash simulation

This eliminates stderr output such as:
    terminate called without an active exception
or
    Assertion failed: (!pthread_mutex_destroy(&m)), function ~recursive_mutex, file /usr/local/include/boost/thread/pthread/recursive_mutex.hpp, line 104.

Eliminating the stderr output on crash simulation allows testing with
test_runner.py, which reports a test as failed if stderr is produced.
2017-06-26 14:48:42 -07:00
Matt Corallo d6af06d68a Dont create pcoinsTip until after ReplayBlocks.
This requires that we not access pcoinsTip in InitBlockIndex's
FlushStateToDisk (so we just skip it until later in AppInitMain)
and the LoadChainTip in LoadBlockIndex (which there is already one
later in AppinitMain, after ReplayBlocks, so skipping it there is
fine).

Includes some simplifications by Suhas Daftuar and Pieter Wuille.
2017-06-26 10:46:51 -07:00
Pieter Wuille eaca1b7b08 Random db flush crash simulator 2017-06-26 10:46:51 -07:00
Pieter Wuille 0580ee08ff Adapt memory usage estimation for flushing 2017-06-26 10:45:48 -07:00
Pieter Wuille 013a56aa1a Non-atomic flushing using the blockchain as replay journal 2017-06-26 10:45:48 -07:00
Pieter Wuille b3a279cd58 [MOVEONLY] Move LastCommonAncestor to chain 2017-06-26 10:45:48 -07:00
Wladimir J. van der Laan 234ffc677e
Merge #10559: Change semantics of HaveCoinInCache to match HaveCoin
5257698 Change semantics of HaveCoinInCache to match HaveCoin (Alex Morcos)

Tree-SHA512: 397e9ba28646b81fffa53e55064735d4d242aaffdf8484506825f785b0e414f334e4c5cd1e4e1dd9a4b6d1f6954c7ecad15429934a1c4e8d39f596cbd9f5dd80
2017-06-26 17:11:15 +02:00
Wladimir J. van der Laan 22a0aca329
Merge #10496: Add Binds, WhiteBinds, Whitelistedrange to CConnman::Options
07b2afe add Binds, WhiteBinds to CConnman::Options (Marko Bencun)
ce79f32 add WhitelistedRange to CConnman::Options (Marko Bencun)

Tree-SHA512: c23a6f317c955338af531fa3e53e3c42e995f88c6e1939bbc2ad119fa5b786c54b3dad3d2e9b3f830b7292c0c63a02fcff66a89907d0fa8d7c83aefade01af45
2017-06-26 15:04:54 +02:00
Wladimir J. van der Laan f3f1e2e7d3
Merge #9544: [trivial] Add end of namespace comments. Improve consistency.
5a9b508 [trivial] Add end of namespace comments (practicalswift)

Tree-SHA512: 92b0fcae4d1d3f4da9e97569ae84ef2d6e09625a5815cd0e5f0eb6dd2ecba9852fa85c184c5ae9de5117050330ce995e9867b451fa8cd5512169025990541a2b
2017-06-26 13:40:26 +02:00
Ricardo Velhote c07475294a
[RPC] Add an uptime command that displays the amount of time that bitcoind has been running 2017-06-25 20:25:45 +01:00
Wladimir J. van der Laan d609fd85ca
Merge #9176: Globals: Pass Consensus::Params through CBlockTreeDB::LoadBlockIndexGuts()
b324b28 Globals: Pass Consensus::Params through CBlockTreeDB::LoadBlockIndexGuts() (Jorge Timón)

Tree-SHA512: 9ef561a026960dc69df52603f4d60246c913bdd127465e8238f0954c6bbbc6b8b3b039bab70df38be1cbf5d06788fb631a2236b49c0167633d54366103c7c055
2017-06-25 10:26:01 +02:00
Wladimir J. van der Laan bef02fb6ac
Merge #10412: Improve wallet rescan API
deaf48b Handle TIMESTAMP_WINDOW within CWallet::RescanFromTime (Russell Yanofsky)
5b2be2b Make CWallet::RescanFromTime comment less ambiguous (Russell Yanofsky)
9bb66ab Add RescanFromTime method and use from rpcdump (Russell Yanofsky)
ccf84bb Move birthday optimization out of ScanForWalletTransactions (Russell Yanofsky)

Tree-SHA512: cd38433b8f5c5e44ecfba830a6a26bd9a9d0f4a22ae42bce17773d1a6fb25e1ee4289484996dad2d7acfa03059917ff062459f25030a761da7083ba5fbc87bc9
2017-06-24 16:37:42 +02:00
Wladimir J. van der Laan eee398fa12
Merge #10608: Add a comment explaining the use of MAX_BLOCK_BASE_SIZE.
1887337 Add a comment explaining the use of MAX_BLOCK_BASE_SIZE. (Gregory Maxwell)

Tree-SHA512: 4c643a3696241fbf4eac8d58bb26586f319338b28ee86d20394a8ea362911b467853eb40c43487ede753209a3c7bee2e576d2ca80627e9fc924fabefbcaea34b
2017-06-24 15:45:14 +02:00
Wladimir J. van der Laan b62b4c873e
Merge #10627: fixed listunspent rpc convert parameter
e503b2b fixed listunspent rpc convert parameter (tnaka)

Tree-SHA512: 6da1cee8fd8459187825fad47678b36bbf6b4582f03f557c8a48c2c4273d9e12405e8bb6ade02a06e6555419eefb1dc298d4d4781ebb3b6b72743ca6108cb18e
2017-06-24 15:39:43 +02:00
Wladimir J. van der Laan 00350bd6db
Merge #10191: [trivial] Rename unused RPC arguments 'dummy'
0ef7de9 [RPCs] Remove submitblock parameters argument help text (John Newbery)

Tree-SHA512: f39ad4bb3006e3d722fa51ae2ab4a48726e740993d6bed5737b355d1e0a99cf475ca9519f97adf8cde1b7187b14a24d5951ce4f34624d01d9ef84b49124c2894
2017-06-24 15:15:18 +02:00
Wladimir J. van der Laan 2772dc9f21
Merge #10446: net: avoid extra dns query per seed
c1be285 chainparams: make supported service bits option explicit (Cory Fields)
d5c7c1c net: use an internal address for fixed seeds (Cory Fields)
6cdc488 net: switch to dummy internal ip for dns seed source (Cory Fields)
6d0bd5b net: do not allow resolving to an internal address (Cory Fields)
7f31762 net: add an internal subnet for representing unresolved hostnames (Cory Fields)

Tree-SHA512: 9bf1042bef546ac3ef0e0d3a9a5555eb21628ff2674a0cf8c6367194b22bfdab477adf452c0e7c56f44e0fb37debc5e14bdb623452e076fb9c492c7702601d7a
2017-06-24 12:25:13 +02:00
Wladimir J. van der Laan 232508fe0f
Merge #10577: Add an explanation of quickly hashing onto a non-power of two range.
dd869c6 Add an explanation of quickly hashing onto a non-power of two range. (Gregory Maxwell)

Tree-SHA512: 8b362e396206a4ee2e825908dcff6fe4525c12b9c85a6e6ed809d75f03d42edcfba5e460a002e5d17cc70c103792f84d99693563b638057e4e97946dd1d800b2
2017-06-24 11:28:04 +02:00
MarcoFalke e0a7801223
Merge #10662: Initialize randomness in benchmarks
5155d11 Initialize randomness in benchmarks (Andrew Chow)

Tree-SHA512: 235006eb161893e1a84d5b2747cbaf7c82ced179ab2b9df30197b4cb2d3c4f31e47fa5b9cf62aced0fe244da47f3a38fbbe91fe86b0a90f1d86604da5d806fb1
2017-06-24 10:19:44 +02:00
Wladimir J. van der Laan 8c841a31a9
Merge #10626: doc: Remove outdated minrelaytxfee comment
fab9b60 doc: Remove outdated minrelaytxfee comment (MarcoFalke)

Tree-SHA512: e36c5a554a9773f034c2d358c52a772688009a5a71dfd3f664d9b5566c98378f44ef7c6dc0902b42d69ab5fd54b60d4850a2903823d0b2309c7ae063d1923f7f
2017-06-24 10:16:32 +02:00
Andrew Chow 5155d1101e Initialize randomness in benchmarks
Call RandomInit() in bench_bitcoin to initialize the RNG so that it
does not cause an assertion error.
2017-06-23 14:21:10 -07:00
Russell Yanofsky deaf48b046 Handle TIMESTAMP_WINDOW within CWallet::RescanFromTime
This way CWallet::RescanFromTime callers don't need to subtract
TIMESTAMP_WINDOW themselves.

This is pure refactoring, there is no change in behavior.
2017-06-22 17:16:24 -04:00
Russell Yanofsky 5b2be2b787 Make CWallet::RescanFromTime comment less ambiguous 2017-06-22 17:14:40 -04:00
Cory Fields c1be285364 chainparams: make supported service bits option explicit 2017-06-22 15:21:22 -04:00
Cory Fields d5c7c1cfe3 net: use an internal address for fixed seeds 2017-06-22 15:21:22 -04:00
Wladimir J. van der Laan 8c2098ad12
Merge #10565: [coverage] Remove subtrees and benchmarks from coverage report
d5711f4 Filter subtrees and and benchmarks from coverage report (Andrew Chow)
405b86a Replace lcov -r commands with faster way (Andrew Chow)
c8914b9 Have `make cov` optionally include branch coverage statistics (Andrew Chow)

Tree-SHA512: 9c349a7baeb7430ea586617c52f91177df58e3546d6dc573e26815ddb79e30ab1873542d85ac1daca5e1fb2c6d6c8965824b42d027b6b0496a744af57b095852
2017-06-22 20:57:11 +02:00
Wladimir J. van der Laan 6bef7ca8bc
Merge #10633: doc: Fix various typos
0a5a6b9 Fixed multiple typos (Dimitris Tsapakidis)

Tree-SHA512: 57748710bcbc03945b160db5e95bd686a2c64605f25d5e11d8ed9d0e1be3b3bf287a63588dc6eb33d0cef4ff17c765fda7c226d667a357acc539c8fcf2b9bb7e
2017-06-22 20:46:37 +02:00
Wladimir J. van der Laan 01c4b143a8
Merge #10248: Rewrite addrdb with less duplication using CHashVerifier
cf68a48 Deduplicate addrdb.cpp and use CHashWriter/Verifier (Pieter Wuille)

Tree-SHA512: 0301332e797f64da3a1588c9ebaf533af58da41e38f8a64206bff20102c5e82c2a7c630ca3150cf451b2ccf4acb3dd45e44259b6ba15e92786e9e9a2b225bd2f
2017-06-22 19:54:22 +02:00
Wladimir J. van der Laan ffce893982
Merge #9517: [refactor] Switched httpserver.cpp to use RAII wrapped libevents.
1ae86ec Changed event RAII helper functions to inline to deal with duplicate symbol linker errors. (Karl-Johan Alm)
fd369d2 Switched httpserver.cpp to use RAII wrapped libevents. (Kalle Alm)

Tree-SHA512: 877e431f211024d42a3b0800e860e02833398611433e8393f8d5d4970f47f4bd670b900443678c067fec110c087aaab7dc1981ccbf17f6057676fdbbda89aed9
2017-06-22 19:16:37 +02:00
Wladimir J. van der Laan 209eef60a9
Merge #9343: Don't create change at dust limit
6171826 Don't create change at the dust limit, even if it means paying more than expected (Alex Morcos)

Tree-SHA512: d4cf939b97a92d63d4703ad152093c9dc60e74af590697bc21adbcdf17fc9e6ffb37d46d5eefafbd69327d1bcb79911f1b826ce1d960d895d464c4408c4995c3
2017-06-22 18:23:11 +02:00
Matt Corallo a3543af3cc Better document CheckInputs parameter meanings 2017-06-22 12:21:09 -04:00
Matt Corallo 309ee1ae7b Update -maxsigcachesize doc clarify init logprints for it 2017-06-22 12:21:09 -04:00
Matt Corallo b014668e27 Add CheckInputs wrapper CCoinsViewMemPool -> non-consensus-critical
This wraps CheckInputs in ATMP's cache-inputs call to check that
each scriptPubKey the CCoinsViewCache provides is the one which
was committed to by the input's transaction hash.
2017-06-22 12:21:09 -04:00
Dimitris Tsapakidis 0a5a6b90bc Fixed multiple typos
A few "a->an" and "an->a".
"Shows, if the supplied default SOCKS5 proxy" -> "Shows if the supplied default SOCKS5 proxy". Change made on 3 occurrences.
"without fully understanding the ramification of a command" -> "without fully understanding the ramifications of a command".
Removed duplicate words such as "the the".
2017-06-22 19:18:10 +03:00
Wladimir J. van der Laan 87e69c2549
Merge #10530: Fix invalid instantiation and possibly unsafe accesses of array in class base_uint<BITS>
e5c6168 Fix instantiation and array accesses in class base_uint<BITS> (Pavlos Antoniou)

Tree-SHA512: e4d39510d776c5ae8814cd5fb5c5d183cd8da937e339bff95caff68a84492fbec68bf513c5a6267446a564d39093e0c7fc703c645b511caab80f7baf7955b804
2017-06-22 17:16:44 +02:00
Jorge Timón b1268a19d0
clang-format: Delete ForEachMacros 2017-06-22 03:48:54 +02:00
Jorge Timón 5995735c5b
scripted-diff: Remove #include <boost/foreach.hpp>
-BEGIN VERIFY SCRIPT-
sed -i ':a;N;$!ba;s/#include <boost\/foreach.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp
-END VERIFY SCRIPT-
2017-06-22 03:48:52 +02:00
Jorge Timón 3eff827f89
scripted-diff: Remove BOOST_REVERSE_FOREACH
-BEGIN VERIFY SCRIPT-
sed -i 's/BOOST_REVERSE_FOREACH(\(.*\), \(.*\))/for (\1 : reverse_iterate(\2))/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ;
-END VERIFY SCRIPT-
2017-06-22 03:48:50 +02:00
Jorge Timón 33aed5bf89
Fix const_reverse_iterator constructor (pass const ptr) 2017-06-22 03:48:49 +02:00
Jorge Timón 300851ec16
Introduce src/reverse_iterator.hpp and include it...
...where it will be needed

Taken from https://gist.github.com/arvidsson/7231973 with small
modifications to fit the bitcoin core project
2017-06-22 03:48:42 +02:00
practicalswift 700d8d85bd Remove obsolete _MSC_VER check
* MSVC++ 8.0 _MSC_VER == 1400 (Visual Studio 2005)
* C++11 is supported since MSVC 2010
* Compiling without C++11 support is no longer possible
2017-06-21 14:28:26 +02:00
Pieter Wuille b3eb0d6485
Merge #10537: Few Minor per-utxo assert-semantics re-adds and tweak
9417d7a33 Be much more agressive in AccessCoin docs. (Matt Corallo)
f58349ca8 Restore some assert semantics in sigop cost calculations (Matt Corallo)
3533fb4d3 Return a bool in SpendCoin to restore pre-per-utxo assert semantics (Matt Corallo)
ec1271f2b Remove useless mapNextTx lookup in CTxMemPool::TrimToSize. (Matt Corallo)

Tree-SHA512: 158a4bce063eac93e1d50709500a10a7cb1fb3271f10ed445d701852fce713e2bf0da3456088e530ab005f194ef4a2adf0c7cb23226b160cecb37a79561f29ca
2017-06-20 18:27:45 -07:00
Pieter Wuille efbcf2b1d5
Merge #10503: Use REJECT_DUPLICATE for already known and conflicted txn
d9bec888f Use REJECT_DUPLICATE for already known and conflicted txn (Pieter Wuille)

Tree-SHA512: adc6dc5caed731c3fd5c8784e8820a074e320360cdb5579c5b9299f9799dd99de60b7382d336ab1909dab8b23e744456d78aa0c3b1c8dd1af3d1b779314cf8fa
2017-06-20 18:00:21 -07:00
Pieter Wuille b33ca14f59
Merge #9549: [net] Avoid possibility of NULL pointer dereference in MarkBlockAsInFlight(...)
95543d874 [net] Avoid possibility of NULL pointer dereference in MarkBlockAsInFlight(...) (practicalswift)

Tree-SHA512: 80fd4f2712f20377185bd8d319255f2c54ae47b54c706f7e0d384a0a6ade1465ceb6e2a4a7f7b51987a659524474a954eddf228865ebb3fc513948b5b6d7ab6d
2017-06-20 17:02:40 -07:00
Pieter Wuille d636f3943d
Merge #10536: Remove unreachable or otherwise redundant code
4265bf351 Remove unreachable or otherwise redundant code (practicalswift)

Tree-SHA512: bc9666ab5d20c936d78c50c0361405aca9edd116602aa9bcd71a79a904b647ac9eca0651d1a9d530189a6ac1c4e235bfc69ec1a68f7e36cc14d6848ac2206b7b
2017-06-20 16:16:38 -07:00
tnaka e503b2b680 fixed listunspent rpc convert parameter 2017-06-19 11:48:57 +09:00
MarcoFalke fab9b60fbd doc: Remove outdated minrelaytxfee comment 2017-06-18 21:33:44 +02:00
MarcoFalke e053e05c13
Merge #10592: [trivial] fix indentation for ArgsManager class
7810993 [trivial] fix indentation for ArgsManager class (John Newbery)

Tree-SHA512: 3d24fa94ba49ad73383ca8077776492bd75f1c2158c835c1d55b4be4787f107c2de5336173e083a5585df21ef053614628fe4fe6ddf2c05df567177445661b7b
2017-06-18 14:07:51 +02:00
Pieter Wuille cafe24f039
Merge #10614: random: fix crash on some 64bit platforms
9af207c81 random: fix crash on some 64bit platforms (Cory Fields)

Tree-SHA512: c9516b69bec224c7e650dfc7c50f04cdd93a1006d515699bc64a311a03662d4ad33a834861194a1649ed212b37fb50aadfb004954cdf8b9bc1dc82f3ea962897
2017-06-16 17:37:49 -07:00
Pieter Wuille de8db47b7f
Merge #10587: Net: Fix resource leak in ReadBinaryFile(...)
f2fb132cb Net: Fix resource leak in ReadBinaryFile(...) (practicalswift)

Tree-SHA512: 879b9334d8bb681fa4b6f96d8ecb54e2a8948065f7be5fe7880131479c813602fc9d4a4314f043e6591e1aed50ffafa7c247362a9cdeb049b0721170e227b89a
2017-06-16 16:36:42 -07:00
Pieter Wuille d76e84a214
Merge #10602: Make clang-format use C++11 features (e.g. A<A<int>> instead of A<A<int> >)
131a8ceb7 Make clang-format use C++11 features (e.g. A<A<int>> instead of A<A<int> >) (practicalswift)

Tree-SHA512: e3c0ee683b654eae638deb41c52cf3187fa958dc5fa67778eaf8a83946b63f5b1d24c47bb965eaa910e3fcdcaf9eebf461eb3fc8e3a73ebaf03c7904521fda00
2017-06-16 15:03:00 -07:00
Cory Fields 9af207c810 random: fix crash on some 64bit platforms
rbx needs to be stashed in a 64bit register on 64bit platforms. With this crash
in particular, it was holding a stack canary which was not properly restored
after the cpuid.

Split out the x86+PIC case so that x86_64 doesn't have to worry about it.
2017-06-16 15:19:15 -04:00
Gregory Maxwell 18873373bd Add a comment explaining the use of MAX_BLOCK_BASE_SIZE. 2017-06-16 00:46:16 +00:00
Marko Bencun 07b2afef10 add Binds, WhiteBinds to CConnman::Options
Part of a series of changes to clean up the instantiation of connman
by decoupling the command line arguments.

We also now abort with an error when explicit binds are set with
-listen=0.
2017-06-15 23:07:14 +02:00
Marko Bencun ce79f32518 add WhitelistedRange to CConnman::Options
Part of a series of changes to clean up the instantiation of connman
by decoupling the command line arguments.
2017-06-15 23:06:12 +02:00
practicalswift 131a8ceb73 Make clang-format use C++11 features (e.g. A<A<int>> instead of A<A<int> >) 2017-06-15 17:31:58 +02:00
Pavel Janík cc0ed26753 Supress struct/class mismatch warnings introduced in #10284. 2017-06-15 14:43:44 +02:00
Wladimir J. van der Laan c2ab38bdd5
Merge #10284: Always log debug information for fee calculation in CreateTransaction
1bebfc8 Output Fee Estimation Calculations in CreateTransaction (Alex Morcos)

Tree-SHA512: e25a27f7acbbc3a666d5d85da2554c5aaec4c923ee2fdbcfc532c29c6fbdec3c9e0d6ae6044543ecc339e7bd81df09c8d228e0b53a2c5c2dae0f1098c9453272
2017-06-15 14:20:14 +02:00
Wladimir J. van der Laan 7c72fb99af
Merge #10582: Pass in smart fee slider value to coin control dialog
e9cd778 Pass in smart fee slider value to coin control dialog (Alex Morcos)

Tree-SHA512: 3899c3eb89b06e9cc842b33fabcce40a84fcc3a88ac2b02861f63419925312ac2a9f632567c02b0a060f5c5cd55f337e35e99b80535d1c1b8fcb7fd0c539f3c0
2017-06-15 12:52:26 +02:00
Cory Fields 6cdc488e36 net: switch to dummy internal ip for dns seed source
This addresss the TODO to avoid resolving twice.
2017-06-14 18:05:01 -04:00
Cory Fields 6d0bd5b73d net: do not allow resolving to an internal address
In order to prevent mixups, our internal range is never allowed as a resolve
result. This means that no user-provided string will ever be confused with an
internal address.
2017-06-14 18:05:01 -04:00
Cory Fields 7f31762cb6 net: add an internal subnet for representing unresolved hostnames
We currently do two resolves for dns seeds: one for the results, and one to
serve in addrman as the source for those addresses.

There's no requirement that the source hostname resolves to the stored
identifier, only that the mapping is unique. So rather than incurring the
second lookup, combine a private subnet with a hash of the hostname.

The resulting v6 ip is guaranteed not to be publicy routable, and has only a
negligible chance of colliding with a user's internal network (which would be
of no consequence anyway).
2017-06-14 18:05:00 -04:00
John Newbery 7810993335 [trivial] fix indentation for ArgsManager class 2017-06-14 17:13:00 -04:00
Alex Morcos 61718268b5 Don't create change at the dust limit, even if it means paying more than expected 2017-06-14 15:34:19 -04:00
John Newbery 0ef7de953f [RPCs] Remove submitblock parameters argument help text 2017-06-14 13:50:45 -04:00
practicalswift f2fb132cb0 Net: Fix resource leak in ReadBinaryFile(...)
Introduced in 0b6f40d4ca via PR #10408.
2017-06-14 17:35:37 +02:00
Alex Morcos e9cd7786da Pass in smart fee slider value to coin control dialog
Since cfe77ef41 the global nTxConfirmTarget wasn't being updated by the smart
fee slider and thus the coin control dialog and labels were not being updated.
2017-06-14 10:57:28 -04:00
Wladimir J. van der Laan 228c319a94
Merge #9895: Turn TryCreateDirectory() into TryCreateDirectories()
1d1ea9f Turn TryCreateDirectory() into TryCreateDirectories() (Marko Bencun)

Tree-SHA512: 49a524167bcf66e351a964c88d09cb3bcee12769a32da83410e3ba649fa4bcdbf0478d41e4d09bb55adb9b3f122e742271db6feb30bbafe2a7973542b5f10f79
2017-06-14 16:12:14 +02:00
Wladimir J. van der Laan c94b89e90d
Merge #9738: gettxoutproof() should return consistent result
6294f32 gettxoutproof() should return consistent result (John Newbery)

Tree-SHA512: 1c36f78ea07a3bdde09e9494207b4372d54bcd94ed2d56e339e78281f6693e26a93e4c3123453d5c0f6e994d0069d5a1c806786c4af71864f87ea4841611c379
2017-06-14 15:48:52 +02:00
Wladimir J. van der Laan b63be2c685
Merge #10377: Use rdrand as entropy source on supported platforms
cb24c85 Use rdrand as entropy source on supported platforms (Pieter Wuille)

Tree-SHA512: c42eaa01a14e6bc097c70b6bf8540d61854c2f76cb32be69c2a3c411a126f7b4bf4a4486e4493c4cc367cc689319abde0d4adb799d29a54fd3e81767ce0766fc
2017-06-14 15:22:15 +02:00
Pieter Wuille 1ad3d4e126
Merge #10502: scripted-diff: Remove BOOST_FOREACH, Q_FOREACH and PAIRTYPE
1238f13cf scripted-diff: Remove PAIRTYPE (Jorge Timón)
18dc3c396 scripted-diff: Remove Q_FOREACH (Jorge Timón)
7c00c2672 scripted-diff: Fully remove BOOST_FOREACH (Jorge Timón)
a5410ac5e Small preparations for Q_FOREACH, PAIRTYPE and #include <boost/foreach.hpp> removal (Jorge Timón)

Tree-SHA512: d3ab4a173366402e7dcef31608977b757d4aa07abbbad2ee1bcbcfa311e994a4552f24e5a55272cb22c2dcf89a4b0495e02e9d9aceae4b08c0bab668f20e324c
2017-06-13 18:05:58 -07:00
Pieter Wuille cb24c8539d Use rdrand as entropy source on supported platforms 2017-06-13 17:02:05 -07:00
Marko Bencun 1d1ea9f096 Turn TryCreateDirectory() into TryCreateDirectories()
Use case: TryCreateDirectory(GetDataDir() / "blocks" / "index") would
fail if the blocks directory was not explicitly created before.

The line that did so was in a weird location and could be removed as a
result.
2017-06-14 00:04:13 +02:00
Wladimir J. van der Laan a4fe07714d
Merge #10544: Update to LevelDB 1.20
3ee3d04 Add extra LevelDB source to Makefile (MarcoFalke)
2424989 leveldb: enable runtime-detected crc32 instructions (Cory Fields)
cf44e4c Squashed 'src/leveldb/' changes from a31c8aa40..196962ff0 (Pieter Wuille)

Tree-SHA512: 19ade77e3f6265507b3ab7b9aa5150d378aa0751e24ac7a61567b0f720a566cedc6c3d3336da17a3bd2b5d068ee86600d96a15228f78bd20ccf98c8fc9041a91
2017-06-13 19:48:13 +02:00
Alex Morcos 1bebfc8d3a Output Fee Estimation Calculations in CreateTransaction 2017-06-13 12:35:04 -04:00
Wladimir J. van der Laan a514ac3dcb
Merge #10534: Clarify prevector::erase and avoid swap-to-clear
e241a63 Clarify prevector::erase and avoid swap-to-clear (Pieter Wuille)

Tree-SHA512: fa7602038feb4417158df13ee7c0351673acf38f8a824e75889710344c46a9b8d5f6059faeb521f73e48b7ad3e1a238a9e433e4b44f7c3b9085ff08ef65271fa
2017-06-13 18:32:44 +02:00
Wladimir J. van der Laan 303c171b94
Merge #10553: Simplify "bool x = y ? true : false". Remove unused function and trailing semicolon.
67ca816 Simplify "bool x = y ? true : false" to "bool x = y" (practicalswift)
9f841a6 [tests] Remove accidental trailing semicolon (practicalswift)
30c2d9d [tests] Remove unused function InsecureRandBytes(size_t len) (practicalswift)

Tree-SHA512: ae62c255c88133cad12084b6011c105bb96b729c8103330350683d9c20020c5d7617693795df4dff6cc305f2405cb2e4e2ece182d6e6d7c3c8db82aa2f882c41
2017-06-13 11:55:11 +02:00
Pieter Wuille 8d9f45ea6a
Merge #10564: Return early in IsBanned.
bf376eacc Return early in IsBanned. (Gregory Maxwell)

Tree-SHA512: d8ed4aaf9a7523b00effa4ac17cec3be1ec1f5c5ce64d89833fbc8f3d73d13b022043354fbcf2682b2af05070d115e1fc0cc0b122197e9ddee5959c3fb9dd16d
2017-06-12 15:49:13 -07:00
Gregory Maxwell dd869c60ca Add an explanation of quickly hashing onto a non-power of two range.
In Olaoluwa Osuntokun's recent protocol proposal they were using a
 mod in an inner loop.  I wanted to suggest a normative protocol
 change to use the trick we use here, but to find an explanation
 of it I had to dig up the PR on github.  After I posted about it
 several other developers commented that it was very interesting
 and they were unaware of it.

I think ideally the code should be self documenting and help
 educate other contributors about non-obvious techniques that
 we use.  So I've written a description of the technique with
 citations for future reference.
2017-06-12 22:44:55 +00:00
Pieter Wuille c98ebf1bfb
Merge #10568: Remove unnecessary forward class declarations in header files
4087d9ea7 Remove unnecessary forward class declarations in header files (practicalswift)

Tree-SHA512: 80a9b2cd339ba9c606c0dd93739ac80941b6050388fee2edd7976ae8b5e332fd0b4f1df1e89c1d6d28a77c23a36b1e874e72977985fb8f710c65c45c3a926f97
2017-06-12 15:17:51 -07:00
Alex Morcos 8e69adc665 Add missing include for atomic in db.h 2017-06-12 14:39:48 -04:00
practicalswift 4087d9ea7c Remove unnecessary forward class declarations in header files 2017-06-12 20:37:43 +02:00
Wladimir J. van der Laan b7296bcea0
Merge #10550: Don't return stale data from CCoinsViewCache::Cursor()
3ff1fa8 Use override keyword on CCoinsView overrides (Russell Yanofsky)
24e44c3 Don't return stale data from CCoinsViewCache::Cursor() (Russell Yanofsky)

Tree-SHA512: 08699dae0925ffb9c018f02612ac6b7eaf73ec331e2f4f934f1fe25a2ce120735fa38596926e924897c203f7470e99f0a99cf70d2ce31ff428b105e16583a861
2017-06-12 16:29:59 +02:00
practicalswift 4265bf351a Remove unreachable or otherwise redundant code 2017-06-12 15:01:46 +02:00
Wladimir J. van der Laan 177433ad22
Merge #8694: Basic multiwallet support
c237bd7 wallet: Update formatting (Luke Dashjr)
9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr)
a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr)
b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr)
008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr)
19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr)
74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr)
23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr)
9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr)
f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)

Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23
2017-06-12 13:27:17 +02:00
Wladimir J. van der Laan fa1f106218
Merge #10488: Note that the prioritizetransaction dummy value is deprecated, and has no meaning
40796e1 Remove references to priority that snuck back in in 870824e9. (Matt Corallo)

Tree-SHA512: fd6f772a9fdf14b3b125e84a79059d7ab34b3571b35dc48f8d4b9f22ea71c6cdd4ae88c2e135ae317a16744c28dd23cf7f7dd88ea9d8b2d408e57845ef87d03b
2017-06-12 13:00:39 +02:00
practicalswift 67ca816849 Simplify "bool x = y ? true : false" to "bool x = y" 2017-06-11 15:44:01 +02:00
Wladimir J. van der Laan 2c2d988062
Merge #10546: Remove 33 unused Boost includes
49de096 Remove unused Boost includes (practicalswift)

Tree-SHA512: ff2dad94f9eeb1dc50fcffd0e94e1686be04e4e5bc45f58ae955d630c15cd25bb8f5583d0aa1f2f263b5a723be79747ef3c6e6b417c7be7787c0abc8d1874019
2017-06-11 15:37:15 +02:00
Wladimir J. van der Laan e4918316d8
Merge #10561: Remove duplicate includes
e53a0fa Remove duplicate includes (practicalswift)

Tree-SHA512: 5101afaf190ade3ffbea666ff5d0cb59d3e1dbdd9a3db3d91df7b51c13cc9f5a699438e8a753655365f6dc14529bc95883e715b5a6ab73158374e13ec311f70b
2017-06-11 14:32:30 +02:00
Wladimir J. van der Laan 562caf1c74
Merge #10560: Remove unused constants
dce8239 Comment out unused constant REJECT_DUST (practicalswift)
3289ef4 Remove unused constant MEMPOOL_GD_VERSION (practicalswift)

Tree-SHA512: 8dd772c963037cd0a1db0d5bf5f7a5cce3f5cd8fb6fa983949f9f0c1c8312ffd251a62c1e5d32f3584d2bcc562d8c8a9bf7900609dee9a4f12898caa2be9c38f
2017-06-11 14:22:40 +02:00
MarcoFalke 3ee3d04374 Add extra LevelDB source to Makefile 2017-06-09 19:25:36 -07:00
Cory Fields 2424989e4f leveldb: enable runtime-detected crc32 instructions 2017-06-09 19:25:36 -07:00
Pieter Wuille e4030ab4f4 Update to LevelDB 1.20 2017-06-09 19:24:30 -07:00
Andrew Chow c45cbaf69f Fix stopatheight
Moves stopatheight check into the ActivateBestChain loop so that the block height is actually checked and stopped at the appropriate time.
2017-06-09 13:40:45 -07:00
Pieter Wuille e241a63c23 Clarify prevector::erase and avoid swap-to-clear 2017-06-09 13:23:20 -07:00
Pieter Wuille 76f268b9bd
Merge #10521: Limit variable scope
90593ed92 Limit variable scope (practicalswift)

Tree-SHA512: 4719e303688a31aefbe1d239e86b21dd3c2045524e08bd628c6ba0c6c2a97de14d04305b9beafe0b1dcde7229793e6663168953f192e88ed409be5c30fd2a9a9
2017-06-09 13:09:24 -07:00
Matt Corallo 9417d7a336 Be much more agressive in AccessCoin docs.
While the current implementation is pretty free, there is a lot
of possibility for this to blow up in our face with future changes,
especially as the backing map gets tweaked.
2017-06-09 13:10:08 -04:00
Matt Corallo f58349ca85 Restore some assert semantics in sigop cost calculations
There are some similar asserts which are left removed in policy
and ATMP (policy code being broken isn't a huge deal, but if we
fail to verify some consensus rules, we should most definitely
crash).
2017-06-09 13:10:08 -04:00
Matt Corallo 3533fb4d33 Return a bool in SpendCoin to restore pre-per-utxo assert semantics
Since its free to do so, assert that Spends succeeded when we expect
them to.
2017-06-09 13:10:05 -04:00
practicalswift e53a0fa12a Remove duplicate includes 2017-06-09 15:39:37 +02:00
practicalswift dce82397c1 Comment out unused constant REJECT_DUST 2017-06-09 15:21:28 +02:00
practicalswift 49de096c2a Remove unused Boost includes 2017-06-09 10:25:26 +02:00
Gregory Maxwell bf376eaccc Return early in IsBanned.
I am not aware of any reason that we'd try to stop a ban-list timing
 side-channel and the prior code wouldn't be enough if we were.
2017-06-09 02:05:53 +00:00
practicalswift 3289ef4fe1 Remove unused constant MEMPOOL_GD_VERSION 2017-06-09 01:45:36 +02:00
Alex Morcos 525769853e Change semantics of HaveCoinInCache to match HaveCoin
Previously it was possible for HaveCoinInCache to return true for a spent
coin. It is more clear to keep the semantics the same. HaveCoinInCache is
used for two reasons:
- tracking coins we may want to uncache, in which case it is unlikely there
would be spent coins we could uncache (not dirty)
- optimistically checking whether we have already included a tx in the
blockchain, in which case a spent coin is not a reliable indicator that we have.
2017-06-08 16:56:50 -04:00
Wladimir J. van der Laan 29f80cd230
Merge #10545: Use list initialization (C++11) for maps/vectors instead of boost::assign::map_list_of/list_of
3fb81a8 Use list initialization (C++11) for maps/vectors instead of boost::assign::map_list_of/list_of (practicalswift)

Tree-SHA512: 63a9ac9ec5799472943dce1cd92a4b14e7f1fe12758a5fc4b1efceaf2c85a4ba71dad5ccc50813527f18b192e7714c076e2478ecd6ca0d452b24e88416f872f7
2017-06-08 20:26:40 +02:00
Russell Yanofsky 3ff1fa8c4a Use override keyword on CCoinsView overrides 2017-06-08 09:28:28 -04:00
Wladimir J. van der Laan 9c248e39f2
Merge #10481: Decodehextx scripts sanity check
ac4e438 Sanity check transaction scripts in DecodeHexTx (Andrew Chow)
5b75c47 Add a valid opcode sanity check to CScript (Andrew Chow)

Tree-SHA512: a516e95c274c9d131123150c798cae8bed75925e8a4d59469967dd7f1d49f7f8161e26afb61024b821bd8dcdffdfd0d19b8dcad20b39b1106820326d8d56904d
2017-06-08 13:36:48 +02:00
Wladimir J. van der Laan 35e7f13f68
Merge #10548: Use std::unordered_{map,set} (C++11) instead of boost::unordered_{map,set}
246a02f Use std::unordered_{map,set} (C++11) instead of boost::unordered_{map,set} (practicalswift)

Tree-SHA512: 35cd42012248174751e4b87efbc78689957f731d7710dea7e369974c6ec31b15b32d1537fb0d875c94c7ffb5046d9784735e218e5baeed96d525861dab6d4252
2017-06-08 12:45:34 +02:00
Wladimir J. van der Laan 71ab6e5538
Merge #10547: [tests] Use FastRandomContext instead of boost::random::{mt19937,uniform_int_distribution}
227ae9b [tests] Use FastRandomContext instead of boost::random::{mt19937,uniform_int_distribution} (practicalswift)

Tree-SHA512: 1bde6c8b9498051fa2eae4913eb1f5411adea8dea1511c0df859aea57a2a7db6f5839945ddf2eccdddfa322bceacad35a5d875742db7d15e40dbea83185307bb
2017-06-08 12:39:43 +02:00
practicalswift 30c2d9db48 [tests] Remove unused function InsecureRandBytes(size_t len) 2017-06-08 09:43:54 +02:00
Wladimir J. van der Laan 6c2d81f34d
Merge #10524: [tests] Remove printf(...)
0abc588 [tests] Remove printf(...) (practicalswift)

Tree-SHA512: a56fa1edce050f5a44a53842223fc99e4e8ade413047e04f2064faeb5c4a418864a94471853d5c26a20608d1dcc18b9226d7fe15172f79a66cc5cf6e1443f7e9
2017-06-08 09:43:09 +02:00
Pieter Wuille e801084dec
Merge #10321: Use FastRandomContext for all tests
e94584858 scripted-diff: Use new naming style for insecure_rand* functions (Pieter Wuille)
2fcd9cc86 scripted-diff: Use randbits/bool instead of randrange where possible (Pieter Wuille)
2ada67852 Use randbits instead of ad-hoc emulation in prevector tests (Pieter Wuille)
5f0b04eed Replace rand() & ((1 << N) - 1) with randbits(N) (Pieter Wuille)
3ecabae36 Replace more rand() % NUM by randranges (Pieter Wuille)
efee1db21 scripted-diff: use insecure_rand256/randrange more (Pieter Wuille)
1119927df Add various insecure_rand wrappers for tests (Pieter Wuille)
124d13a58 Merge test_random.h into test_bitcoin.h (Pieter Wuille)
90620d66c scripted-diff: Rename cuckoo tests' local rand context (Pieter Wuille)
37e864eb9 Add FastRandomContext::rand256() and ::randbytes() (Pieter Wuille)

Tree-SHA512: d09705a3ec718ae792f7d66a75401903ba7b9c9d3fc36669d6e3b9242f0194738106be26baefc8a8e3fa6df7c9a35978c71c0c430278a028b331df23a3ea3070
2017-06-07 15:12:14 -07:00
John Newbery 6294f3283a gettxoutproof() should return consistent result
We can call gettxoutproof() with a list of transactions. Currently, if
the first transaction is unspent (and all other transactions are in the
same block), then the call will succeed. If the first transaction has
been spent, then the call will fail. The means that the following two
calls will return different results:

gettxoutproof(unspent_tx1, spent_tx1)
gettxoutproof(spent_tx1, unspent_tx1)

This commit makes behaviour independent of transaction ordering by looping
through all transactions provided and trying to find which block they're in.

This commit also increases the test coverage and tests more failure
cases for gettxoutproof()
2017-06-07 17:38:21 -04:00
Andrew Chow c8914b9dbb Have make cov optionally include branch coverage statistics
Added an option to configure to allow for branch coverage statistics gathering.

Disabled logprint macro when coverage testing is on so that unnecessary branches are not analyzed.
2017-06-07 14:19:01 -07:00
Andrew Chow ac4e438229 Sanity check transaction scripts in DecodeHexTx
Make sure that the scripts of decoded transactions are valid scripts.
2017-06-07 14:07:26 -07:00
Andrew Chow 5b75c47784 Add a valid opcode sanity check to CScript
Added a function in CScript that checks if the script contains valid opcodes.

Add a test for that function
2017-06-07 12:40:01 -07:00
Pieter Wuille e945848582 scripted-diff: Use new naming style for insecure_rand* functions
-BEGIN VERIFY SCRIPT-
sed -i 's/\<insecure_randbits(/InsecureRandBits(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_randbool(/InsecureRandBool(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_randrange(/InsecureRandRange(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_randbytes(/InsecureRandBytes(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_rand256(/InsecureRand256(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_rand(/InsecureRand32(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<seed_insecure_rand(/SeedInsecureRand(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
-END VERIFY SCRIPT-
2017-06-07 12:08:39 -07:00
practicalswift 0abc58890c [tests] Remove printf(...) 2017-06-07 20:42:54 +02:00
practicalswift 227ae9b34d [tests] Use FastRandomContext instead of boost::random::{mt19937,uniform_int_distribution} 2017-06-07 20:38:03 +02:00
Pieter Wuille 2fcd9cc86b scripted-diff: Use randbits/bool instead of randrange where possible
-BEGIN VERIFY SCRIPT-
sed -i 's/insecure_randbits(1)/insecure_randbool()/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(2)/insecure_randbool()/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(4)/insecure_randbits(2)/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(32)/insecure_randbits(5)/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(256)/insecure_randbits(8)/g' src/test/*_tests.cpp
-END VERIFY SCRIPT-
2017-06-07 11:35:16 -07:00
Pieter Wuille 2ada678521 Use randbits instead of ad-hoc emulation in prevector tests 2017-06-07 11:35:16 -07:00
Pieter Wuille 5f0b04eedc Replace rand() & ((1 << N) - 1) with randbits(N) 2017-06-07 11:35:13 -07:00
Pieter Wuille 3ecabae363 Replace more rand() % NUM by randranges 2017-06-07 11:34:55 -07:00
Pavlos Antoniou e5c616888b Fix instantiation and array accesses in class base_uint<BITS>
The implementation of base_uint::operator++(int) and base_uint::operator--(int) is now safer.
Array pn is accessed via index i after bounds checking has been performed on the index, rather than before.
The logic of the while loops has also been made more clear.

A compile time assertion has been added in the class constructors to ensure that BITS is a positive multiple of 32.
2017-06-07 17:21:29 +00:00
Russell Yanofsky 24e44c354d Don't return stale data from CCoinsViewCache::Cursor()
CCoinsViewCache doesn't actually support cursor iteration returning the
current contents of the cache, so raise an error when the cursor method is
called instead of returning a cursor that iterates over stale data.

Also update the gettxoutsetinfo RPC which was relying on the old behavior to be
explicit about which view it is returning data about.
2017-06-07 13:00:11 -04:00
Matt Corallo eada04e778 Do not print soft-fork-script warning with -promiscuousmempool 2017-06-07 11:02:36 -04:00
Matt Corallo b5fea8d0cc Cache full script execution results in addition to signatures
This adds a new CuckooCache in validation, caching whether all of a
transaction's scripts were valid with a given set of script flags.

Unlike previous attempts at caching an entire transaction's
validity, which have nearly universally introduced consensus
failures, this only caches the validity of a transaction's
scriptSigs. As these are pure functions of the transaction and
data it commits to, this should be much safer.

This is somewhat duplicative with the sigcache, as entries in the
new cache will also have several entries in the sigcache. However,
the sigcache is kept both as ATMP relies on it and because it
prevents malleability-based DoS attacks on the new higher-level
cache. Instead, the -sigcachesize option is re-used - cutting the
sigcache size in half and using the newly freed memory for the
script execution cache.

Transactions which match the script execution cache never even have
entries in the script check thread's workqueue created.

Note that the cache is indexed only on the script execution flags
and the transaction's witness hash. While this is sufficient to
make the CScriptCheck() calls pure functions, this introduces
dependancies on the mempool calculating things such as the
PrecomputedTransactionData object, filling the CCoinsViewCache, etc
in the exact same way as ConnectBlock. I belive this is a reasonable
assumption, but should be noted carefully.

In a rather naive benchmark (reindex-chainstate up to block 284k
with cuckoocache always returning true for contains(),
-assumevalid=0 and a very large dbcache), this connected blocks
~1.7x faster.
2017-06-07 11:02:36 -04:00
Matt Corallo 6d22b2b17b Pull script verify flags calculation out of ConnectBlock 2017-06-07 11:02:36 -04:00
Wladimir J. van der Laan 46311e792f
Merge #9672: Opt-into-RBF for RPC & bitcoin-tx
9a5a1d7 RPC/rawtransaction: createrawtransaction: Check opt_into_rbf when provided with either value (Luke Dashjr)
23b0fe3 bitcoin-tx: rbfoptin: Avoid touching nSequence if the value is already opting in (Luke Dashjr)
b005bf2 Introduce MAX_BIP125_RBF_SEQUENCE constant (Luke Dashjr)
575cde4 [bitcoin-tx] add rbfoptin command (Jonas Schnelli)
5d26244 [Tests] extend the replace-by-fee test to cover RPC rawtx features (Jonas Schnelli)
36bcab2 RPC/Wallet: Add RBF support for fundrawtransaction (Luke Dashjr)
891c5ee Wallet: Refactor FundTransaction to accept parameters via CCoinControl (Luke Dashjr)
578ec80 RPC: rawtransaction: Add RBF support for createrawtransaction (Luke Dashjr)

Tree-SHA512: 446e37c617c188cc3b3fd1e2841c98eda6f4869e71cb3249c4a9e54002607d0f1e6bef92187f7894d4e0746ab449cfee89be9f6a1a8831e25c70cf912eac1570
2017-06-07 15:31:40 +02:00
practicalswift 246a02fb14 Use std::unordered_{map,set} (C++11) instead of boost::unordered_{map,set} 2017-06-07 15:04:54 +02:00
Pieter Wuille be3e042c20
Merge #10523: Perform member initialization in initialization lists where possible
656dbd871 Perform member initialization in initialization lists where possible (practicalswift)

Tree-SHA512: 048380f4da23ab1eaaf471801a01dbd76f2235afb686c1489b30a6bac109195134afc83414b8378d3482a9042d537ec62d30136dadb9347cf06b07fb5c693208
2017-06-06 17:00:19 -07:00
MarcoFalke 75e898c094
Merge #10331: Share config between util and functional tests
8ad5bde Merge bctest.py into bitcoin-util-test.py (John Newbery)
95836c5 Use shared config file for functional and util tests (John Newbery)
89fcd35 Use an .ini config file for environment vars in bitcoin-util-test.py (John Newbery)
e9265df Change help_text in bitcoin-util-test.py to a docstring. (John Newbery)
ce58e93 Change bitcoin-util-test.py to use Python3 (John Newbery)

Tree-SHA512: 66dab0b4a8546aee0dfaef134a165f1447aff4c0ec335754bbc7d9e55909721c62f09cdbf4b22d02ac1fcd5a9b66780f91e1cc4d8687fae7288cc9072a23a78f
2017-06-06 23:55:24 +02:00
MarcoFalke 2805d606bc
Merge #10522: [wallet] Remove unused variables
a8c09af Remove unused variables (practicalswift)

Tree-SHA512: 34807dc3a0471c83b086f430b66465602c8f6a3a158b54ace2ec8afb746f1f5907f7dfcde5a4bad4041df9721ec46b61681b2dbf89725c9c8c4c5ad0ca99f78f
2017-06-06 23:51:33 +02:00
MarcoFalke 32751807c9
Merge #10538: [trivial] Fix typo: "occurrences" (misspelled as "occurrances")
b083db6 [trivial] Fix typo: "occurrences" (misspelled as "occurrances") (practicalswift)

Tree-SHA512: 5141526dbbbbe797ef103fcbdc0a1318648214973214607e35cc0e99abfc4dd547e3ef15fe21976c53a78b03dff140fe76e5c92a0f7e7d2b08081215983a8616
2017-06-06 23:48:10 +02:00
Luke Dashjr c237bd750e wallet: Update formatting 2017-06-06 21:20:22 +00:00
Luke Dashjr 9cbe8c80ba wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets 2017-06-06 21:20:22 +00:00
Luke Dashjr a2a5f3f0f0 wallet: Base backup filenames on original wallet filename 2017-06-06 21:20:22 +00:00
Luke Dashjr b823a4c9f6 wallet: Include actual backup filename in recovery warning message 2017-06-06 21:17:09 +00:00
Luke Dashjr 84dcb45017 Bugfix: wallet: Fix warningStr, errorStr argument order 2017-06-06 21:17:09 +00:00
Luke Dashjr 008c360083 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets 2017-06-06 21:17:09 +00:00
Luke Dashjr 0f08575be2 Wallet: Support loading multiple wallets if -wallet used more than once 2017-06-06 21:17:09 +00:00
Luke Dashjr b124cf04ea Wallet: Replace pwalletMain with a vector of wallet pointers 2017-06-06 21:17:09 +00:00
practicalswift 3fb81a8480 Use list initialization (C++11) for maps/vectors instead of boost::assign::map_list_of/list_of 2017-06-06 21:29:16 +02:00
Matt Corallo 40796e1a9d Remove references to priority that snuck back in in 870824e9.
The "priority" field should be appropriately marked as a "dummy"
value and noted that it is deprecated and will likely be removed.
2017-06-06 15:13:37 -04:00
Mario Dian 24980a3e40 Make functions in validation.cpp static and pass chainparams
Fix bugs as per PR comment

Change bool static to static bool
2017-06-06 22:21:30 +08:00
Wladimir J. van der Laan 300f8e7a82
Merge #9909: tests: Add FindEarliestAtLeast test for edge cases
cf66f04 Add FindEarliestAtLeast test for edge cases (Russell Yanofsky)

Tree-SHA512: bed2e9b2eefe0014414f1be8f0ba236b1dcc6744a670ffa546100c62817dd06a117cc62cdff80c4988d2b374cae9a57f2bb135fc582ffb51ca2d34ab07bb3fe0
2017-06-06 15:51:45 +02:00
Wladimir J. van der Laan 980deaf0b1
Merge #10252: RPC/Mining: Restore API compatibility for prioritisetransaction
870824e RPC/Mining: Restore API compatibility for prioritisetransaction (Luke Dashjr)

Tree-SHA512: eb507500dc5ba8d17521f34f3d6eae45aa9259c38d15a75dc3e3ad45774ffb53db943be1720a97e6cd5f08e7832801e27ffb636da081a58955018b6f8f9d8fba
2017-06-06 15:49:38 +02:00
practicalswift b083db617a [trivial] Fix typo: "occurrences" (misspelled as "occurrances")
Typo introduced in 0003911326:

$ git blame src/coins.cpp | grep occurrances
00039113 (2017-04-25 11:29:29 -0700  89)         // deal with the pre-BIP30 occurrances of duplicate coinbase transactions.
2017-06-06 15:06:23 +02:00
Wladimir J. van der Laan 67700b3924
Merge #10345: [P2P] Timeout for headers sync
76f7481 Add timeout for headers sync (Suhas Daftuar)
e265200 Delay parallel block download until chain has sufficient work (Suhas Daftuar)

Tree-SHA512: e7f5468b7defe67d4d2d5c976bc129dba2b32b2ea52d3ff33b9cbff5c3b5b799be867653f1bcd354340d707d76dcadf2da4588abf6d6ec4a06672cdc5e1101eb
2017-06-06 12:23:56 +02:00
Wladimir J. van der Laan 16f6c98fa8
Merge #10426: Replace bytes_serialized with bogosize
8b22af3 Replace bytes_serialized with bogosize (Pieter Wuille)

Tree-SHA512: e70a981bbb977329f9e324c45f9a1346ec9aacfbbad5474e608cdd1f852257502bb7db8003fd578260a609e45d1a9cf87ce96df9c4187d92d50f60a209e232ce
2017-06-06 11:46:31 +02:00
Wladimir J. van der Laan 323a46e034
Merge #10463: Names: BIP9 vs versionbits
b463bc9 scripted-diff: s/BIP9DeploymentInfo/VBDeploymentInfo/ (Jorge Timón)
29c0719 Rename -bip9params to -vbparams (shaolinfry)

Tree-SHA512: a8a2bf6e24a4a7fc82f784c78c0cd92472e9ba55ce3fb22dafef3eccdcfccb2da5a6078fbeec1a8a4b6ab1f1b226976c5aba964dd5e3d029a21b109a7c044374
2017-06-06 10:18:02 +02:00
Matt Corallo ec1271f2be Remove useless mapNextTx lookup in CTxMemPool::TrimToSize.
Prior to per-utxo CCoins, we checked that no other in-mempool tx
spent any of the given transaction's outputs, as we don't want to
uncache that entire tx in such a case. However, we now are checking
only that there exists no other mempool spends of the same output,
which should clearly be impossible after we removed the transaction
which was spending said output (barring massive mempool
inconsistency).

Thanks to @sdaftuar for the suggestion.
2017-06-05 21:46:14 -04:00
Luke Dashjr 9a5a1d7d45 RPC/rawtransaction: createrawtransaction: Check opt_into_rbf when provided with either value 2017-06-05 23:14:34 +00:00
Luke Dashjr 23b0fe34f5 bitcoin-tx: rbfoptin: Avoid touching nSequence if the value is already opting in 2017-06-05 23:14:34 +00:00
Luke Dashjr b005bf21a7 Introduce MAX_BIP125_RBF_SEQUENCE constant 2017-06-05 23:14:34 +00:00
Jonas Schnelli 575cde4605 [bitcoin-tx] add rbfoptin command 2017-06-05 23:13:24 +00:00
Luke Dashjr 36bcab2356 RPC/Wallet: Add RBF support for fundrawtransaction 2017-06-05 23:12:29 +00:00
Luke Dashjr 891c5eeec2 Wallet: Refactor FundTransaction to accept parameters via CCoinControl 2017-06-05 23:12:03 +00:00
Luke Dashjr 578ec80d4f RPC: rawtransaction: Add RBF support for createrawtransaction 2017-06-05 23:09:01 +00:00
Luke Dashjr 19b3648bb5 CWalletDB: Store the update counter per wallet 2017-06-05 22:27:57 +00:00
Luke Dashjr 74e8738961 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append 2017-06-05 21:04:42 +00:00
Luke Dashjr 23fb9adaea wallet: Move nAccountingEntryNumber from static/global to CWallet 2017-06-05 21:04:42 +00:00
Luke Dashjr 9d15d5548d Bugfix: wallet: Increment "update counter" when modifying account stuff 2017-06-05 21:04:42 +00:00
Luke Dashjr f28eb8020e Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races
Also does all "update counter" access via IncrementUpdateCounter
2017-06-05 21:04:42 +00:00
Suhas Daftuar 76f74811c4 Add timeout for headers sync
At startup, we choose one peer to serve us the headers chain, until
our best header is close to caught up.  Disconnect this peer if more
than 15 minutes + 1ms/expected_header passes and our best header
is still more than 1 day away from current time.
2017-06-05 16:33:35 -04:00
Pieter Wuille efee1db21a scripted-diff: use insecure_rand256/randrange more
-BEGIN VERIFY SCRIPT-
sed -i "s/\<GetRandHash(/insecure_rand256(/" src/test/*_tests.cpp
sed -i "s/\<GetRand(/insecure_randrange(/" src/test/*_tests.cpp src/test/test_bitcoin.cpp
sed -i 's/\<insecure_rand() % \([0-9]\+\)/insecure_randrange(\1)/g' src/test/*_tests.cpp
-END VERIFY SCRIPT-
2017-06-05 12:45:44 -07:00
Pieter Wuille 1119927df0 Add various insecure_rand wrappers for tests 2017-06-05 12:44:44 -07:00
Pieter Wuille 124d13a58c Merge test_random.h into test_bitcoin.h 2017-06-05 12:44:44 -07:00
Pieter Wuille 90620d66c9 scripted-diff: Rename cuckoo tests' local rand context
-BEGIN VERIFY SCRIPT-
sed -i 's/insecure_rand/local_rand_ctx/g' src/test/cuckoocache_tests.cpp
-END VERIFY SCRIPT-
2017-06-05 12:44:44 -07:00
Pieter Wuille 37e864eb9f Add FastRandomContext::rand256() and ::randbytes()
FastRandomContext now provides all functionality that the real Rand* functions
provide.
2017-06-05 12:44:44 -07:00
Pieter Wuille 8b22af3ee5 Replace bytes_serialized with bogosize 2017-06-05 12:43:45 -07:00
Jorge Timón 1238f13cf6
scripted-diff: Remove PAIRTYPE
-BEGIN VERIFY SCRIPT-
sed -i 's/PAIRTYPE(\([^,]*\), \([^\)]*\))/std::pair<\1, \2>/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i ':a;N;$!ba;s/#define std::pair<t1, t2>    std::pair<t1, t2>\n//' ./src/utilstrencodings.h ;
-END VERIFY SCRIPT-
2017-06-05 20:14:53 +02:00
Jorge Timón 18dc3c3962
scripted-diff: Remove Q_FOREACH
-BEGIN VERIFY SCRIPT-
sed -i 's/Q_FOREACH *(\(.*\),/for (\1 :/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
-END VERIFY SCRIPT-
2017-06-05 20:11:01 +02:00
Jorge Timón 7c00c26726
scripted-diff: Fully remove BOOST_FOREACH
-BEGIN VERIFY SCRIPT-
sed -i 's/BOOST_FOREACH *(\(.*\),/for (\1 :/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
-END VERIFY SCRIPT-
2017-06-05 20:10:50 +02:00
Jorge Timón a5410ac5ec
Small preparations for Q_FOREACH, PAIRTYPE and #include <boost/foreach.hpp> removal 2017-06-05 20:02:30 +02:00
Wladimir J. van der Laan 9fec4da0be
Merge #9740: Add friendly output to dumpwallet
164019d Add dumpwallet output test (aideca)
9f82134 Add friendly output to dumpwallet refs #9564 (aideca)

Tree-SHA512: 913fcf18d42eebe34173f1f2519973494b1ad2d86d125ff4bf566d6c64aa501c02f8831e6f44812cd87a46916f61c6f510146af406865b31856d8336c173569f
2017-06-05 18:06:34 +02:00
Russell Yanofsky 9bb66ab660 Add RescanFromTime method and use from rpcdump
No change in behavior.
2017-06-05 09:59:58 -05:00
Russell Yanofsky ccf84bb9c1 Move birthday optimization out of ScanForWalletTransactions
This change has no effect on wallet behavior.

On wallet startup, the transaction scan avoids reading any blocks with
timestamps older than the wallet birthday (less than nTimeFirstKey -
TIMESTAMP_WINDOW). This block skipping code currently resides in
CWallet::ScanForWalletTransactions but it doesn't really belong there because
it makes the implementation unnecessarily fragile and hard to understand, and
it never has any effect except at startup (because all other callers do their
rescans based on timestamps other than, but always greater or equal to,
nTimeFirstKey).
2017-06-05 09:59:58 -05:00
Wladimir J. van der Laan 08d0390a5f
Merge #10403: Fix importmulti failure to return rescan errors
4d2d604 Fix importmulti failure to return rescan errors (Russell Yanofsky)

Tree-SHA512: e5e6d6c5a2bb7230e1bcac1903a4b766cd57bf781fade50c6c9cd5713cd3e768db0987cfda9699b57a53d3a0a60951b96dce5283b3d3ec1f954162c439bc932b
2017-06-05 16:41:02 +02:00
Wladimir J. van der Laan 0747d33498
Merge #10455: Simplify feebumper minimum fee code slightly
88b8f0b Simplify feebumper minimum fee code slightly (Russell Yanofsky)

Tree-SHA512: 4465daef63936860d016a7fd7fd31ce62878d87cb943a90f321b07a40accdc5e7970d99de46b2bc924eb0b422144d6f01649855949395518790ecd05d300ee52
2017-06-05 16:38:07 +02:00
Wladimir J. van der Laan cec9e1ea61
Merge #10422: Fix timestamp in fee estimate debug message
8d4f401 Fix timestamp in fee estimate debug message (Alex Morcos)

Tree-SHA512: eb015ddbb9f52f0f84706a16e503d2894dceed4e796979858ca8bdd7f0ec15bf7646ca3f411b06ff099308c91ca498916778e6bd52db00365baaae1d2f4218f2
2017-06-05 16:24:26 +02:00
Wladimir J. van der Laan e103b3ff1e
Merge #10514: Bugfix: missing == 0 after randrange
9aa215b Bugfixes: missing == 0 after randrange (Pieter Wuille)

Tree-SHA512: 160657ac09553f23ad7a3966c753a30ba938ce6f7ccfd34a4ef0d05d73d712362f7eef97e44a96e37a181b8347caa9d8e1584cc4485f69674ab2de3d8a247373
2017-06-05 16:09:59 +02:00
Wladimir J. van der Laan a7e3c2814c rpc: Add listen address to incoming connections in getpeerinfo
This adds the listening address on which incoming connections were received to the
CNode and CNodeStats structures.

The address is reported in `getpeerinfo`.

This can be useful for distinguishing connections received on different listening ports
(e.g. when using a different listening port for Tor hidden service connections)
or different networks.
2017-06-05 13:35:30 +02:00
practicalswift 90593ed92c Limit variable scope 2017-06-05 00:52:36 +02:00
Pieter Wuille 400fdd08cc
Merge #10471: Denote functions CNode::GetRecvVersion() and CNode::GetRefCount() as const
5f672ca8c net: Denote some CNode functions const (Pavlos Antoniou)

Tree-SHA512: f6d13d8002a4145fd87b34b35a739284e4a9b1af834bba109d324eccddb684eccb817553ba76102eb5b5819cab37f938b4ba74fdbda7c5386d00747b3024cd81
2017-06-04 11:32:06 -07:00
practicalswift 656dbd871a Perform member initialization in initialization lists where possible 2017-06-04 01:09:48 +02:00
practicalswift a8c09affce Remove unused variables 2017-06-03 23:54:24 +02:00
Pieter Wuille 098b01dc58
Merge #10500: Avoid CWalletTx copies in GetAddressBalances and GetAddressGroupings
b9b814a38 Avoid CWalletTx copies in GetAddressBalances and GetAddressGroupings (Russell Yanofsky)

Tree-SHA512: 96a0612ca460ba1bfb3921f3aa348400fd3afa12c40f2ca1f3f04068b1574fe824d577e0123013d8898a4990084316dc1dfb541331849f0996ceff7f4eb25e6b
2017-06-02 16:10:33 -07:00
Pieter Wuille 9aa215bff9 Bugfixes: missing == 0 after randrange 2017-06-02 13:47:59 -07:00
Wladimir J. van der Laan 00d3692396
Merge #10323: Update to latest libsecp256k1 master
e7c1b44 Squashed 'src/secp256k1/' changes from 8225239..84973d3 (Pieter Wuille)

Tree-SHA512: 3e1ba6e6ad9d68170a1a60bd963f2dbaa8b0ae592cc562e6cd23b2c7653f0b8016e4c682681ae2fb3714106a41f8b89708e16e8f52a42ff3db59fc28262eea0b
2017-06-02 10:58:49 +02:00
Pieter Wuille d9bec888f1 Use REJECT_DUPLICATE for already known and conflicted txn 2017-06-02 00:18:47 -07:00
Pieter Wuille cf68a488a4 Deduplicate addrdb.cpp and use CHashWriter/Verifier 2017-06-01 16:42:07 -07:00
Pieter Wuille 7cc2c670e3
Merge #10506: Fix bumpfee test after #10449
8906a9a0d Fix bumpfee test after #10449 (Russell Yanofsky)

Tree-SHA512: 0838c7696499baf0fb5ee6edf0b081752d6c37578360a7f24a7e9c700598cbc14ff95826f2f5124cca805d2609470a052bc7309211874b13be7ac1ff9e911a34
2017-06-01 16:28:37 -07:00
Pieter Wuille 1088b02f0c
Merge #10195: Switch chainstate db and cache to per-txout model
589827975 scripted-diff: various renames for per-utxo consistency (Pieter Wuille)
a5e02bc7f Increase travis unit test timeout (Pieter Wuille)
73de2c1ff Rename CCoinsCacheEntry::coins to coin (Pieter Wuille)
119e552f7 Merge CCoinsViewCache's GetOutputFor and AccessCoin (Pieter Wuille)
580b02309 [MOVEONLY] Move old CCoins class to txdb.cpp (Pieter Wuille)
8b25d2c0c Upgrade from per-tx database to per-txout (Pieter Wuille)
b2af357f3 Reduce reserved memory space for flushing (Pieter Wuille)
41aa5b79a Pack Coin more tightly (Pieter Wuille)
97072d668 Remove unused CCoins methods (Pieter Wuille)
ce23efaa5 Extend coins_tests (Pieter Wuille)
508307968 Switch CCoinsView and chainstate db from per-txid to per-txout (Pieter Wuille)
4ec0d9e79 Refactor GetUTXOStats in preparation for per-COutPoint iteration (Pieter Wuille)
13870b56f Replace CCoins-based CTxMemPool::pruneSpent with isSpent (Pieter Wuille)
05293f3cb Remove ModifyCoins/ModifyNewCoins (Pieter Wuille)
961e48397 Switch tests from ModifyCoins to AddCoin/SpendCoin (Pieter Wuille)
8b3868c1b Switch CScriptCheck to use Coin instead of CCoins (Pieter Wuille)
c87b957a3 Only pass things committed to by tx's witness hash to CScriptCheck (Matt Corallo)
f68cdfe92 Switch from per-tx to per-txout CCoinsViewCache methods in some places (Pieter Wuille)
000391132 Introduce new per-txout CCoinsViewCache functions (Pieter Wuille)
bd83111a0 Optimization: Coin&& to ApplyTxInUndo (Pieter Wuille)
cb2c7fdac Replace CTxInUndo with Coin (Pieter Wuille)
422634e2f Introduce Coin, a single unspent output (Pieter Wuille)
7d991b55d Store/allow tx metadata in all undo records (Pieter Wuille)
c3aa0c119 Report on-disk size in gettxoutsetinfo (Pieter Wuille)
d34242430 Remove/ignore tx version in utxo and undo (Pieter Wuille)
7e0032290 Add specialization of SipHash for 256 + 32 bit data (Pieter Wuille)
e484652fc Introduce CHashVerifier to hash read data (Pieter Wuille)
f54580e7e error() in disconnect for disk corruption, not inconsistency (Pieter Wuille)
e66dbde6d Add SizeEstimate to CDBBatch (Pieter Wuille)

Tree-SHA512: ce1fb1e40c77d38915cd02189fab7a8b125c7f44d425c85579d872c3bede3a437760997907c99d7b3017ced1c2de54b2ac7223d99d83a6658fe5ef61edef1de3
2017-06-01 16:20:27 -07:00
Pieter Wuille 589827975f scripted-diff: various renames for per-utxo consistency
Thanks to John Newberry for pointing these out.

-BEGIN VERIFY SCRIPT-
sed -i 's/\<GetCoins\>/GetCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<HaveCoins\>/HaveCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<HaveCoinsInCache\>/HaveCoinInCache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<IsPruned\>/IsSpent/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<FetchCoins\>/FetchCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<CoinsEntry\>/CoinEntry/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<vHashTxnToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<vHashTxToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<fHadTxInCache\>/had_coin_in_cache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<coinbaseids\>/coinbase_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<disconnectedids\>/disconnected_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<duplicateids\>/duplicate_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<oldcoins\>/old_coin/g' src/test/coins_tests.cpp
sed -i 's/\<origcoins\>/orig_coin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
-END VERIFY SCRIPT-
2017-06-01 13:15:25 -07:00
Pieter Wuille 73de2c1ff3 Rename CCoinsCacheEntry::coins to coin 2017-06-01 13:15:25 -07:00
Pieter Wuille 119e552f7c Merge CCoinsViewCache's GetOutputFor and AccessCoin
They're doing the same thing now.
2017-06-01 13:15:25 -07:00
Pieter Wuille 580b023092 [MOVEONLY] Move old CCoins class to txdb.cpp
It's only used for upgrading from the old database anymore.
2017-06-01 13:15:25 -07:00
Pieter Wuille 8b25d2c0ce Upgrade from per-tx database to per-txout 2017-06-01 13:15:24 -07:00
Pieter Wuille b2af357f39 Reduce reserved memory space for flushing
As the maximum amount of data that can be pulled into the cache due to
a block validation is much lower now (at most one CCoin entry per input
and per output), reduce the conservative estimate used to determine
flushing time.
2017-06-01 13:15:06 -07:00
Pieter Wuille 41aa5b79a3 Pack Coin more tightly 2017-06-01 13:15:06 -07:00
Pieter Wuille 97072d6685 Remove unused CCoins methods 2017-06-01 13:15:03 -07:00
Pieter Wuille ce23efaa5c Extend coins_tests 2017-06-01 12:59:41 -07:00
Pieter Wuille 5083079688 Switch CCoinsView and chainstate db from per-txid to per-txout
This patch makes several related changes:
* Changes the CCoinsView virtual methods (GetCoins, HaveCoins, ...)
  to be COutPoint/Coin-based rather than txid/CCoins-based.
* Changes the chainstate db to a new incompatible format that is also
  COutPoint/Coin based.
* Implements reconstruction code for hash_serialized_2.
* Adapts the coins_tests unit tests (thanks to Russell Yanofsky).

A side effect of the new CCoinsView model is that we can no longer
use the (unreliable) test for transaction outputs in the UTXO set
to determine whether we already have a particular transaction.
2017-06-01 12:59:38 -07:00
Pieter Wuille 4ec0d9e794 Refactor GetUTXOStats in preparation for per-COutPoint iteration 2017-06-01 12:43:16 -07:00
Pieter Wuille 13870b56fc Replace CCoins-based CTxMemPool::pruneSpent with isSpent 2017-06-01 12:43:16 -07:00
Pieter Wuille 05293f3cb7 Remove ModifyCoins/ModifyNewCoins 2017-06-01 12:43:16 -07:00
Pieter Wuille 961e483979 Switch tests from ModifyCoins to AddCoin/SpendCoin 2017-06-01 12:43:12 -07:00
Russell Yanofsky 8906a9a0d2 Fix bumpfee test after #10449
Failure reported by Jorge Timón <jtimon@jtimon.cc>
https://github.com/bitcoin/bitcoin/pull/10449#issuecomment-305556569
2017-06-01 15:35:44 -04:00
Pieter Wuille 8b3868c1b4 Switch CScriptCheck to use Coin instead of CCoins 2017-06-01 11:56:06 -07:00
Matt Corallo c87b957a32 Only pass things committed to by tx's witness hash to CScriptCheck
This clarifies a bit more the ways in which the new script execution
cache could break consensus in the future if additional data from
the CCoins object were to be used as a part of script execution.

After this change, any such consensus breaks should be very visible
to reviewers, hopefully ensuring no such changes can be made.
2017-06-01 11:56:06 -07:00
Pieter Wuille f68cdfe92b Switch from per-tx to per-txout CCoinsViewCache methods in some places 2017-06-01 11:56:06 -07:00
Pieter Wuille 0003911326 Introduce new per-txout CCoinsViewCache functions
The new functions are:
* CCoinsViewCache::AddCoin: Add a single COutPoint/Coin pair.
* CCoinsViewCache::SpendCoin: Remove a single COutPoint.
* AddCoins: utility function that invokes CCoinsViewCache::AddCoin for
  each output in a CTransaction.
* AccessByTxid: utility function that searches for any output with
  a given txid.
* CCoinsViewCache::AccessCoin: retrieve the Coin for a COutPoint.
* CCoinsViewCache::HaveCoins: check whether a non-empty Coin exists
  for a given COutPoint.

The AddCoin and SpendCoin methods will eventually replace ModifyCoins
and ModifyNewCoins, AddCoins will replace CCoins::FromTx, and the new
AccessCoins and HaveCoins functions will replace their per-txid
counterparts.

Note that AccessCoin for now returns a copy of the Coin object. In a
later commit it will be change to returning a const reference (which
keeps working in all call sites).
2017-06-01 11:56:06 -07:00
Pieter Wuille bd83111a0f Optimization: Coin&& to ApplyTxInUndo
This avoids a prevector copy in ApplyTxInUndo.
2017-06-01 11:56:06 -07:00
Pieter Wuille cb2c7fdac2 Replace CTxInUndo with Coin
The earlier CTxInUndo class now holds the same information as the Coin
class. Instead of duplicating functionality, replace CTxInUndo with a
serialization adapter for Coin.
2017-06-01 11:56:06 -07:00
Wladimir J. van der Laan 39039b12a7
Merge #10475: [RPC] getmempoolinfo mempoolminfee is a BTC/KB feerate
f128f78 getmempool mempoolminfee is a BTC/KB feerate (Gregory Sanders)

Tree-SHA512: 5b32ffc0d2ba7ca623d4ce450fb67855d17b4fa8c3ffb8570a63dc53b3d476d52b39ad6190ac4357dbf01f6b535fa187cd8c34175a16469e9b00097e3bf2e2bc
2017-06-01 19:21:26 +02:00
Russell Yanofsky b9b814a38e Avoid CWalletTx copies in GetAddressBalances and GetAddressGroupings 2017-06-01 11:48:29 -04:00
Pavlos Antoniou 5f672ca8c1 net: Denote some CNode functions const 2017-06-01 17:21:03 +02:00
Jonas Schnelli 64beb13179
Merge #10449: Overhaul Qt fee bumper
6d7104c99 [Qt] make sure transaction table entry gets updated after bump (Jonas Schnelli)
32325a3f5 [Qt] hide bump context menu action if tx already has been bumped (Jonas Schnelli)

Tree-SHA512: d3e5991145879b7f6b212d9d9c6f423609dc8e6fa7f6feb7df931691f1dec2acb6ab162c2fb7e758d3ca3f3fb14363df2f50f0e83e83068da5cc7e6de35e69d2
2017-06-01 16:05:02 +02:00
Wladimir J. van der Laan cb1716acc7
Merge #10441: net: only enforce expected services for half of outgoing connections
b6fbfc2 net: only enforce the services required to connect (Cory Fields)

Tree-SHA512: 88943bff63213a734f3c96c45760cadaeb9ba18287c8a20c279851ebaf058a334c969028fb2180f155508e3eea4b838147382e4f2b655e7a9aa098eadc81d53e
2017-06-01 13:24:36 +02:00
Wladimir J. van der Laan b6b150b016
Merge #10469: Fixing typo in rpcdump.cpp
16d94d3 Fixing typo in rpcdump.cpp (James Evans)

Tree-SHA512: 84ef1b91c719131196ebed6b865e282b77bee7699614e15884ba59010239a3bbc1380dc8f856c83338f071e3eb3ca41c6b10f830816e6c794531cf6a965d63a9
2017-06-01 13:19:36 +02:00
Wladimir J. van der Laan f259263a7b
Merge #10447: Make bitcoind invalid argument error message specific
cd5622d Make bitcoind invalid argument error message specific (Wladimir J. van der Laan)

Tree-SHA512: 78999b9359685c4090f9a112e1d02bdddac22173f5f04600773b042acb9481ebb54d0f73d9d6d74249f845f497927a58d59de69bf33e3dccf096c3c80c7ebf6b
2017-06-01 10:51:03 +02:00
Wladimir J. van der Laan ef2d062c9f
Merge #10450: Fix bumpfee rpc "errors" return value
1b6602f Fix bumpfee rpc "errors" return value (Russell Yanofsky)

Tree-SHA512: a55d4dbe28c75f31fde3b7de60479265bb8f3777f432d1db321f1dd848d5274c353f757b09ed3cad9c69c08acbf3906679d27052267db943ab2b19629f79bd81
2017-06-01 10:48:19 +02:00
Karl-Johan Alm a473eff8f9
[bench] Replace 0.00(000)1 with MICRO/MILLI #defines in validation.cpp. 2017-06-01 11:43:04 +09:00
Karl-Johan Alm 5f850b0311
[bench] Include ms/blk stats in Connect* benchmarks. 2017-06-01 11:43:04 +09:00
practicalswift 5a9b508279 [trivial] Add end of namespace comments 2017-05-31 22:21:25 +02:00
Wladimir J. van der Laan 18ba984140
Merge #10467: add SeedNodes to CConnman::Options
5d67526 add SeedNodes to CConnman::Options (Marko Bencun)

Tree-SHA512: d732ab08697419f896d9598fa3c30030ddbe3b82a99a398d813ebcd5e1fc610ad1043fe0f4c51a7ec5c4d70ce93a9ac5a5c7a91fcaae046ec4f1f7c41523a360
2017-05-31 17:41:10 +02:00
Wladimir J. van der Laan 5dd69ce551
Merge #10479: [trivial] Fix comment for ForceSetArg()
42a83e5 [trivial] Fix comment for ForceSetArg() (John Newbery)

Tree-SHA512: 596db8b4bb01bca18908e254e5b364d3d4fcb0ea49d7d54314c65106e497efed65a877d80740bff88e090aeb772be1e46d4571ecca9b9263578f3f680f0bd0ce
2017-05-31 17:16:16 +02:00
Jonas Schnelli c1c9a95379
Merge #10454: Fix broken q4 test build
620444bd5 Fix broken q4 test build (Russell Yanofsky)

Tree-SHA512: 3247458541e5586e5a2cfc0abda3c54f140c676603ea5a3bdc0d11aae335d0221bbc818fc5fa458242fd4bacd326fca1013fc0320d5c91b672b8ca9684fb7bf8
2017-05-31 10:38:30 +02:00
Pieter Wuille f94b7d5bfa
Merge #10464: Introduce static DoWarning (simplify UpdateTip)
f28514576 Introduce static DoWarning (simplify UpdateTip) (Jorge Timón)

Tree-SHA512: 58b39f00bc921d47d199ef1cc15e9e36f918ec86e9182de46dc2f24fa9474853a92b18d330a274a3ea7c9b001681fdfa3d86aa2bbebb5c92ac8c5a6f7690dfc1
2017-05-30 17:23:30 -07:00
Jorge Timón b463bc9215
scripted-diff: s/BIP9DeploymentInfo/VBDeploymentInfo/
-BEGIN VERIFY SCRIPT-
sed -i 's/BIP9DeploymentInfo/VBDeploymentInfo/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
-END VERIFY SCRIPT-
2017-05-30 19:21:52 +02:00
shaolinfry 29c07196d0
Rename -bip9params to -vbparams 2017-05-30 19:21:51 +02:00
Wladimir J. van der Laan acd9957b72
Merge #9208: Improve DisconnectTip performance
c1235e3 Add RecursiveDynamicUsage overload for std::shared_ptr (Russell Yanofsky)
71f1903 Store disconnected block transactions outside mempool during reorg (Suhas Daftuar)
9decd64 [qa] Relax assumptions on mempool behavior during reorg (Suhas Daftuar)

Tree-SHA512: c160ad853a5cd060d0307af7606a0c77907497ed7033c9599b95e73d83f68fdfcd4214bd8a83db1c5b7a58022722b9de1ed2e6ea2e02f38a7b6c717f079dd0c6
2017-05-30 18:43:03 +02:00
John Newbery 42a83e5455 [trivial] Fix comment for ForceSetArg() 2017-05-30 08:21:16 -04:00
Marko Bencun 5d67526026 add SeedNodes to CConnman::Options
Start of a series of changes to clean up the instantiation of connman
by decoupling the command line arguments.
2017-05-30 09:21:47 +02:00
Wladimir J. van der Laan 5c63d665e5
Merge #10460: Broadcast address every day, not 9 hours
010d68e Broadcast address every day, not 9 hours (Pieter Wuille)

Tree-SHA512: 73a8b44b4b48784616e722b1e63561e35d669c2ee890dbc44e40191fdfd8fc1ef56710f4769ab6ea1f1a48fec0576f200c0b3812ca58fb143e7524006d1afed4
2017-05-30 07:17:02 +02:00
Gregory Sanders f128f78ddb getmempool mempoolminfee is a BTC/KB feerate 2017-05-29 14:14:07 -04:00
Cory Fields b6fbfc2282 net: only enforce the services required to connect
also once half of all outgoing nodes have our preferred flags, require only
minimal flags from the rest.
2017-05-28 10:20:07 -04:00
James Evans 16d94d3d03 Fixing typo in rpcdump.cpp 2017-05-27 16:44:10 +01:00
Jorge Timón f285145764
Introduce static DoWarning (simplify UpdateTip) 2017-05-27 06:33:39 +02:00
Pieter Wuille 422634e2f5 Introduce Coin, a single unspent output 2017-05-26 13:33:40 -07:00
Pieter Wuille 7d991b55db Store/allow tx metadata in all undo records
Previously, transaction metadata (height, coinbase or not, and before
the previous commit also nVersion) was only stored for undo records
that correspond to the last output of a transaction being spent.

This only saves 2 bytes per undo record. Change this to storing this
information for every undo record, and stop complaining for having it
in non-last output spends. This means that undo dat written with
this patch won't be readable by older versions anymore.
2017-05-26 13:33:39 -07:00
Pieter Wuille c3aa0c1194 Report on-disk size in gettxoutsetinfo 2017-05-26 13:33:39 -07:00