Commit Graph

10536 Commits

Author SHA1 Message Date
MarcoFalke 4ed818060e
Merge #10600: Make feebumper class stateless
aed1d90ac [wallet] Change feebumper from class to functions (Russell Yanofsky)
37bdcca3c [refactor] Make feebumper namespace (Russell Yanofsky)
7c4f00919 [trivial] Rename feebumper variables according to project code style (Russell Yanofsky)

Pull request description:

  Make feebumper methods static and remove stored state in the class.

  Having the results of feebumper calls persist in an object makes process
  separation between Qt and wallet awkward, because it means the feebumper object
  either has to be serialized back and forth between Qt and wallet processes
  between fee bump calls, or that the feebumper object needs to stay alive in the
  wallet process with an object reference passed back to Qt. It's simpler just to
  have fee bumper calls return their results immediately instead of storing them
  in an object with an extended lifetime.

  In addition to making feebumper methods static, also:

  - Move LOCK calls from Qt code to feebumper
  - Move TransactionCanBeBumped implementation from Qt code to feebumper
  - Rename CFeeBumper class to FeeBumper (every CFeeBumper reference had to be
    updated in this PR anyway so this doesn't increase the size of the diff)

  This change was originally part of https://github.com/bitcoin/bitcoin/pull/10244

Tree-SHA512: bf75e0c741b4e9c8912e66cc1dedf0ff715f77ea65fc33f7020d97d9099b0f6448f5852236dac63eea649de7d6fc03b0b21492e2c5140fb7560a39cf085506fd
2017-11-15 12:50:17 -05:00
Wladimir J. van der Laan 927a1d7d08
Merge #10286: Call wallet notify callbacks in scheduler thread (without cs_main)
89f0312 Remove redundant pwallet nullptr check (Matt Corallo)
c4784b5 Add a dev notes document describing the new wallet RPC blocking (Matt Corallo)
3ea8b75 Give ZMQ consistent order with UpdatedBlockTip on scheduler thread (Matt Corallo)
cb06edf Fix wallet RPC race by waiting for callbacks in sendrawtransaction (Matt Corallo)
e545ded Also call other wallet notify callbacks in scheduler thread (Matt Corallo)
17220d6 Use callbacks to cache whether wallet transactions are in mempool (Matt Corallo)
5d67a78 Add calls to CWallet::BlockUntilSyncedToCurrentChain() in RPCs (Matt Corallo)
5ee3172 Add CWallet::BlockUntilSyncedToCurrentChain() (Matt Corallo)
0b2f42d Add CallFunctionInQueue to wait on validation interface queue drain (Matt Corallo)
2b4b345 Add ability to assert a lock is not held in DEBUG_LOCKORDER (Matt Corallo)
0343676 Call TransactionRemovedFromMempool in the CScheduler thread (Matt Corallo)
a7d3936 Add a CValidationInterface::TransactionRemovedFromMempool (Matt Corallo)

Pull request description:

  Based on #10179, this effectively reverts #9583, regaining most of the original speedups of #7946.

  This concludes the work of #9725, #10178, and #10179.

  See individual commit messages for more information.

Tree-SHA512: eead4809b0a75d1fb33b0765174ff52c972e45040635e38cf3686cef310859c1e6b3c00e7186cbd17374c6ae547bfbd6c1718fe36f26c76ba8a8b052d6ed7bc9
2017-11-15 16:25:40 +01:00
Wladimir J. van der Laan aca77a4d58
Merge #11655: net: Assert state.m_chain_sync.m_work_header in ConsiderEviction
63c2d83 Explicitly state assumption that state.m_chain_sync.m_work_header != nullptr in ConsiderEviction (practicalswift)

Pull request description:

  Explicitly state assumption that `state.m_chain_sync.m_work_header != nullptr` in `ConsiderEviction(…)`.

  Static analyzer (and humans!) will see the null-check in ...

  ```
  else if (state.m_chain_sync.m_timeout == 0 || (state.m_chain_sync.m_work_header != nullptr && ...
  ```

  ... and infer that `state.m_chain_sync.m_work_header` might be set to `nullptr` when reaching `else if (state.m_chain_sync.m_timeout > 0 && time_in_seconds > state.m_chain_sync.m_timeout)` and thus flag `state.m_chain_sync.m_work_header->GetBlockHash().ToString()` as a potential null pointer dereference.

  This commit makes the tacit assumption of `state.m_chain_sync.m_work_header != nullptr` explicit.

  Code introduced in 5a6d00c6de ("Permit disconnection of outbound peers on bad/slow chains") which was merged into master four days ago.

  Friendly ping @sdaftuar :-)

