Commit graph

13668 commits

Author SHA1 Message Date
darosior
c59e3a3261 getrawtransaction: inform about blockhash argument when lookup fails 2019-06-14 23:02:19 +02:00
practicalswift
d9753383b9 addrdb: Remove temporary files created in SerializeFileDB. Fixes non-determinism in unit tests. 2019-06-14 08:30:43 +02:00
Chris Moore
71fd628ada
Add example 2nd arg to signrawtransactionwithkey
The RPC examples for signrawtransactionwithkey are missing the 2nd parameter.
2019-06-13 19:33:28 -07:00
MarcoFalke
fa8f195195
Replace remaining fprintf with tfm::format manually 2019-06-13 11:46:38 -04:00
MarcoFalke
fac03ec43a
scripted-diff: Replace fprintf with tfm::format
-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended -e 's/fprintf\(std(err|out), /tfm::format(std::c\1, /g' $(git grep -l 'fprintf(' -- ':(exclude)src/crypto' ':(exclude)src/leveldb' ':(exclude)src/univalue' ':(exclude)src/secp256k1')
-END VERIFY SCRIPT-

fixup! scripted-diff: Replace fprintf with tfm::format
2019-06-13 10:32:52 -04:00
MarcoFalke
fa72a64b90
tinyformat: Add doc to Bitcoin Core specific strprintf 2019-06-13 09:30:40 -04:00
Jonas Schnelli
431d81b61c
Merge #15991: Bugfix: fix pruneblockchain returned prune height
f402012cc fixup: Fix prunning test (João Barbosa)
97f517dd8 Fix RPC/pruneblockchain returned prune height (Jonas Schnelli)

Pull request description:

  The help of `pruneblockchain` tells us that the return value is `Height of the last block pruned.`,... but the implementation naively returns the provided input `height` and therefore not respecting that pruning can't be done on all possible blockheight due to the fact that we only prune complete blockfiles (which combine multiple blocks).

  This fixes the return value to actually return the correct prune height.

ACKs for commit f40201:
  MarcoFalke:
    ACK f402012ccf

Tree-SHA512: 88c910030ffb83196663e5ebebc29d036fcdbbb2ab266e4538991867924a61bacd8361c1fbf294a0ea7e02347ae183d792f10a10b8f6187e8a4c4c6e4124d7e6
2019-06-13 13:34:18 +02:00
fanquake
afab1312c5
Merge #16118: gui: Enable open wallet menu on setWalletController
75485ef09 gui: Enable open wallet menu on setWalletController (João Barbosa)

Pull request description:

  `BitcoinApplication::initializeResult` and `BitcoinGUI::setWalletController` are only called after the startup rescan is completed. While the rescan is in progress the window menus are already available.

  This PR makes the Open Wallet menu disabled until `BitcoinGUI::setWalletController` is called.

  ![Screenshot 2019-05-29 at 14 17 48](https://user-images.githubusercontent.com/3534524/58560510-35377480-821d-11e9-8f96-d0573c9e47b0.png)

  Fixes #16087

ACKs for commit 75485e:
  jonasschnelli:
    utACK 75485ef096
  ryanofsky:
    utACK 75485ef096. It's a simple, sensible fix.

Tree-SHA512: 9395ceed54bbceb6cbf1cd443f783d07a6ebb8fc5515b63c6e1b8b19b216b08d1cba7eaf872814d7c426ab7192f3b416ba0d57fc84f3bcbfebf01ce153794201
2019-06-13 16:47:38 +08:00
MarcoFalke
f792395d13
Merge #15834: Fix transaction relay bugs introduced in #14897 and expire transactions from peer in-flight map
308b76732f Fix bug around transaction requests (Suhas Daftuar)
f635a3ba11 Expire old entries from the in-flight tx map (Suhas Daftuar)
e32e08407e Remove NOTFOUND transactions from in-flight data structures (Suhas Daftuar)
23163b7593 Add an explicit memory bound to m_tx_process_time (Suhas Daftuar)
218697b645 Improve NOTFOUND comment (Suhas Daftuar)

Pull request description:

  #14897 introduced several bugs that could lead to a node no longer requesting transactions from one or more of its peers.  Credit to ajtowns for originally reporting many of these bugs along with an originally proposed fix in #15776.

  This PR does a few things:

  - Fix a bug in NOTFOUND processing, where the in-flight map for a peer was keeping transactions it shouldn't

  - Eliminate the possibility of a memory attack on the CNodeState `m_tx_process_time` data structure by explicitly bounding its size

  - Remove entries from a peer's in-flight map after 10 minutes, so that we should always eventually resume transaction requests even if there are other bugs like the NOTFOUND one

  - Fix a bug relating to the coordination of request times when multiple peers announce the same transaction

  The expiry mechanism added here is something we'll likely want to remove in the future, but is belt-and-suspenders for now to try to ensure we don't have other bugs that could lead to transaction relay failing due to some unforeseen conditions.

ACKs for commit 308b76:
  ajtowns:
    utACK 308b76732f
  morcos:
    light ACK 308b767
  laanwj:
    Code review ACK 308b76732f
  jonatack:
    Light ACK 308b76732f.
  jamesob:
    ACK 308b76732f
  MarcoFalke:
    ACK 308b76732f (Tested two of the three bugs this pull fixes, see comment above)
  jamesob:
    Concept ACK 308b76732f
  MarcoFalke:
    ACK 308b76732f

Tree-SHA512: 8865dca5294447859d95655e8699085643db60c22f0719e76e961651a1398251bc932494b68932e33f68d4f6084579ab3bed7d0e7dd4ac6c362590eaf9414eda
2019-06-12 12:33:01 -04:00
Ben Woosley
b748bf6f50
Fix spelling errors identified by codespell 1.15.0
After this commit, the only remaining output is:

  $ test/lint/lint-spelling.sh
  src/test/base32_tests.cpp:14: fo  ==> of, for
  src/test/base64_tests.cpp:14: fo  ==> of, for
  ^ Warning: codespell identified likely spelling errors. Any false positives? Add them to the list of ignored words in test/lint/lint-spelling.ignore-words.txt

Note:
* I ignore several valid alternative spellings
* homogenous is present in tinyformat, hence should be addressed upstream
* process' is correct only if there are plural processes
2019-06-11 17:18:16 +02:00
Jonas Schnelli
97f517dd85
Fix RPC/pruneblockchain returned prune height 2019-06-11 10:21:40 +02:00
Matt Corallo
8053e5cdad Remove -mempoolreplacement to prevent needless block prop slowness.
At this point there is no reasonable excuse to disable opt-in RBF,
and, unlike when this option was added, there are now significant
issues created when disabling it (in the form of compact block
reconstruction failures). Further, it breaks a lot of modern wallet
behavior.
2019-06-08 09:32:33 -04:00
Wladimir J. van der Laan
5d2ccf0ce9
Merge #15024: Allow specific private keys to be derived from descriptor
53b7de629d Add test for dumping the private key imported from descriptor (MeshCollider)
2857bc4a64 Extend importmulti descriptor tests (MeshCollider)
81a884bbd0 Import private keys from descriptor with importmulti if provided (MeshCollider)
a4d1bd1a29 Add private key derivation functions to descriptors (MeshCollider)

Pull request description:

  ~This is based on #14491, review the last 3 commits only.~

  Currently, descriptors have an Expand() function which returns public keys and scripts for a specific index of a ranged descriptor. But the private key for a specific index is not given. This allows private keys for specific indices to be derived. This also allows those keys to be imported through the `importmulti` RPC rather than having to provide them separately.

ACKs for commit 53b7de:
  achow101:
    ACK 53b7de629d

Tree-SHA512: c060bc01358a1adc76d3d470fefc2bdd39c837027f452e9bc4bd2e726097e1ece4af9d5627efd942a5f8819271e15ba54f010b169b50a9435a1f0f40fd1cebf3
2019-06-07 15:46:36 +02:00
MarcoFalke
fa2b083c3f
[test] Add test to check mempool consistency in case of reorgs 2019-06-07 11:07:23 +02:00
MarcoFalke
fabeb1f613
validation: Add missing mempool locks 2019-06-07 11:07:09 +02:00
MarcoFalke
fa0c9dbf91
txpool: Make nTransactionsUpdated atomic 2019-06-07 11:06:00 +02:00
MarcoFalke
d0f81a96d9
Merge #16129: refactor: Remove unused includes
67f4e9c522 Include core_io.h from core_read.cpp (practicalswift)
eca9767673 Make reasoning about dependencies easier by not including unused dependencies (practicalswift)

Pull request description:

  Make reasoning about dependencies easier by not including unused dependencies.

  Please note that the removed headers are _not_ "transitively included" by other still included headers. Thus the removals are real.

  As an added bonus this change means less work for the preprocessor/compiler. At least 51 393 lines of code no longer needs to be processed:

  ```
  $ git diff -u HEAD~1 | grep -E '^\-#include ' | cut -f2 -d"<" | cut -f1 -d">" | \
        sed 's%^%src/%g' | xargs cat | wc -l
  51393
  ```

  Note that 51 393 is the lower bound: the real number is likely much higher when taking into account transitively included headers :-)