Tree-SHA512: 32e5631025b7ba7556a02c89d040fbe339c482a03f28d0dbc9871c699e1f8ac867619b89c5fd41fdcfcf0dc4d7c859295b26ccd988572145cc244261aec18ce9
2017-11-15 13:55:40 +01:00
MarcoFalke 2adbddb038
Merge #10749: Use compile-time constants instead of unnamed enumerations (remove "enum hack")
1e65f0f33 Use compile-time constants instead of unnamed enumerations (remove "enum hack") (practicalswift)

Pull request description:

  Use compile-time constants instead of unnamed enumerations (remove "enum hack").

Tree-SHA512: 1b6ebb2755398c5ebab6cce125b1dfc39cbd1504d98d55136b32703fe935c4070360ab3b2f52b1da48ba9f3b01082d204f3d87c92ccb5c8c333731f7f972e128
2017-11-11 18:07:28 -05:00
MarcoFalke 13e352dc53
Merge #3716: GUI: Receive: Remove option to reuse a previous address
927f4ff5a GUI: Receive: Remove option to reuse a previous address (Luke Dashjr)

Pull request description:

  This was justified by the need to "resent" an invoice, but now that we have the request history, that need should be gone.

Tree-SHA512: 4ade4eb84a21bbbd8dcc3a2c9580d416e113284b5bdf350c22051c233101fe0ee31659c54a7a46e7136f9c999acb61efbbb3f97aeb2fa7b2b1e1daec02ca0837
2017-11-11 13:29:52 -05:00
MarcoFalke 95e14dc81d
Merge #11055: [wallet] [rpc] getreceivedbyaddress should return error if called with address not owned by the wallet
5e0ba8f8c [wallet] getreceivedbyaddress should return error if address is not mine (John Newbery)
ea0cd24f7 [tests] Tidy up receivedby.py (John Newbery)

Pull request description:

  Two commits:

  - First commit tidies up the `receivedby.py` test (and speeds it up by factor of two)
  - Second commit changes getreceivedbyaddress to return error if the address is not found in wallet, and adds test to `receivedby.py`

Tree-SHA512: e41342dcbd037a6b440cbe4ecd3b8ed589e18e477333f0d866f3564e948e0f5231e497d5ffb66da4e6680eb772d9f0cf839125098bb68b92d04a5ee35c6c0a81
2017-11-11 12:35:44 -05:00
Luke Dashjr 927f4ff5a2 GUI: Receive: Remove option to reuse a previous address
This was justified by the need to "resent" an invoice, but now that we have the request history, that need should be gone.
2017-11-11 07:51:08 +00:00
Pieter Wuille 033c78671b
Merge #11258: [rpc] Add initialblockdownload to getblockchaininfo
11413646b [trivial] (whitespace only) fix getblockchaininfo alignment (John Newbery)
bd9c18171 [rpc] Add initialblockdownload to getblockchaininfo (John Newbery)

Pull request description:

  Exposing whether the node is in IBD would help for testing, and may be useful in general, particularly for developers.

  First discussed in #10357 here: https://github.com/bitcoin/bitcoin/pull/10357#pullrequestreview-59963870

  > ... we could simplify this (and possibly other) tests by just adding a way to know if a node is in IBD. I'd like to do that, but I'm not sure it makes sense to complicate this PR with discussion over how that information should be made available. Eg it's not clear to me that the notion of being in IBD is worth exposing to the casual user, versus a hidden rpc call or something, since the definition has changed over time, and may continue to change in the future. But I still do agree that at least for testing purposes it would be far simpler to expose the field somehow...

   This PR currently implements the simplest way of doing this: adding an `initialblockdownload` field to `getblockchaininfo`. Other approaches we could take:

  1. add a new debug RPC method that exposes `IBD` and potentially other information.
  2. add a parameter to `getblockchaininfo`, eg `debug_info`, which would cause it to return debug information including IBD
  3. add a query string to the url `?debug=true` which would cause RPCs to return additional debug information.

  I quite like the idea of (3). Feedback on these and other approaches very much welcomed!

  @sdaftuar @laanwj