ACKs for commit 67f4e9:

Tree-SHA512: 0c8868aac59813f099ce53d5307eed7962dd6f2ff3546768ef9e5c4508b87f8210f1a22c7e826c3c06bebbf28bdbfcf1628ed354c2d0fdb9a31a42cefb8fdf13
2019-06-06 16:41:40 +02:00
Wladimir J. van der Laan
9fccdd4ed4
Merge #15886: qt, wallet: Revamp SendConfirmationDialog
78f9b5160f Do not show list for the only recipient. (Hennadii Stepanov)
2ee756f041 Show recipient list as detailedText of QMessageBox (Hennadii Stepanov)
654e419549 Make SendConfirmationDialog fully fledged (Hennadii Stepanov)

Pull request description:

  Fix #15667

  With this PR:
  ![Screenshot from 2019-04-24 23-47-30](https://user-images.githubusercontent.com/32963518/56692672-63400b00-66eb-11e9-87f6-15957c6e81f7.png)
  ![Screenshot from 2019-04-24 23-47-40](https://user-images.githubusercontent.com/32963518/56692681-663afb80-66eb-11e9-8b04-8a342026ada6.png)

ACKs for commit 78f9b5:
  laanwj:
    code review ACK 78f9b5160f

Tree-SHA512: f868d78d01b0898aff2277fa3a7e8c6f936acbbcfa8a0323cddcd9daba4a998030c667bd803ae67c2b9179ed8082a48a67568e9ba3c8d14e3a2d88d93ada94fa
2019-06-06 13:12:17 +02:00
Wladimir J. van der Laan
fc6cbc31e9
Merge #15689: netaddress: Update CNetAddr for ORCHIDv2
8be3f3063 netaddress: Update CNetAddr for ORCHIDv2 (Carl Dong)

Pull request description:

  ```
  The original ORCHID prefix was deprecated as of 2014-03, the new
  ORCHIDv2 prefix was allocated by RFC7343 as of 2014-07. We did not
  consider the original ORCHID prefix routable, and I don't see any reason
  to consider the new one to be either.
  ```

  Would like to know if people think this kind of thing is even worth keeping the codebase updated for. Perhaps it'd be nice to write a devtool to pull the csv from [here](https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml) and generate the code.

ACKs for commit 8be3f3:
  laanwj:
    utACK 8be3f3063
  ryanofsky:
    utACK 8be3f30633. Only change since last review is rebasing after #15718 merge.

Tree-SHA512: 7c93317f597b1a6c1443e12dd690010392edb9d72a479a8201970db7d3444fbb99a80b98026caad6fbfbebb455ab4035d2dde79bc9263bfd1d0398cd218392e1
2019-06-06 12:52:54 +02:00
MeshCollider
81a884bbd0 Import private keys from descriptor with importmulti if provided 2019-06-06 22:03:55 +12:00
MeshCollider
a4d1bd1a29 Add private key derivation functions to descriptors 2019-06-06 22:03:55 +12:00
practicalswift
67f4e9c522 Include core_io.h from core_read.cpp 2019-06-06 08:00:33 +02:00
practicalswift
0959d37e3e Don't use global (external) symbols for symbols that are used in only one translation unit 2019-06-06 07:45:56 +02:00
Wladimir J. van der Laan
d936cf9eaf
Merge #15985: Add test for GCC bug 90348
58e291cfa Add test for GCC bug 90348 (Pieter Wuille)

Pull request description:

  This adds a test for GCC bug 90348 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348), using a test case extracted from our own `sha256d64` test in crypto_tests.cpp, which was failing on some platforms.

  This is based on top of #15983 to make sure the bug doesn't trigger (it does in some Travis configurations without it).

ACKs for commit 58e291:

Tree-SHA512: 4dc9084e92dd143a53930e42bb68e33d922a2a2b891406b259d3a0bed4511dcc49e7447a7a8e4eb793a26e3eacb188ca293b71e0e061f9b3230f8e7fcfd29525
2019-06-05 14:35:11 +02:00
Wladimir J. van der Laan
52ec4c64e8
Merge #16144: wallet: do not encrypt wallets with disabled private keys
7860c98bd wallet: do not encrypt wallets with disabled private keys (whythat)

Pull request description:

  Fix for #15635.
  Throw an `RPC_WALLET_ENCRYPTION_FAILED` error when attempting to encrypt wallet with disabled private keys. Changed `test/function/wallet_createwallet.py` to test new behavior.

ACKs for commit 7860c9:
  achow101:
    utACK 7860c98bd5
  meshcollider:
    utACK 7860c98bd5

Tree-SHA512: d0cc40efd303a00d0b4d3cb2de59d8d2d7dd35647e7f3fe9d4a8986589499c1f567c5780c83a129e1ab8dbe601279c459c6ebce3b48b1d81d47a28616ef4a369
2019-06-05 12:49:35 +02:00
Wladimir J. van der Laan
5d37c1bde0
Merge #15976: refactor: move methods under CChainState (pt. 1)
403e677c9 refactoring: IsInitialBlockDownload -> CChainState (James O'Beirne)
3ccbc376d refactoring: FlushStateToDisk -> CChainState (James O'Beirne)
4d6688603 refactoring: introduce ChainstateActive() (James O'Beirne)
d7c97edee move-only: make the CChainState interface public (James O'Beirne)

Pull request description:

  This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11):

  Parent PR: #15606
  Issue: #15605
  Specification: https://github.com/jamesob/assumeutxo-docs/tree/2019-04-proposal/proposal

  ---

  This changeset starts moving functionality intimately related to CChainState into methods. Parameterizing these functions by a particular CChainState is necessary for the use of multiple chainstates simultaneously (e.g. for asynchronous background validation).

  In this change, we
  - make the CChainState interface public - since other units will start to invoke its methods directly,
  - introduce `::ChainstateActive()`, the CChainState equivalent for `::ChainActive()`,
  - and move `IsInitialBlockDownload()` and `FlushStateToDisk()` into methods on CChainState.

  Independent of assumeutxo, these changes better encapsulate chainstate behavior and allow easier use from a testing context.

  There are more methods that we'll move in the future, but they require other substantial changes (i.e. moving ownership of the `CCoinsView*` hierarchy into CChainState) so we'll save them for future PRs.

  ---

  The first move-only commit is most easily reviewed with `git diff ... --color-moved=dimmed_zebra`.

ACKs for commit 403e67:
  Empact:
    utACK 403e677c9e no need to address my nits herein
  Sjors:
    utACK 403e677
  ryanofsky:
    utACK 403e677c9e. Only change since previous review is removing global state comment as suggested.
  MarcoFalke:
    utACK 403e677c9e, though the diff still seems a bit bloated with some unnecessary changes in the second commit.
  promag:
    utACK 403e677 and rebased with current [master](c7cfd20a7).

Tree-SHA512: 6fcf260bb2dc201361170c0b4547405366f5f331fcc3a2bac29b24442814b7b244ca1b58aac5af716885f9a130c343b544590dff780da0bf835c7c5b3ccb2257
2019-06-05 11:56:23 +02:00
whythat
7860c98bd5 wallet: do not encrypt wallets with disabled private keys 2019-06-04 16:39:34 +03:00
Wladimir J. van der Laan
6520330087
Merge #16044: qt: fix opening bitcoin.conf via Preferences on macOS
6e6494b3fb qt: fix opening bitcoin.conf via Preferences on macOS; see #15409 (shannon1916)

Pull request description:

  Fix #15409. The QT wallet fail to open the configuration file on Mac, when these is no default application for `*.conf` files.

  Here is a feasible way to solve this bug. When `QDesktopServices::openUrl` fails to open `file:///path/bitcoin.conf` with its default application, use `QProcess::startDetached` to run `open -t /path/bitcoin.conf` command instead, so as to open the configuration file with system's default text editor.

ACKs for commit 6e6494:
  hebasto:
    re-ACK 6e6494b3fb
  fanquake:
    tACK 6e6494b3fb on macOS 10.14.x

Tree-SHA512: 60e898f4cb77cfd7b8adbc8d33fbebf46bac2a801bdcf40cae15e24b78ad56b1f32358b1879b670623d9f8651dea93961d34269358cea18f4e15b089a8ffcfbf
2019-06-03 23:20:03 +02:00
Wladimir J. van der Laan
599206fda7
Merge #16090: Qt: Add vertical spacer to peer detail widget
36b0a2f2a6 Add vertical spacer (Josu Goñi)

Pull request description:

  Before:

  ![image](https://user-images.githubusercontent.com/25986871/58375408-a8f22c80-7f52-11e9-96ca-14f2186e6fa7.png)

  After:

  ![image](https://user-images.githubusercontent.com/25986871/58375420-fa022080-7f52-11e9-8add-eafe98068e8d.png)

ACKs for commit 36b0a2:
  fanquake:
    utACK 36b0a2f2a6
  hebasto:
    tACK 36b0a2f2a6 on Linux Mint 19.1, Qt 5.9.5
  fanquake:
    re-utACK 36b0a2f2a6
  kristapsk:
    ACK 36b0a2f2a6 (tested with Qt 5.11.3 under Linux/Xfce4)
  promag:
    Tested ACK 36b0a2f2a6 on macos 10.14.3. Resizing the window works as expected.

Tree-SHA512: 26ec9700aa9116ec2c604f8ec7b825b30c83c1d497c21f2191d3585868db4a2e3921de607dea9f7cd9a1ea49361215d738e2aba1936566d85757d87112d73088
2019-06-03 23:17:46 +02:00
Wladimir J. van der Laan
c3723c80da
Merge #16122: gui: Enable console line edit on setClientModel
2d8ad2f997 gui: Enable console line edit on setClientModel (João Barbosa)

Pull request description:

  Make console line edit disable by default, and only enable once `RPCConsole::setClientModel` is called.

  Fixes #16119.

ACKs for commit 2d8ad2:
  fanquake:
    tACK 2d8ad2f997 on macOS.

Tree-SHA512: 1418ce3c120c08e5ec3e7a7a063572a24402ce0ec541bd4adc21f61d60c4e86b711e82e940ebf5f0445ab861f89c146c2a2e7990fb52bed2c65fc199a1981f71
2019-06-03 22:20:44 +02:00
shannon1916
6e6494b3fb qt: fix opening bitcoin.conf via Preferences on macOS; see #15409 2019-06-03 10:32:15 +08:00
João Barbosa
d2ae6be80f gui: Set progressDialog to nullptr 2019-06-02 22:18:19 +01:00
practicalswift
eca9767673 Make reasoning about dependencies easier by not including unused dependencies 2019-06-02 17:15:23 +02:00
Pieter Wuille
58e291cfad Add test for GCC bug 90348 2019-06-02 10:19:30 +02:00
João Barbosa
2d8ad2f997 gui: Enable console line edit on setClientModel 2019-05-30 23:26:18 +01:00
João Barbosa
75485ef096 gui: Enable open wallet menu on setWalletController 2019-05-29 14:20:59 +01:00
Wladimir J. van der Laan
1dbbfea9cd
Merge #15703: Update secp256k1 subtree to latest upstream
54245985fb Squashed 'src/secp256k1/' changes from 0b70241850..b19c000063 (Pieter Wuille)

Pull request description:

  It's been 1.5 years since our secp256k1 subtree was updated, while the upstream project has undergone a number of incremental improvements (performance, tests, build system fixes), plus gained the groundwork for batch verification.

  As we're early in the 0.19 window, this seems like a good time to get these merged.

ACKs for commit 99df27:
  fanquake:
    utACK 99df276 the subtree merge, still need to test the actual changes.
  laanwj:
    utACK 99df276da

Tree-SHA512: 769a699366321635068ebfbd9d3f30f6e72401c4fcdc1fdc84e5b3fd888c3f01437748f6cd23a507ab47cf04c226cd504fd48aee654457c34bb106c9db7e5c09
2019-05-29 14:09:05 +02:00
Wladimir J. van der Laan
62efead8a8
Merge #16046: util: Add type safe GetTime
fa013664ae util: Add type safe GetTime (MarcoFalke)

Pull request description:

  There are basically two ways to get the time in Bitcoin Core:
  * get the system time (via `GetSystemTimeInSeconds` or `GetTime{Millis,Micros}`)
  * get the mockable time (via `GetTime`)

  Both return the same type (a plain int). This can lead to (test-only) bugs such as 99464bc38e.

  Fix that by deprecating `GetTime` and adding a `GetTime<>` that returns the mockable time in a non-int type. The new util function is currently unused, but new code should it where possible.

ACKs for commit fa0136:
  promag:
    utACK fa013664.

Tree-SHA512: efab9c463f079fd8fd3030c479637c7b1e8be567a881234bd0f555c8f87e518e3b43ef2466128103db8fc40295aaf24e87ad76d91f338c631246fc703477e95c
2019-05-29 13:39:54 +02:00
Wladimir J. van der Laan
de458da0c1
Merge #16056: mempool: remove unused magic number from consistency check
fadbc5d895 mempool: remove unused magic number from consistency check (Gregory Sanders)

Pull request description:

  Unexplained magic numbers are no good. Since the exact number does not matter, opt for a constant that is less peculiar.

  Note that this could only possibly affect mempool consistency checks which is not active by default except on regtest.

  see discussion: https://github.com/bitcoin/bitcoin/issues/15080

ACKs for commit fadbc5:
  practicalswift:
    utACK fadbc5d895

Tree-SHA512: 80f95ebc284c5bcc5d825fab0e9f962457a411539946d68ef4c8bdea4b1f2f7f0ead88928fac0eaaa02a1175f01f5ef381613ce53b0f27c3098e90d76ecfe9af
2019-05-29 12:22:43 +02:00
Karl-Johan Alm
5ebc6b0eb2
bitcoind: update -avoidpartialspends description to account for auto-enable for avoid_reuse wallets 2019-05-29 18:40:31 +09:00
Karl-Johan Alm
27669551da
wallet: enable avoid_partial_spends by default if avoid_reuse is set 2019-05-29 18:40:31 +09:00
Karl-Johan Alm
0bdfbd34cf
wallet/rpc: add 'avoid_reuse' option to RPC commands
createwallet, getbalance, getwalletinfo, listunspent, sendtoaddress

rpc/wallet: listunspent include reused flag and show reused utxos by default
2019-05-29 18:40:31 +09:00
Karl-Johan Alm
f904723e0d
wallet/rpc: add setwalletflag RPC and MUTABLE_WALLET_FLAGS 2019-05-29 18:40:31 +09:00
Karl-Johan Alm
8247a0da3a
wallet: enable avoid_reuse feature 2019-05-29 18:40:31 +09:00
Karl-Johan Alm
eec15662fa
wallet: avoid reuse flags
Add m_avoid_address_reuse flag to coin control object.
Add avoid_reuse wallet flag and accompanying strings/caveats.
2019-05-29 18:40:31 +09:00
Karl-Johan Alm
58928098c2
wallet: make IsWalletFlagSet() const 2019-05-29 18:40:15 +09:00
Karl-Johan Alm
129a5bafd9
wallet: rename g_known_wallet_flags constant to KNOWN_WALLET_FLAGS 2019-05-29 18:23:45 +09:00
Jonas Schnelli
ab6d18e6f8
Merge #16113: gui: move coin control "OK" to the right hand side of the dialog
d595b4aae gui: move coin control OK to the right (fanquake)

Pull request description:

  Fixes #16101

  The simplest fix seems to be to just drop the `sizePolicy` property, as we don't use that on any other instances of `QDialogButtonBox`.

  master (76e2cded47):
  ![master](https://user-images.githubusercontent.com/863730/58490351-fc26d380-813a-11e9-9906-043ff4f4959f.png)

  This PR:
  ![right-side](https://user-images.githubusercontent.com/863730/58490360-00eb8780-813b-11e9-80fb-2dab04a5ba54.png)

ACKs for commit d595b4:
  hebasto:
    utACK d595b4aae9
  jonasschnelli:
    utACK d595b4aae9
  JosuGZ:
    tACK d595b4aae9

Tree-SHA512: 7099e21d58457bfcbc83237f5a47ddf18cfa6bd9d6194b357b314b4d54aed72fdbbf10cbe38223affd87c2542b8f364d37ce6a175e594dfbcd18c725b42a6d3e
2019-05-29 09:02:44 +02:00
MeshCollider
ed40fbb02a
Merge #15741: Batch write imported stuff in importmulti
0db94e55d wallet: Pass WalletBatch to CWallet::UnsetWalletFlag (João Barbosa)
6cb888b37 Apply the batch treatment to CWallet::SetAddressBook via ImportScriptPubKeys (Ben Woosley)
6154a09e0 Move some of ProcessImport into CWallet::Import* (Ben Woosley)
ccb26cf34 Batch writes for importmulti (Andrew Chow)
d6576e349 Have WalletBatch automatically flush every 1000 updates (Andrew Chow)
366fe0be0 Add AddWatchOnlyWithDB, AddKeyOriginWithDB, AddCScriptWithDB functions (Andrew Chow)

Pull request description:

  Instead of writing each item to the wallet database individually, do them in batches so that the import runs faster.

  This was tested by importing a ranged descriptor for 10,000 keys.

  Current master

  ```
  $ time src/bitcoin-cli -regtest -rpcwallet=importbig importmulti '[{"desc": "sh(wpkh([73111820/44h/1h/0h]tpubDDoT2SgEjaU5rerQpfcRDWPAcwyZ5g7xxHgVAfPwidgPDKVjm89d6jJ8AQotp35Np3m6VaysfUY1C2g68wFqUmraGbzhSsMF9YBuTGxpBaW/1/*))#3w7php47", "range": [0, 10000], "timestamp": "now", "internal": true, "keypool": false, "watchonly": true}]'
  ...

  real	7m45.29s
  ```

  This PR:

  ```
  $ time src/bitcoin-cli -regtest -rpcwallet=importbig4 importmulti '[{"desc": "pkh([73111820/44h/1h/0h]tpubDDoT2SgEjaU5rerQpfcRDWPAcwyZ5g7xxHgVAfPwidgPDKVjm89d6jJ8AQotp35Np3m6VaysfUY1C2g68wFqUmraGbzhSsMF9YBuTGxpBaW/1/*)#v65yjgmc", "range": [0, 10000], "timestamp": "now", "internal": true, "keypool": false, "watchonly": true}]'
  ...

  real	3.93s
  ```

  Fixes #15739

ACKs for commit 0db94e:
  jb55:
    utACK 0db94e5
  ariard:
    Tested ACK 0db94e5
  Empact:
    re-utACK 0db94e55dc only change is re the privacy of `UnsetWalletFlagWithDB` and `AddCScriptWithDB`.

Tree-SHA512: 3481308a64c99b6129f7bd328113dc291fe58743464628931feaebdef0e6ec770ddd5c19e4f9fbc1249a200acb04aaf62a8d914d53b0a29ac1e557576659c0cc
2019-05-29 18:54:41 +12:00
Suhas Daftuar
308b76732f Fix bug around transaction requests
If a transaction is already in-flight when a peer announces a new tx to us, we
schedule a time in the future to reconsider whether to download. At that future
time, there was a bug that would prevent transactions from being rescheduled
for potential download again (ie if the transaction was still in-flight at the
time of reconsideration, such as from some other peer). Fix this.
2019-05-28 16:22:10 -04:00
Suhas Daftuar
f635a3ba11 Expire old entries from the in-flight tx map
If a peer hasn't responded to a getdata request, eventually time out the request
and remove it from the in-flight data structures.  This is to prevent any bugs in
our handling of those in-flight data structures from filling up the in-flight
map and preventing us from requesting more transactions (such as the NOTFOUND
bug, fixed in a previous commit).

Co-authored-by: Anthony Towns <aj@erisian.com.au>
2019-05-28 16:22:10 -04:00
MarcoFalke
faa2a47cd7
logging: Add threadsafety comments 2019-05-28 14:27:08 -04:00
Anthony Towns
0b282f9b00 Log early messages with -printtoconsole
This ensures log messages prior to StartLogging() are replayed to
the console as well as to the debug log file.
2019-05-28 14:26:42 -04:00
Anthony Towns
412987430c Replace OpenDebugLog() with StartLogging()
StartLogging() is used to mark the start of logging generically, whether
using -printtoconsole or -debuglogfile.
2019-05-28 14:26:06 -04:00
fanquake
d595b4aae9
gui: move coin control OK to the right 2019-05-28 11:16:39 -04:00
João Barbosa
0db94e55dc wallet: Pass WalletBatch to CWallet::UnsetWalletFlag 2019-05-28 11:03:54 -04:00
Ben Woosley
6cb888b37d Apply the batch treatment to CWallet::SetAddressBook via ImportScriptPubKeys 2019-05-28 11:03:42 -04:00
Ben Woosley
6154a09e01 Move some of ProcessImport into CWallet::Import*
This maintains encapsulation of CWallet::database in the face of
batching, e.g. allows making the `WithDB` methods private.
2019-05-28 11:03:18 -04:00
Kristaps Kaupe
ae7faf20d5 Exceptions should be caught by reference, not by value. 2019-05-26 18:35:13 +03:00
Josu Goñi
36b0a2f2a6 Add vertical spacer 2019-05-26 00:00:46 +02:00
practicalswift
fb434159d1 Remove global symbols: Avoid using the global namespace if possible
Rename CCriticalSection to RecursiveMutex (both are AnnotatedMixin<std::recursive_mutex>)

```
$ git grep -E '(typedef|using).*(CCriticalSection|RecursiveMutex)'
src/sync.h:using RecursiveMutex = AnnotatedMixin<std::recursive_mutex>;
src/sync.h:typedef AnnotatedMixin<std::recursive_mutex> CCriticalSection;
```
2019-05-25 23:23:11 +02:00
MarcoFalke
fa013664ae
util: Add type safe GetTime 2019-05-23 14:12:32 -04:00
MarcoFalke
65c4bbe629
Merge #16034: refactoring: Rename LockAnnotation to LockAssertion and add run-time check to it
9f85e9cb3d scripted-diff: Rename LockAnnotation to LockAssertion (practicalswift)
de9b5dbca3 Make sure the compile-time locking promises given via LockAnnotation:s hold also in practice at runtime (ifdef DEBUG_LOCKORDER) (practicalswift)
3a809446b3 Move LockAnnotation to make it reflect the truth (practicalswift)
cc2588579c Move LockAnnotation from threadsafety.h (imported code) to sync.h (our code) (practicalswift)

Pull request description:

  `LockAnnotation lock(mutex);` is a guarantee to the compiler thread-analysis that `mutex` is locked (when it couldn't be determined otherwise).

  Before this PR it was possible to make the mistake of adding a `LockAnnotation` where the correct mutex is _not_ held. This in turn makes the thread-analysis reasoning being based on incorrect premises.

  This PR adds an assertion in the `LockAnnotation` ctor which checks that the guarantees given by us at compile-time are held also in practice (`ifdef DEBUG_LOCKORDER`).

  Issues like the one described in #16028 will be discovered immediately with this PR merged.

  Changes in this PR:
  * Move `LockAnnotation` from `threadsafety.h` (imported code) to `sync.h` (our code)
  * Move `LockAnnotation` in `wallet_tests` to make it reflect the truth
  * Make sure the compile-time locking promises given via `LockAnnotation`:s hold also in practice at runtime (`ifdef DEBUG_LOCKORDER`)
  * Rename `LockAnnotation` to `LockAssertion`

ACKs for commit 9f85e9:
  ryanofsky:
    utACK 9f85e9cb3d. No changes at all since last review except clean rebase after base PR #16033 was merged

Tree-SHA512: fb80e78fe362adfd6ea8405bcb142c09b99f834fe8be4397282b223ca2c3a2bb9719a074a47a043b44757f840b239a6fcd2f98d14771f8729204834ecf608c3a
2019-05-23 13:36:10 -04:00
MarcoFalke
0b058ba69d
Merge #16024: [rpc] deriveaddresses: Correction of descriptor checksum in RPC example
e23809a05b [rpc] deriveaddresses: Correct descriptor checksum in RPCExamples (Chris Capobianco)

Pull request description:

  Trvial: This fixes the descriptor checksum found the in the deriveaddresses RPC example.

  The current checksum value does work, but only if the "h" used for the hardened derivation key origin are replaced with "'".

  Given the discussion to switch from "'" to "h" [here](https://github.com/bitcoin/bitcoin/issues/15740), I thought it made more sense to update the checksum rather then changing all the "h" to "'" in this example.

ACKs for commit e23809:
  instagibbs:
    tACK e23809a05b

Tree-SHA512: 06a2b9f3e714ecde9b9a80b3b7a4082eb072e71d8abcc455ff5387e470d48839f22a70b78bbae1cf9122cb133fee46830819b6f39d67aec8c3c8d5889ae94e04
2019-05-23 12:43:11 -04:00
MarcoFalke
12fd4bbd1e
Merge #16063: rpc: Mention getwalletinfo where a rescan is triggered
be4efb165a rpc: Mention getwalletinfo where a rescan is triggered (João Barbosa)

Pull request description:

ACKs for commit be4efb:
  jonasschnelli:
    utACK be4efb165a
  sipa:
    utACK be4efb165a

Tree-SHA512: c9e5adda6fcb71dd64ad35cc5af89b0ed815aba440df26b61ef2018abd3b801c9e93cdbedf90db3938e88dc9af39f1577c4c7248bc77260d3afda5e2a0928e68
2019-05-22 15:47:34 -04:00
Wladimir J. van der Laan
fdc951ad04
Merge #16073: refactor: Improve CRollingBloomFilter::reset by using std::fill
df9e15f092 refactor: Improve CRollingBloomFilter::reset by using std::fill (João Barbosa)
d2dbc7da26 bench: Add benchmark for CRollingBloomFilter::reset (João Barbosa)

Pull request description:

  Cleaner code. Also improves performance with `--enable-debug` (which is meaningless to non-developers).

  Before:
  ```
  # Benchmark, evals, iterations, total, min, max, median
  RollingBloomReset, 5, 150, 19.3008, 0.0254917, 0.0259195, 0.0257395
  ```
  After:
  ```
  # Benchmark, evals, iterations, total, min, max, median
  RollingBloomReset, 5, 150, 5.43269, 0.00720651, 0.00729697, 0.00724854
  ```

ACKs for commit df9e15:
  MarcoFalke:
    re-utACK df9e15f092
  jamesob:
    re-utACK df9e15f092

Tree-SHA512: 22038411dfd41afad77b17a3da9ee04476ffbd4d215dcf47bdd9f14588759bc328a55d958dcebc2036b52ce4c56f79b1284eae11e56ddfaf21f0b2ee1c6a914a
2019-05-22 21:06:00 +02:00
João Barbosa
df9e15f092 refactor: Improve CRollingBloomFilter::reset by using std::fill 2019-05-22 15:55:50 +01:00
João Barbosa
d2dbc7da26 bench: Add benchmark for CRollingBloomFilter::reset 2019-05-22 15:55:50 +01:00
MarcoFalke
1c177c3a00
Merge #16015: validation: Hold cs_main when reading chainActive in RewindBlockIndex
1609809fb2 validation: Hold cs_main when reading chainActive in RewindBlockIndex (practicalswift)

Pull request description:

  Fixes #15980.

  Hold `cs_main` when reading `chainActive` (via `::ChainActive()`) in `RewindBlockIndex`.

ACKs for commit 160980:
  MarcoFalke:
    utACK 1609809fb2

Tree-SHA512: 54f180ab391f92f04950735c2bb337f0b7495826d2096f7a0f9a2da50bc29d08747f404a0495e33ca4edd4c842efbab4c4730d5e1a8b9da3e1249cf884268f4b
2019-05-22 08:17:48 -04:00
João Barbosa
be4efb165a rpc: Mention getwalletinfo where a rescan is triggered 2019-05-22 08:24:54 +01:00
Kristaps Kaupe
df0e97ccb1 RPC: Hint for importmulti in help output of importpubkey and importaddress 2019-05-22 00:35:21 +03:00
MarcoFalke
3001cc61cf
Merge #13555: Tests: parameterize adjustment period in versionbits_computeblockversion
2c448d6bc7 parameterize hard coded numbers referring to miner conf window (Jordan Baczuk)

Pull request description:

  Replace hard coded values (eg. 2016) with `mainnetParams.nMinerConfirmationWindow` where appropriate. This parameterizes hard coded values in the unit test that refer to the `Miner Confirmation Window`, which currently is `2016`.  This includes values not exactly 2016 but which were derived from it. Also changed `int` to `uint32_t` where appropriate to avoid compiler warnings. This makes one source of truth, and also helps people who might be adjusting this value in testing so the unit tests don't break.

ACKs for commit 2c448d:

Tree-SHA512: 9262e0b89c1baf7857b49fe2221b2b00f948f61317b321c4871a9182a86d6f8aadeb59d6b133e8a213cc9b31b4a417888fb1ad31caef16ccbbab1de33c4b8459
2019-05-21 08:04:11 -04:00
Jordan Baczuk
2c448d6bc7 parameterize hard coded numbers referring to miner conf window 2019-05-20 20:36:31 -06:00
Gregory Sanders
fadbc5d895 mempool: remove unused magic number from consistency check 2019-05-20 15:19:43 -04:00
Wladimir J. van der Laan
bb291b50f2
Merge #16021: p2p: Avoid logging transaction decode errors to stderr
fa2b52af32 Disallow extended encoding for non-witness transactions (take 3) (MarcoFalke)

Pull request description:

  (previous title "p2p: Disallow extended encoding for non-witness transactions (take 3)")

  Remote peers can send us illegally encoded txs and thus have us write to stderr. Fix that by not writing to stderr.

  This is a follow up to the previous (incomplete) attempts at this:

  *  Disallow extended encoding for non-witness transactions #14039
  *  Add test for superfluous witness record in deserialization #15893

ACKs for commit fa2b52:
  laanwj:
    utACK fa2b52af32
  ryanofsky:
    utACK fa2b52af32. Would change title to something like "Avoid logging transaction decode errors to stderr" instead of "Disallow extended encoding for non-witness transactions." The current title is confusing because this PR isn't really allowing or disallowing anything, just logging the condition differently. "Disallow" also seems to contradict the "Allow exceptions from..." comments in the actual code.

Tree-SHA512: c66990e69b432d00dc1c5510bf976a1188664d0890a32d1e5c6459094e7e27da82a5d227627afcbc203676f5540eec74b7d9b1d71d2c62d3b2069e1781824b4d
2019-05-20 17:29:21 +02:00
MeshCollider
7263424458
Merge #16001: Give WalletModel::UnlockContext move semantics
0b09a57ae Give WalletModel::UnlockContext move semantics (Pieter Wuille)

Pull request description:

  WalletModel::UnlockContext seems to implement "move upon copy" semantics; with C++11 this can be done more safely using move semantics (making attempts to actually copy fail instead).

  Not a big deal if this isn't worth review time.

ACKs for commit 0b09a5:
  Empact:
    utACK 0b09a57aec
  jonasschnelli:
    utACK 0b09a57aec
  jb55:
    utACK 0b09a57aec

Tree-SHA512: f827856586afd03666c2d9f50320776afb3dd511ac1bcd293b330f015acd1588551b163dccc97b1351301e3295f4c74d90e5754bcee89faeadf6437d7db165c8
2019-05-20 00:13:53 +12:00
Jonas Schnelli
7110d455eb
Merge #12980: Allow quicker shutdowns during LoadBlockIndex()
af5fa82b6 Allow quicker shutdowns during LoadBlockIndex() (Jonas Schnelli)

Pull request description:

ACKs for commit af5fa8:
  promag:
    utACK af5fa82b67.
  practicalswift:
    utACK af5fa82b67

Tree-SHA512: 1c64dcc5d8a9d3411553257cd5a598dcd29be981660e5bca9283c1d957dc56798abcf41d9969cd573088137597a23e48e62a8c476c463d3f176b86a10048f47b
2019-05-19 10:43:32 +02:00
Hennadii Stepanov
78f9b5160f
Do not show list for the only recipient. 2019-05-18 22:22:05 +03:00
Andrew Chow
ccb26cf347 Batch writes for importmulti
When writing all of the imported data to the wallet, use a common
WalletBatch object so that batch writes are done and the writes
finish more quickly.

AddKeypoolPubkey is no longer needed so it is also removed
2019-05-18 12:59:17 -04:00
Andrew Chow
d6576e349e Have WalletBatch automatically flush every 1000 updates
Since it now automatically flushes, we don't need to have
UpgradeKeyMetadata count and flush separately
2019-05-18 12:58:50 -04:00
Andrew Chow
366fe0be0b Add AddWatchOnlyWithDB, AddKeyOriginWithDB, AddCScriptWithDB functions
AddWatchOnlyWithDB, AddKeyOriginWithDB, and AddCScriptWithDB add their
respective data to the wallet using the provided WalletBatch instead
of creating a new WalletBatch object every time. This allows for batching
writes to the database.
2019-05-18 12:57:58 -04:00
Jonas Schnelli
387eb5b343
Merge #15957: Show "No wallets available" in open menu instead of nothing
c3ef63a52 Show loaded wallets as disabled in open menu instead of nothing (MeshCollider)

Pull request description:

  Fixes the confusing behavior reported in #15952

  ![image](https://user-images.githubusercontent.com/3211283/57224284-0e8e7f80-705d-11e9-9554-2450cc3dbb8e.png)

ACKs for commit c3ef63:
  jonasschnelli:
    Tested ACK c3ef63a52f
  kristapsk:
    tACK c3ef63a52f

Tree-SHA512: fc2b94936ca32b89e8146c65e3629785883d78660afc8838818df652a4df9185ddca6b36ebf140a7159ab42b0fa5aa72867558d4572a009be06f0831fa813d1f
2019-05-18 13:02:29 +02:00
Wladimir J. van der Laan
82b64a5a81
Merge #15224: Add RNG strengthening (10ms once every minute)
3cb9ce85d0 Document strenghtening (Pieter Wuille)
1d207bc46f Add hash strengthening to the RNG (Pieter Wuille)

Pull request description:

  This patch improves the built-in RNG using hash strengthening.

  At startup, and once every minute, 32 bytes of entropy are produced from the RNG, repeatedly hashed using SHA512 for 10ms, and then fed back into the RNG, together with high-precision timestamps obtained every 1000 iterations.

ACKs for commit 3cb9ce:
  pstratem:
    utACK 3cb9ce85d0

Tree-SHA512: 4fb6f61639b392697beb81c5f0903f79f10dd1087bed7f34de2abb5c22704a671e37b2d828ed141492491863efb1e7d1fa04408a1d32c9de2f2cc8ac406bbe57
2019-05-18 10:01:54 +02:00
practicalswift
9f85e9cb3d scripted-diff: Rename LockAnnotation to LockAssertion
-BEGIN VERIFY SCRIPT-
git grep -l LockAnnotation | xargs sed -i 's/LockAnnotation/LockAssertion/'
-END VERIFY SCRIPT-
2019-05-17 13:29:04 +02:00
practicalswift
de9b5dbca3 Make sure the compile-time locking promises given via LockAnnotation:s hold also in practice at runtime (ifdef DEBUG_LOCKORDER) 2019-05-17 13:29:04 +02:00
practicalswift
3a809446b3 Move LockAnnotation to make it reflect the truth 2019-05-17 13:29:04 +02:00
practicalswift
cc2588579c Move LockAnnotation from threadsafety.h (imported code) to sync.h (our code) 2019-05-17 13:29:04 +02:00
MarcoFalke
a822a0e4f6
Merge #15999: init: Remove dead code in LoadChainTip
fa86c8aec6 init: Remove dead code in LoadChainTip (MarcoFalke)

Pull request description:

  `LoadChainTip` sets `::ChainActive()` based on `pcoinsTip`'s best block. `LoadChainTip` is never called when that block is null, so we can remove all code from within that method that is only executed when that block is null.

  Fixes #15967  Inconsistent locking behavior in LoadChainTip

ACKs for commit fa86c8:
  promag:
    utACK fa86c8aec6.
  practicalswift:
    utACK fa86c8aec6
  Empact:
    utACK fa86c8aec6
  laanwj:
    utACK fa86c8aec6
  ryanofsky:
    utACK fa86c8aec6. LoadChainTip isn't called currently when pcoinsTip best block is null due to this line:
  jamesob:
    utACK fa86c8aec6

Tree-SHA512: 8961c0e579800a52038ac5655478468852faac055299b64d6cfdf0c213d3bf09669c4889467d09d93457f6c8b073967bb0475a137f77ddd3a3a3c03ad90001c4
2019-05-17 07:22:52 -04:00
MarcoFalke
f3d27d126b
Merge #16033: Hold cs_main when reading chainActive via getTipLocator(). Remove assumeLocked().
9402ef0739 Remove temporary method assumeLocked(). Remove LockingStateImpl. Remove redundant cs_main locks. (practicalswift)
593a8e8a2c wallet: Use chain.lock() instead of temporary chain.assumeLocked() (practicalswift)

Pull request description:

  Fixes #16028.

  Problem description:

  `LockAnnotation lock(::cs_main)` is a guarantee to the compiler thread analysis that `::cs_main` is locked (when it couldn't be determined otherwise).

  Despite being annotated with the locking guarantee ...

  65526fc866/src/interfaces/chain.cpp (L134-L138)

  ... `getTipLocator()` reads `chainActive` (via `::ChainActive()`) without holding `cs_main`.

  This can be verified by adding the following `AssertLockHeld(cs_main)`:

  ```
  $ git diff
  diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp
  index 59623284d..9fc693a0f 100644
  --- a/src/interfaces/chain.cpp
  +++ b/src/interfaces/chain.cpp
  @@ -134,6 +134,7 @@ class LockImpl : public Chain::Lock
       CBlockLocator getTipLocator() override
       {
           LockAnnotation lock(::cs_main);
  +        AssertLockHeld(::cs_main);
           return ::ChainActive().GetLocator();
       }
       Optional<int> findLocatorFork(const CBlockLocator& locator) override
  $ make check
  ../build-aux/test-driver: line 107: 12881 Aborted                 "$@" > $log_file 2>&1
  FAIL: qt/test/test_bitcoin-qt
  ```

ACKs for commit 9402ef:
  MarcoFalke:
    utACK 9402ef0739
  ryanofsky:
    utACK 9402ef0739. Changes are consolidating commits and removing redundant lock2 cs_main calls

Tree-SHA512: 0a030bf0c07eb53194ecc246f973ef389dd42a0979f51932bf94bdf7e90c52473ae03be49718ee1629582b05dd8e0dc020b5a210318c93378ea4ace90c0f9f72
2019-05-17 07:17:41 -04:00
MarcoFalke
fa499b5f02
rpc: bugfix: Properly use iswitness in converttopsbt
Also explain the param in all RPCs
2019-05-16 15:56:04 -04:00
practicalswift
9402ef0739 Remove temporary method assumeLocked(). Remove LockingStateImpl. Remove redundant cs_main locks. 2019-05-16 21:43:22 +02:00
practicalswift
593a8e8a2c wallet: Use chain.lock() instead of temporary chain.assumeLocked() 2019-05-16 21:42:34 +02:00
Wladimir J. van der Laan
8f2f17f79a
Merge #15970: Utils and libraries: fix static_assert for macro HAVE_THREAD_LOCAL
41ab2a8924 fix static_assert for macro HAVE_THREAD_LOCAL (orient)

Pull request description:

  Utils and libraries: fix static_assert for macro HAVE_THREAD_LOCAL if define DEBUG_LOCKCONTENTION

ACKs for commit 41ab2a:
  laanwj:
    utACK 41ab2a8924

Tree-SHA512: 6c1d20375a70cbdef1140c544f443106d6bf6c34b1da2ddc66739f2b662a0d6b800288f48bf451a3d5937bac7e40b8ecda3a4effcc978d0093fc497410447ea7
2019-05-16 20:19:10 +02:00
MarcoFalke
fa5c5cd141
rpc: Switch touched RPCs to IsValidNumArgs 2019-05-16 14:15:40 -04:00
Wladimir J. van der Laan
376638afcf
Merge #14047: Add HKDF_HMAC256_L32 and method to negate a private key
8794a4b3ae QA: add test for HKDF HMAC_SHA256 L32 (Jonas Schnelli)
551d489416 Add HKDF HMAC_SHA256 L=32 implementations (Jonas Schnelli)
3b64f852e4 QA: add test for CKey::Negate() (Jonas Schnelli)
463921bb64 CKey: add method to negate the key (Jonas Schnelli)

Pull request description:

  This adds a limited implementation of `HKDF` (defined by rfc5869) that supports only HMAC-SHA256  and length output of 32 bytes (will be required for v2 transport protocol).

  This PR also includes a method to negate a private key which is useful to enforce public keys starting with 0x02 (or 0x03) (a requirement for the v2 transport protocol). The new `CKey::Negate()` method is pretty much a wrapper around `secp256k1_ec_privkey_negate()`.

  Including tests.

  This is a subset of #14032 and a pre-requirement for the v2 transport protocol.

ACKs for commit 8794a4:

Tree-SHA512: 5341929dfa29f5da766ec3612784baec6a3ad69972f08b5a985a8aafdae4dae36f104a2b888d1f5d1f33561456bd111f960d7e32c2cc4fd18e48358468f26c1a
2019-05-16 19:24:52 +02:00
Wladimir J. van der Laan
df7addc4c6
Merge #15990: Add tests and documentation for blocksonly
fa8ced32a6 doc: Mention blocksonly in reduce-traffic.md, unhide option (MarcoFalke)
fa320de79f test: Add test for p2p_blocksonly (MarcoFalke)
fa3872e7b4 test: Format predicate source as multiline on error (MarcoFalke)
fa1dce7329 net: Rename ::fRelayTxes to ::g_relay_txes (MarcoFalke)

Pull request description:

  This is de-facto no longer hidden

ACKs for commit fa8ced:
  jamesob:
    utACK fa8ced32a6

Tree-SHA512: 474fbdee6cbd035ed9068a066b6056c1f909ec7520be0417820fcd1672ab3069b53f55c5147968978d9258fd3a3933fe1a9ef8e4f6e14fb6ebbd79701a0a1245
2019-05-16 19:05:24 +02:00
Wladimir J. van der Laan
1c719f78d3
Merge #15006: Add option to create an encrypted wallet
662d1171d9 Add option to create an encrypted wallet (Andrew Chow)

Pull request description:

  This PR adds a new `passphrase` argument to `createwallet` which will create a wallet that is encrypted with that passphrase.

  This is built on #15226 because it needs to first create an empty wallet, then encrypt the empty wallet and generate new keys that have only been stored in an encrypted state.

ACKs for commit 662d11:
  laanwj:
    utACK 662d1171d9
  jnewbery:
    Looks great. utACK 662d1171d9

Tree-SHA512: a53fc9a0f341eaec1614eb69abcf2d48eb4394bc89041ab69bfc05a63436ed37c65ad586c07fd37dc258ac7c7d5e4f7f93b4191407f5824bbf063b4c50894c4a
2019-05-16 18:20:14 +02:00
MarcoFalke
d5931f3676
Merge #15870: wallet: Only fail rescan when blocks have actually been pruned
fa7e311e16 [doc] rpcwallet: Only fail rescan when blocks have been pruned (MarcoFalke)
aaaa57c2aa scripted-diff: Bump copyright headers in wallet (MarcoFalke)
faf3729242 wallet: Only fail rescan when blocks have actually been pruned (MarcoFalke)

Pull request description:

  This brings the behaviour of the import* calls closer to importmulti. After this change, the difference between importmulti and the other import* calls is

  * that in importmulti you can "opt-out" of scanning early blocks by setting a later timestamp.
  * that in importmulti the wallet will successfully import the data, but fail to rescan. Whereas in the other calls, the wallet will abort before importing the data.

ACKs for commit fa7e31:
  promag:
    utACK fa7e311e16.
  jnewbery:
    utACK fa7e311e16

Tree-SHA512: a57d52ffea94b64e0eb9b5d3a7a63031325833908297dd14eb0c5251ffea3b2113b131003f1db4e9599e014369165a57f107a7150bb65e4c791e5fe742f33cb8
2019-05-16 11:18:27 -04:00
Wladimir J. van der Laan
fd61b9fc22
Merge #15950: Do not construct out-of-bound pointers in SHA2 code
c01c065b9d Do not construct out-of-bound pointers in SHA512/SHA1/RIPEMD160 code (Pieter Wuille)

Pull request description:

  This looks like an issue in the current SHA256/512 code, where a pointer outside of the area pointed to may be constructed (this is UB in theory, though in practice every supported platform treats pointers as integers).

  I discovered this while investigating #14580. Sadly, it does not fix it.

ACKs for commit c01c06:
  practicalswift:
    utACK c01c065b9d

Tree-SHA512: 47660e00f164f38c36a1ab46e52dd91cd33cfda6a6048d67541c2f8e73c050d4d9d81b5c149bfad281212d52f204f57bebf5b19879dc7a6a5f48aa823fbc2c02
2019-05-16 16:23:38 +02:00
James O'Beirne
403e677c9e refactoring: IsInitialBlockDownload -> CChainState
We introduce CChainState.m_cached_finished_ibd because the static state it
replaces would've been shared across all CChainState instances.
2019-05-16 09:06:54 -04:00