Tree-SHA512: a6dedd47f8c9bd38769cc597524466250041136feb33500644b9c48d0ffe4e3eeeb2587b5bbc6420364ebdd2667df807fbb50416f9a7913bbf11a14ea86dc0d4
2017-11-10 16:12:22 -08:00
Russell Yanofsky aed1d90aca [wallet] Change feebumper from class to functions
Change feebumper from a stateful class into a namespace of stateless
functions.

Having the results of feebumper calls persist in an object makes process
separation between Qt and wallet awkward, because it means the feebumper object
either has to be serialized back and forth between Qt and wallet processes
between fee bump calls, or that the feebumper object needs to stay alive in the
wallet process with an object reference passed back to Qt. It's simpler just to
have fee bumper calls return their results immediately instead of storing them
in an object with an extended lifetime.

In addition to making feebumper stateless, also:

- Move LOCK calls from Qt code to feebumper
- Move TransactionCanBeBumped implementation from Qt code to feebumper
2017-11-10 17:16:46 -05:00
Russell Yanofsky 37bdcca3c3 [refactor] Make feebumper namespace
Future commit will remove the FeeBumper class. This commit simply places
everything into a feebumper namespace, and changes the enum class name
from BumpeFeeResult to feebumper::Result.
2017-11-10 17:03:15 -05:00
Russell Yanofsky 7c4f009195 [trivial] Rename feebumper variables according to project code style
Future PRs will completely refactor this translation unit and touch all
this code so we rename the variables to follow project stlye guidelines
in this preparation commit.

Don't use m_ prefixes for member variables since we're going to remove
the class entirely in the next commits.
2017-11-10 17:01:41 -05:00
John Newbery 5e0ba8f8cd [wallet] getreceivedbyaddress should return error if address is not mine 2017-11-10 16:07:37 -05:00
MarcoFalke 61fb80660f
Merge #11269: [Mempool] CTxMemPoolEntry::UpdateAncestorState: modifySiagOps param type
203a4aa31 Fix CTxMemPoolEntry::UpdateAncestorState: modifySigOps param type int -> int64_t (donaloconnor)

Pull request description:

  CTxMemPoolEntry::CTxMemPoolEntry's modifySigOps parameter is int while update_ancestor_state::modifySigOpsCost is int64_t. This issue was raised in #11165. It looks like the function paramaters were not changed in commit 72abd2c

  This will avoid unexpected truncation of int64_t -> int

Tree-SHA512: 314c703f217e104336456859066d18fb0d12c4f9f32835e17490a6f29eb05951184095039e4e57edacef8ad35dd75c6d97d9af656a52209dd0c3779b4ffa0914
2017-11-10 15:33:30 -05:00
MarcoFalke 05a761932e
Merge #11353: Small refactor of CCoinsViewCache::BatchWrite()
5b9748f97 Small refactor of CCoinsViewCache::BatchWrite() (Dan Raviv)

Pull request description:

  `std::unordered_map::erase( const_iterator pos )` returns an iterator to the element following the removed one. Use that to optimize (probably minor-performance-wise, and definitely code-structure-wise) the implementation of `CCoinsViewCache::BatchWrite()`.

Tree-SHA512: 00abc838ad91771cfcddd45688841c9414869b75289d09b483a7f0ba835614fe189e9c8aca8a80e3de78ee397ec14083ae52e2e92b7863b3b6eb0d0cb892c9dd
2017-11-10 14:22:45 -05:00
MarcoFalke ee92243e66
Merge #11623: tests: Add missing locks to tests
109a85899 tests: Add missing locks to tests (practicalswift)

Pull request description:

  Add missing locks to tests to satisfy lock requirements (such as `EXCLUSIVE_LOCKS_REQUIRED(...)` (Clang Thread Safety Analysis, see #11226), `AssertLockHeld(...)` and implicit lock assumptions).

Tree-SHA512: 1aaeb1da89df1779f02fcceff9d2f8ea24a3926d421f9ea305a19be04dd0b3e63d91f6c1ed22fb7e6988343f6a5288829a387ef872cfa7b6add57bd01046b5d9
2017-11-10 11:54:16 -05:00
practicalswift 109a858995 tests: Add missing locks to tests
Add missing locks to tests to satisfy lock requirements (such as
EXCLUSIVE_LOCKS_REQUIRED(...) (Clang Thread Safety Analysis),
AssertLockHeld(...) and implicit lock assumptions).
2017-11-10 17:16:07 +01:00
MarcoFalke 22cdf93c06
Merge #11316: [qt] Add use available balance in send coins dialog (CryptAxe, promag)
d052e3847 [qt] Add use available balance in send coins dialog (CryptAxe)

Pull request description:

  This is an alternative to #11098 to handle #11033 where a new button `Use available balance` is added to each entry. When activated, the available balance is calculated by using the coin control (if any) and then it's subtracted the remaining recipient amounts. If this amount is positive then the `Subtract fee from amount` is automatically selected.

  Comparing to #11098, this has the advantage to avoid the fair amount division over the recipients and allows to fine adjust the amounts in multiple iterations.

  Started from @CryptAxe commit 89e9eda to credit some code.

  <img width="965" alt="screen shot 2017-09-13 at 01 32 44" src="https://user-images.githubusercontent.com/3534524/30354518-e1bee31c-9824-11e7-9354-300aa63cdfd0.png">
  <img width="964" alt="screen shot 2017-09-13 at 01 44 57" src="https://user-images.githubusercontent.com/3534524/30354598-5731ac9c-9825-11e7-9d5f-8781988ed219.png">

Tree-SHA512: 01d20c13fd8b6c2a0ca1d74d3a9027c6922e6dccd3b08e59d5a72636be7072ed5eca7ebc5d431299497dd3374e83753220ad4174d8bc46dadb4b2f54973036a5
2017-11-10 10:43:55 -05:00
practicalswift 63c2d83e58 Explicitly state assumption that state.m_chain_sync.m_work_header != nullptr in ConsiderEviction
Static analyzer (and humans!) will see ...

```
else if (state.m_chain_sync.m_timeout == 0 || (state.m_chain_sync.m_work_header != nullptr && ...
```

... and infer that state.m_chain_sync.m_work_header might be set to nullptr,
and thus flag `state.m_chain_sync.m_work_header->GetBlockHash().ToString()`
as a potential null pointer dereference.

This commit makes the tacit assumption (m_work_header != nullptr) explicit.

Code introduced in 5a6d00 ("Permit disconnection of outbound peers on
bad/slow chains") which was merged into master four days ago.
2017-11-10 15:37:37 +01:00
Wladimir J. van der Laan fe503e118f
Merge #11646: Require a steady clock for bench with at least micro precision
620bae3 Require a steady clock for bench with at least micro precision (Matt Corallo)

Pull request description:

  Using a non-steady high_precision_clock by default is definitely not what we want, and in practice steady_clock has more than enough precision. Should double-check that travis passes on this one to make sure we actually have at least microsecond precision on all platforms.

Tree-SHA512: 54a4af3b6addca9897e8ab04694f9461343691b475ca3ed2368595c37520612e284969be94a8ee3d7c66d16532f7bb16b6ad80284cbc153653e8ef2d56696e9d
2017-11-10 08:20:43 +01:00
Wladimir J. van der Laan 5e9be169e4
Merge #11043: Use std::unique_ptr (C++11) where possible
a357293 Use MakeUnique<Db>(...) (practicalswift)
3e09b39 Use MakeUnique<T>(...) instead of std::unique_ptr<T>(new T(...)) (practicalswift)
8617989 Add MakeUnique (substitute for C++14 std::make_unique) (practicalswift)
d223bc9 Use unique_ptr for pcoinscatcher/pcoinsdbview/pcoinsTip/pblocktree (practicalswift)
b45c597 Use unique_ptr for pdbCopy (Db) and fix potential memory leak (practicalswift)
29ab96d Use unique_ptr for dbenv (DbEnv) (practicalswift)
f72cbf9 Use unique_ptr for pfilter (CBloomFilter) (practicalswift)
8ccf1bb Use unique_ptr for sem{Addnode,Outbound} (CSemaphore) (practicalswift)
73db063 Use unique_ptr for upnp_thread (boost::thread) (practicalswift)
0024531 Use unique_ptr for dbw (CDBWrapper) (practicalswift)
fa6d122 Use unique_ptr:s for {fee,short,long}Stats (TxConfirmStats) (practicalswift)
5a6f768 Use unique_ptr for httpRPCTimerInterface (HTTPRPCTimerInterface) (practicalswift)
860e912 Use unique_ptr for pwalletMain (CWallet) (practicalswift)

Pull request description:

  Use `std::unique_ptr` (C++11) where possible.

  Rationale:
  1. Avoid resource leaks (specifically: forgetting to `delete` an object created using `new`)
  2. Avoid undefined behaviour (specifically: double `delete`:s)

  **Note to reviewers:** Please let me know if I've missed any obvious `std::unique_ptr` candidates. Hopefully this PR should cover all the trivial cases.

Tree-SHA512: 9fbeb47b800ab8ff4e0be9f2a22ab63c23d5c613a0c6716d9183db8d22ddbbce592fb8384a8b7874bf7375c8161efb13ca2197ad6f24b75967148037f0f7b20c
2017-11-09 21:34:25 +01:00
Wladimir J. van der Laan e6e3fc3951
Merge #11272: CKeystore/CCrypter: move relevant implementation out of the header
dd9bb25 Fix code style in keystore.cpp/crypter.cpp (Jonas Schnelli)
208fda6 CCrypter: move relevant implementation out of the header (Jonas Schnelli)
3155fd2 CKeystore: move relevant implementation out of the header (Jonas Schnelli)

Pull request description:

Tree-SHA512: 4ce73cca5609199b74b8ff2614ee2b6af949545a1332a3a0135c6453c98665d2b0da171c1e390c9a2aec6b12b7fad931ec90084bb7c2defe243786bfc70daf60
2017-11-09 21:11:57 +01:00
Matt Corallo 620bae34cf Require a steady clock for bench with at least micro precision 2017-11-09 14:36:11 -05:00
Wladimir J. van der Laan 1f4375f8e7
Merge #11580: Do not send (potentially) invalid headers in response to getheaders
725b79a [test] Verify node doesn't send headers that haven't been fully validated (Russell Yanofsky)
3788a84 Do not send (potentially) invalid headers in response to getheaders (Matt Corallo)

Pull request description:

  Nowhere else in the protocol do we send headers which are for
  blocks we have not fully validated except in response to getheaders
  messages with a null locator. On my public node I have not seen any
  such request (whether for an invalid block or not) in at least two
  years of debug.log output, indicating that this should have minimal
  impact.

Tree-SHA512: c1f6e0cdcdfb78ea577d555f9b3ceb1b4b60eff4f6cf313bfd8b576c9562d797bea73abc23f7011f249ae36dd539c715f3d20487ac03ace60e84e1b77c0c1e1a
2017-11-09 19:57:47 +01:00
practicalswift a357293c87 Use MakeUnique<Db>(...) 2017-11-09 16:53:34 +01:00
practicalswift 3e09b390b4 Use MakeUnique<T>(...) instead of std::unique_ptr<T>(new T(...)) 2017-11-09 16:53:34 +01:00
practicalswift 86179897e2 Add MakeUnique (substitute for C++14 std::make_unique)
From @ryanofsky:s #10973. Thanks!
2017-11-09 16:53:34 +01:00
practicalswift d223bc940a Use unique_ptr for pcoinscatcher/pcoinsdbview/pcoinsTip/pblocktree
* pcoinscatcher (CCoinsViewErrorCatcher)
* pcoinsdbview (CCoinsViewDB)
* pcoinsTip (CCoinsViewCache)
* pblocktree (CBlockTreeDB)
* Remove variables shadowing pcoinsdbview
2017-11-09 16:53:34 +01:00
practicalswift b45c597caa Use unique_ptr for pdbCopy (Db) and fix potential memory leak 2017-11-09 16:53:34 +01:00
practicalswift 29ab96dbd2 Use unique_ptr for dbenv (DbEnv) 2017-11-09 16:53:34 +01:00
practicalswift f72cbf9ba9 Use unique_ptr for pfilter (CBloomFilter) 2017-11-09 16:53:34 +01:00
practicalswift 8ccf1bb0c3 Use unique_ptr for sem{Addnode,Outbound} (CSemaphore) 2017-11-09 16:52:44 +01:00
practicalswift 73db0635a3 Use unique_ptr for upnp_thread (boost::thread) 2017-11-09 16:52:44 +01:00
practicalswift 0024531625 Use unique_ptr for dbw (CDBWrapper) 2017-11-09 16:52:44 +01:00
practicalswift fa6d1228e9 Use unique_ptr:s for {fee,short,long}Stats (TxConfirmStats) 2017-11-09 16:52:44 +01:00
practicalswift 5a6f768896 Use unique_ptr for httpRPCTimerInterface (HTTPRPCTimerInterface) 2017-11-09 16:52:44 +01:00
practicalswift 860e912583 Use unique_ptr for pwalletMain (CWallet) 2017-11-09 16:52:44 +01:00
Matt Corallo 9e9e31aa10 Fix qt build broken by 5a5e4e9 2017-11-09 10:43:13 -05:00
Wladimir J. van der Laan 99ec12666b
Merge #11074: Assert that CWallet::SyncMetaData finds oldest transaction.
6c4042a Assert that CWallet::SyncMetaData finds oldest transaction. (Eelis)

Pull request description:

  Without this assert, the Clang static analyzer warns about subsequent dereferencing of copyFrom, because it can't be sure that it's not nullptr. See #9573.

Tree-SHA512: 83cbcb32c52c94fcfefbc90ec7de2011dacd6bdb0da35adc401b8d8dda6a86de2fa0403e2158592268c2cf15eef4f3d887d98c90f1031d4735d5f4bf9dbc1d23
2017-11-09 15:20:18 +01:00
Wladimir J. van der Laan 77ba4bf960
Merge #10368: [wallet] Remove helper conversion operator from wallet
5a5e4e9 [wallet] Remove CTransaction&() helper conversion operator from wallet implementation. (Karl-Johan Alm)

Pull request description:

  The `CTransaction&()` operator in `CMerkleTx` makes conversion into `CTransaction`s transparent, but was marked as to-be-removed in favor of explicitly getting the `tx` ivar, presumably as the operator can lead to ambiguous behavior and makes the code harder to follow.

  This PR removes the operator and adapts callers. This includes some cases of `static_cast<CTransaction>(wtx)` → `*wtx.tx`, which is definitely an improvement.

Tree-SHA512: 95856fec7194d6a79615ea1c322abfcd6bcedf6ffd0cfa89bbdd332ce13035fa52dd4b828d20df673072dde1be64b79c513529a6f422dd5f0961ce722a32d56a
2017-11-09 14:23:13 +01:00
Wladimir J. van der Laan ef3758d1ef
Merge #10696: Remove redundant nullptr checks before deallocation
b109a1c Remove redundant nullptr checks before deallocation (practicalswift)

Pull request description:

  Rationale:
  * `delete ptr` is a no-op if `ptr` is `nullptr`

Tree-SHA512: c98ce769125c4912186a8403cc08a59cfba85b7141af645c709b4c4eb90dd9cbdd6ed8076d50099d1e4ec2bf75917d1af6844082ec42bbb4d94d229a710e051c
2017-11-09 13:38:48 +01:00
Wladimir J. van der Laan 0ecc6305f4
Merge #11594: Improve -disablewallet parameter interaction
7963335 Fix -disablewallet default value (João Barbosa)
b411c2a Improve -disablewallet parameter interaction (João Barbosa)

Pull request description:

  The first commit logs a message for each configured wallet if `-disablewallet` is set:
  ```
  bitcoind -printtoconsole -regtest -disablewallet -wallet=foo -wallet=bar
  ...
  WalletParameterInteraction: parameter interaction: -disablewallet -> ignoring -wallet=foo
  WalletParameterInteraction: parameter interaction: -disablewallet -> ignoring -wallet=bar
  ```
  It also moves up the `-disablewallet` check which avoids the unnecessary `-wallet` soft set.

  The second commit fixes the default value of `-disablewallet`, currently the value is correct, but it should use `DEFAULT_DISABLE_WALLET`.

  The third commit can be dropped or squashed, just took the opportunity to fix the coding style there.

Tree-SHA512: bec13d2b2be5adf4680c77212020ed27dd05f15c4c73542d2005d91108bf704e2df1707ed2bec696e584ecd40eff7a63e25201fd70400222aa5a8da6aed6afeb
2017-11-09 13:32:35 +01:00
Wladimir J. van der Laan 0dec4cc300
Merge #11221: Refactor: simpler read
9db9d62 Refactor: make the read function simpler (gnuser)

Pull request description:

Tree-SHA512: 5a80cc1b841488323d421e6a40b245d149cab1988247aed6cc7468dcc042d3df15b6711f25e40ff16e03ac21de36adbaa1d8da61ccdb94f97c8b70c24a5eedc5
2017-11-09 13:16:03 +01:00
practicalswift 7536b08c10 trivial: Fix typo – alreardy → already 2017-11-08 11:36:18 +01:00
Wladimir J. van der Laan 77546a3182
Merge #11289: Add wallet backup text to import* and add* RPCs
c098c58 Wrap dumpwallet warning and note scripts aren't dumped (MeshCollider)
a38bfbc Add wallet backup text to import*, add* and dumpwallet RPCs (MeshCollider)

Pull request description:

  Closes https://github.com/bitcoin/bitcoin/issues/11243

  Adds "Requires a new wallet backup" text to `addwitnessaddress`, `importprivkey`, `importmulti`, `importaddress`, `importpubkey`, and `addmultisigaddress`. Also adds a warning to `dumpwallet` that backing up the seed alone is not sufficient to back up non-HD addresses

Tree-SHA512: 76d7cdca54d5b458acf479154620322391b889922525fddd6153f4164cfee393ad743757400cb8f6b1b30f24947df68ea9043b4e509f7df77a8fa05dda370933
2017-11-08 10:29:11 +01:00
Wladimir J. van der Laan 5ef3b6967b
Merge #11524: [net] De-duplicate connection eviction logic
5ce7cb9 [net] De-duplicate connection eviction logic (Thomas Snider)

Pull request description:

  While reviewing the safeguards against deliberate node isolation on the network by malicious actors, I found a good de-duplication candidate.

  I think this form is much more legible (the type of `cutoffs` notwithstanding).  ReverseCompareNodeTimeConnected is not included in the list since the cutoff size is a function of the remaining number of nodes in the candidate eviction set.

Tree-SHA512: ed17999fa9250dcf8448329219324477117e4ecd2d41dedd72ad253e44630eef50b3232c420f1862ebbfb9b8c94efbba1a235b519e39ff5946865c7d69a75280
2017-11-08 08:46:50 +01:00
Wladimir J. van der Laan 5776582b7f
Merge #11562: bench: use std::chrono rather than gettimeofday
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields)
c515d26 bench: switch to std::chrono for time measurements (Cory Fields)

Pull request description:

  gettimeofday has portability issues, see for example #11558.

  Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself.

  Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead.

Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
2017-11-08 08:33:07 +01:00
Thomas Snider 5ce7cb9518 [net] De-duplicate connection eviction logic 2017-11-07 15:33:15 -08:00
Cory Fields 24a0bddf4a bench: prefer a steady clock if the resolution is no worse 2017-11-07 17:17:34 -05:00
Cory Fields c515d266ec bench: switch to std::chrono for time measurements
std::chrono removes portability issues.

Rather than storing doubles, store the untouched time_points. Then
convert to nanoseconds for display. This allows for maximum precision, while
keeping results comparable between differing hardware/operating systems.

Also, display full nanosecond counts rather than sub-second floats.
2017-11-07 17:15:58 -05:00
MarcoFalke dd561667cb
Merge #11389: Support having SegWit always active in regtest (sipa, ajtowns, jnewbery)
d61845818 Have SegWit active by default (Pieter Wuille)
4bd89210a Unit tests for always-active versionbits. (Anthony Towns)
d07ee77ab Always-active versionbits support (Pieter Wuille)
18e071841 [consensus] Pin P2SH activation to block 173805 on mainnet (John Newbery)
526023aa7 Improve handling of BIP9Deployment limits (Anthony Towns)

Pull request description:

  Most tests shouldn't have to deal with the now-historical SegWit activation transition (and other deployments, but SegWit is certainly the hardest one to accomodate).

  This PR makes a versionbits starttime of -1 equal to "always active", and enables it by default for SegWit on regtest. Individual tests can override this by using the existing `-vbparams` option.

  A few unit tests and functional tests are adapted to indeed override vbparams, as they specifically test the transition.

  This is in preparation for wallet SegWit support, but I thought having earlier eyes on it would be useful.

Tree-SHA512: 3f07a7b41cf46476e6c7a5c43244e68c9f41d223482cedaa4c02a3a7b7cd0e90cbd06b84a1f3704620559636a2268f5767d4c52d09c1b354945737046f618fe5
2017-11-07 17:05:46 -05:00