Commit graph

13959 commits

Author SHA1 Message Date
James O'Beirne
5693530685 refactor: have CCoins* data managed under CChainState
This change encapsulates UTXO set data within CChainState instances, removing
global data `pcoinsTip` and `pcoinsviewdb`. This is necessary if we want to
maintain multiple chainstates with their own rendering of the UTXO set.

We introduce a class CoinsViews which consolidates the construction of a
CCoins* hierarchy. Construction of its various pieces (db, coinscatcher,
in-memory cache) is split up so that we avoid flushing bad state to disk if
startup is interrupted.

We also introduce `CChainState::CanFlushToDisk()` which tells us when it is
safe to flush the chainstate based on this partial construction.

This commit could be broken into smaller pieces, but it would require more
ephemeral diffs to, e.g., temporarily change CCoinsViewDB's constructor
invocations.

Other changes:

- A parameter has been added to the CCoinsViewDB constructor that allows the
  name of the corresponding leveldb directory to be specified.

Thanks to Russell Yanofsky and Marco Falke for helpful feedback.
2019-08-15 11:04:10 -04:00
Antoine Riard
6576a8765f doc: Improve versionbits.h documentation 2019-08-15 11:02:55 -04:00
MarcoFalke
fa27c55b05
util: Move ResolveErrMsg to util/error 2019-08-15 10:05:32 -04:00
nicolas.dorier
dc7529abf0
[Fix] Allow connection of a noban banned peer 2019-08-15 22:40:32 +09:00
Wladimir J. van der Laan
390874c722 qt: Remove menu icons 2019-08-15 13:05:10 +02:00
fanquake
8fc7f0cba9
Merge #16578: Do not pass in command line arguments to QApplication
a2714a5c69 Give QApplication dummy arguments (Andrew Chow)

Pull request description:

  QApplication takes the command line arguments and parses them itself for some [built in command line arguments](https://doc.qt.io/qt-5/qapplication.html#QApplication) that it has. We don't want any of those built in arguments, so instead give it dummy arguments.

  To test, you can use the `-reverse` option. Without this patch, everything will appear right-to-left; things that were on the left side will be on the right and everything is right aligned.

  After this patch, `-reverse` will now give a startup error since we do not support this argument.

ACKs for top commit:
  laanwj:
    ACK a2714a5c69
  hebasto:
    ACK a2714a5c69
  fanquake:
    ACK a2714a5c69 - Have tested that arguments like `-reverse` are no longer being passed through and result in an error.

Tree-SHA512: 983bd948ca6999f895b6662b58c37e33af7ed61fdd600c6b4623febb87ec06a92c66e3b3300783530110cc711902793ef82d751d7f563696c4c3a8416b2b1f51
2019-08-15 15:19:35 +08:00
John Newbery
0328dcdcfc [Consensus] Bury segwit deployment
Hardcode segwit deployment height to 481824 for mainnet.
2019-08-14 15:52:52 -04:00
John Newbery
1c93b9b31c [Consensus] Bury CSV deployment height
Hard code CSV deployment height to 419328 for mainnet.
2019-08-14 15:52:52 -04:00
Wladimir J. van der Laan
67be6d7a17
Merge #16248: Make whitebind/whitelist permissions more flexible
c5b404e8f1 Add functional tests for flexible whitebind/list (nicolas.dorier)
d541fa3918 Replace the use of fWhitelisted by permission checks (nicolas.dorier)
ecd5cf7ea4 Do not disconnect peer for asking mempool if it has NO_BAN permission (nicolas.dorier)
e5b26deaaa Make whitebind/whitelist permissions more flexible (nicolas.dorier)

Pull request description:

  # Motivation

  In 0.19, bloom filter will be disabled by default. I tried to make [a PR](https://github.com/bitcoin/bitcoin/pull/16176) to enable bloom filter for whitelisted peers regardless of `-peerbloomfilters`.

  Bloom filter have non existent privacy and server can omit filter's matches. However, both problems are completely irrelevant when you connect to your own node. If you connect to your own node, bloom filters are the most bandwidth efficient way to synchronize your light client without the need of some middleware like Electrum.

  It is also a superior alternative to BIP157 as it does not require to maintain an additional index and it would work well on pruned nodes.

  When I attempted to allow bloom filters for whitelisted peer, my proposal has been NACKed in favor of [a more flexible approach](https://github.com/bitcoin/bitcoin/pull/16176#issuecomment-500762907) which should allow node operator to set fine grained permissions instead of a global `whitelisted` attribute.

  Doing so will also make follow up idea very easy to implement in a backward compatible way.

  # Implementation details

  The PR propose a new format for `--white{list,bind}`. I added a way to specify permissions granted to inbound connection matching `white{list,bind}`.

  The following permissions exists:
  * ForceRelay
  * Relay
  * NoBan
  * BloomFilter
  * Mempool

  Example:
  * `-whitelist=bloomfilter@127.0.0.1/32`.
  * `-whitebind=bloomfilter,relay,noban@127.0.0.1:10020`.

  If no permissions are specified, `NoBan | Mempool` is assumed. (making this PR backward compatible)

  When we receive an inbound connection, we calculate the effective permissions for this peer by fetching the permissions granted from `whitelist`  and add to it the permissions granted from `whitebind`.

  To keep backward compatibility, if no permissions are specified in `white{list,bind}` (e.g. `--whitelist=127.0.0.1`) then parameters `-whitelistforcerelay` and `-whiterelay` will add the permissions `ForceRelay` and `Relay` to the inbound node.

  `-whitelistforcerelay` and `-whiterelay` are ignored if the permissions flags are explicitly set in `white{bind,list}`.

  # Follow up idea

  Based on this PR, other changes become quite easy to code in a trivially review-able, backward compatible way:

  * Changing `connect` at rpc and config file level to understand the permissions flags.
  * Changing the permissions of a peer at RPC level.

ACKs for top commit:
  laanwj:
    re-ACK c5b404e8f1

Tree-SHA512: adfefb373d09e68cae401247c8fc64034e305694cdef104bdcdacb9f1704277bd53b18f52a2427a5cffdbc77bda410d221aed252bc2ece698ffbb9cf1b830577
2019-08-14 17:07:12 +02:00
Wladimir J. van der Laan
b6e9ff8996 build: Remove src/obj directory from repository
This directory is automatically created by the build process (in the
build target directory, see #16588) and doesn't need to be in the
repository nor in the tarballs.

Move associated ignore directive to top-level `.gitignore` file.
2019-08-14 14:59:35 +02:00
Wladimir J. van der Laan
a7aa809027
Merge #16563: test: Add unit test for AddTimeData
7cd069d8ef Add test for AddTimeData (Martin Zumsande)

Pull request description:

  `AddTimeData()` has poor test coverage but interesting logic (including a bug turned into a feature). This PR adds a unit test for it.

ACKs for top commit:
  laanwj:
    ACK 7cd069d8ef, thanks for adding a test

Tree-SHA512: 8228f9027e52ed534411d595c7e45cf4edeee9757f26f5141fbcfae3fc6f598a8cea7f734bb8f55238857a37ad2f2d518e859e1fe8c106c0712da976792ac132
2019-08-14 14:33:22 +02:00
MarcoFalke
24f29790cd
Merge #16589: build: Remove unused src/obj-test folder
fa4ee0ddf1 build: Remove unused src/obj-test folder (MarcoFalke)

Pull request description:

  I believe this is no longer used after we switched from a makefile to autotools

ACKs for top commit:
  emilengler:
    Concept ACK fa4ee0ddf1

Tree-SHA512: cbedd3e65afc4de93b16500a0ff2e8778eb94e0224409d9a8d7cfc14cf22087471d260e63ba8d1322afdef5930d6c26fb64060e9e1b23876132cb9cdc35dce2c
2019-08-14 08:26:21 -04:00
fanquake
0753c73927
Merge #16596: rpc: Fix getblocktemplate CLI example
14f7eec3bd rpc: Fix getblocktemplate CLI example (#16594) (Emil Engler)

Pull request description:

  Fixes #16594.
  I didn't found any other syntax error in the code.
  Correct me if I'm wrong

ACKs for top commit:
  fanquake:
    ACK 14f7eec3bd

Tree-SHA512: 2137df2de07df2df9ffbe9e4b4ebb100bb40a36234aba01a6f65b00026f578a7a9040ac99936b4052531d72435e6e04f771beb8d6be51a9b072f93e88f1ecc01
2019-08-14 20:12:46 +08:00
fanquake
396385657c
descriptor: fix missed m_script_arg arg renaming in #14934 2019-08-14 19:48:13 +08:00
Wladimir J. van der Laan
e7df1ecd17
Merge #14934: Descriptor expansion cache clarifications
2e68ffaf20 [doc] descriptor: explain GetPubKey() usage with cached public key (Sjors Provoost)
2290269759 scripted-diff: rename DescriptorImpl m_script_arg to m_subdescriptor_arg (Sjors Provoost)

Pull request description:

  I found the name `m_script_arg` to be confusing while reviewing https://github.com/bitcoin/bitcoin/pull/14646#discussion_r240677238. @sipa let me know if `m_subdescriptor_arg` is completely wrong.

  I also added an explanation of why we call `GetPubKey` when we don't ask it for a public key.

ACKs for top commit:
  laanwj:
    ACK 2e68ffaf20

Tree-SHA512: 06698e9a91cdda93c043a82732793f0ad3cd91daa2513565953e9fa048d5573322fb534e9d0ea9ab736e6366be5921e2b8699c4f4b3693edab48039aaae06f78
2019-08-14 13:30:27 +02:00
John Newbery
3862e473f0 [rpc] Tidy up reporting of buried and ongoing softforks
This combines reporting of buried (formally ISM) softfork deployments
and BIP9 versionbits softfork deployments into one JSON object in the
getblockchaininfo return object.
2019-08-13 15:53:02 -04:00
Emil Engler
14f7eec3bd
rpc: Fix getblocktemplate CLI example (#16594) 2019-08-13 18:25:58 +02:00
Martin Zumsande
7cd069d8ef Add test for AddTimeData 2019-08-13 17:04:10 +02:00
fanquake
b799ebcc17
Merge #16566: util: refactor upper/lowercase functions
0481fa2584 util: refactor upper/lowercase functions (Karl-Johan Alm)

Pull request description:

  This includes renaming Downcase() to ToLower() and make it return a string rather than modify referenced arg.
  Also adds ToUpper() string version.

  Additionally, it clarifies that the locale independency of the case functions is a *feature* and not a limitation. I interpreted it as the latter and rewrote code to be locale-aware before realizing this.

  This is done in preparation for #11413 and as a general refactor. I don't think the optimization that the pre-refactor state gave warrants the unwieldy usage.

ACKs for top commit:
  laanwj:
    ACK 0481fa2584 from me
  practicalswift:
    ACK 0481fa2584 -- diff looks correct
  l2a5b1:
    ACK 0481fa2 - Although, I think @luke-jr's [feedback](https://github.com/bitcoin/bitcoin/pull/16566#issuecomment-519580760) is spot on; `Downcase` is just an artifact of `ParseNetwork`, which has been happily downcasing `net` via a string argument for over 7 years; and I do recommend to add `ToLower` *when* somebody actually needs it in new work, there is no point in keeping a trivial utility function if it is not appreciated.
  promag:
    ACK 0481fa2584.

Tree-SHA512: 9b834ecc1b97db043e261bcbc59e42372e11e2fb9a6943688f18a835bf5c9205f68e4614f58e90ba260d1b8f0e060c6f67b390b62436c21b56891db23bc41628
2019-08-13 12:28:22 +08:00
MarcoFalke
fa4ee0ddf1
build: Remove unused src/obj-test folder 2019-08-12 15:32:46 -04:00
MarcoFalke
b499d8576f
Merge #16557: [wallet] restore coinbase and confirmed/conflicted checks in SubmitMemoryPoolAndRelay()
c8b53c3bea [wallet] Restore confirmed/conflicted tx check in SubmitMemoryPoolAndRelay() (John Newbery)
214c4ecb9a [wallet] restore coinbase check in SubmitMemoryPoolAndRelay() (John Newbery)

Pull request description:

  These checks don't change mempool acceptance/relay behaviour, but reduce log spam.

ACKs for top commit:
  MarcoFalke:
    ACK c8b53c3bea (non-doc changes are mostly a git revert 8753f5652b)
  ariard:
    utACK c8b53c3

Tree-SHA512: f928573ad68d2f70ac69a84b57f352d255dccd1942097cc664f130fcbdcdd7364bc52c43b9157e65ebbaaebbe93586c6e8386f24361b27478e0a23a445677672
2019-08-12 13:49:58 -04:00
Jonas Schnelli
9059a6f248
Merge #16349: qt: Remove redundant WalletController::addWallet slot
6285a318d7 Remove redundant WalletController::addWallet slot (Hennadii Stepanov)

Pull request description:

  ~~Fix #15453.~~ It is fixed by https://github.com/bitcoin/bitcoin/pull/16348#issuecomment-509308347

  The _only_ reason of these lines on master (8c69fae944)
  2679bb8919/src/qt/walletcontroller.cpp (L121-L128)
  is to `Q_EMIT walletAdded(wallet_model);` in a thread-safe manner;

  This PR makes this in a line of code:
  1b83875006/src/qt/walletcontroller.cpp (L121)

  EDITED:
  To establish the ownership of a new `WalletModel` object is not necessary on the master (https://github.com/bitcoin/bitcoin/pull/16349#discussion_r301679192 by **promag**).
  But:
  > it's good habit to set ownership

  And I agree. It is a safe practice.

ACKs for top commit:
  promag:
    ACK 6285a318d7.
  jonasschnelli:
    utACK 6285a318d7
  ryanofsky:
    utACK 6285a318d7. Only change since last review is rebasing and restoring a deleted comment. I do think the comments I suggested last review would be better than this one, but this is at least better than before.

Tree-SHA512: 90370cb1fe853b84dd16c3781ba4f97f3f4deca56bba0203e457f37b3220fd13228cf8495fd882ff18b7c782c27544cc2e7a88aaec5b69b9ef6d8626bdaaf332
2019-08-12 14:15:56 +02:00
nicolas.dorier
d541fa3918
Replace the use of fWhitelisted by permission checks 2019-08-11 11:33:28 +09:00
nicolas.dorier
ecd5cf7ea4
Do not disconnect peer for asking mempool if it has NO_BAN permission 2019-08-11 11:33:27 +09:00
nicolas.dorier
e5b26deaaa
Make whitebind/whitelist permissions more flexible 2019-08-11 11:33:27 +09:00
Andrew Chow
a2714a5c69 Give QApplication dummy arguments
QApplication takes the command line arguments and parses them itself
for some built in command line arguments that it has. We don't want
any of those built in arguments, so instead give it dummy arguments.
2019-08-09 15:47:37 -04:00
John Newbery
c8b53c3bea [wallet] Restore confirmed/conflicted tx check in SubmitMemoryPoolAndRelay()
Restores the confirmed/conflicted tx check removed in
8753f5652b. There should be no external
behaviour change (these txs would not get accepted to the mempool
anyway), but not having the check in the wallet causes log spam.

Also adds a comment to ResentWalletTransactions() that
confirmed/conflicted tx check is done in SubmitMemoryPoolAndRelay().
2019-08-09 11:07:30 -04:00
Antoine Riard
b7b9f6e4ce Remove p2pEnabled from Chain interface
RPC server starts in warmup mode, it can't
process yet calls, then follows connection manager
initialization and finally RPC server get out of
warmup mode. RPC calls shouldn't be able to get
P2P disabled errors because once we initialize
g_connman it's not unset until shutdown, after
RPC server has been stopped.
2019-08-08 22:57:35 -04:00
Jeremy Rubin
2dbfb37b40 Fix Char as Bool in interfaces 2019-08-08 16:18:30 -07:00
Karl-Johan Alm
0481fa2584
util: refactor upper/lowercase functions
This includes renaming Downcase() to ToLower() and make it return a string rather than modify referenced arg.
Also adds ToUpper() string version.
2019-08-08 11:35:14 +09:00
Pieter Wuille
26d3fad109 Add unmodified-but-with-checksum to getdescriptorinfo 2019-08-06 17:11:12 -07:00
Pieter Wuille
104b3a5069 Factor out checksum checking from descriptor parsing 2019-08-06 17:11:12 -07:00
John Newbery
214c4ecb9a [wallet] restore coinbase check in SubmitMemoryPoolAndRelay()
This check doesn't change mempool acceptance/relay behaviour, but reduces log spam.
2019-08-06 14:38:34 -04:00
James O'Beirne
fae6ab6aed refactor: pcoinsTip -> CChainState::CoinsTip()
This aliasing makes subsequent commits easier to review; eventually CoinsTip()
will return the CCoinsViewCache managed by CChainState.
2019-08-06 13:13:06 -04:00
fanquake
2f37163caf
test: only include and init openSSL where it's actually used 2019-08-06 16:50:42 +08:00
fanquake
31d98584f3
Merge #16497: gui: Generate bech32 addresses by default (take 2, fixup)
fa5a4cd813 gui: Generate bech32 addresses by default (take 2, fixup) (MarcoFalke)

Pull request description:

  This commit was missing from my previous pull request for some reason 🤔 :

  *    gui: Generate bech32 addresses by default #15711

ACKs for top commit:
  jonasschnelli:
    Tested ACK fa5a4cd813
  promag:
    ACK fa5a4cd813.
  fanquake:
    ACK fa5a4cd813

Tree-SHA512: 4a38df929d7704bf08e50a2e814b2e6cd25c4165d040a84287045b44e32f4708750845520d64170ea58e41de3ca496da4625d3eb375f9528b21b364c22068a6b
2019-08-06 09:39:26 +08:00
MarcoFalke
c77f7cdbd1
Merge #16197: net: Use mockable time for tx download
fab3658356 [qa] Test that getdata requests work as expected (Suhas Daftuar)
fa883ab35a net: Use mockable time for tx download (MarcoFalke)

Pull request description:

  Two commits:

  * First commit changes to mockable time for tx download (refactoring, should only have an effect on regtest)
  * Second commit adds a test that uses mocktime to test tx download

ACKs for top commit:
  laanwj:
    code review ACK 16197/commits/fab365835639a3da03f8ad9a58a0db6c6c4c2314
  jamesob:
    ACK fab3658356

Tree-SHA512: 3a64a3e283ec4bab1f6e506404b11f0a564a5b61d2a7508ae738a61f035e57220484c66e0ae47d847fe9f7e3ff5cc834909d7b34a9bbcea6abe01f8742806908
2019-08-05 08:01:28 -04:00
MarcoFalke
3a3d8b8357
Merge #16097: Refactor: Add Flags enum to ArgsManager class
e6f649cb2c test: Make tests arg type specific (Hennadii Stepanov)
b70cc5d733 Revamp option negating policy (Hennadii Stepanov)
db08edb303 Replace IsArgKnown() with FlagsOfKnownArg() (Hennadii Stepanov)
dde80c272a Use ArgsManager::NETWORK_ONLY flag (Hennadii Stepanov)
9a12733508 Remove unused m_debug_only member from Arg struct (Hennadii Stepanov)
fb4b9f9e3b scripted-diff: Use ArgsManager::DEBUG_ONLY flag (Hennadii Stepanov)
1b4b9422ca scripted-diff: Use Flags enum in AddArg() (Hennadii Stepanov)
265c1b58d8 Add Flags enum to ArgsManager (Hennadii Stepanov)
e0d187dfeb Refactor InterpretNegatedOption() function (Hennadii Stepanov)
e0e18a1017 refactoring: Check IsArgKnown() early (Hennadii Stepanov)

Pull request description:

  This PR adds the `Flags` enum to the `ArgsManager` class. Also the `m_flags` member is added to the `Arg` struct. Flags denote an allowed type of an arg value and special hints.

  This PR is only a refactoring and does not change behavior.

ACKs for top commit:
  jamesob:
    ACK e6f649cb2c
  MarcoFalke:
    ACK e6f649cb2c thanks for adding types to the command line options

Tree-SHA512: b867f8a9cbce2d2473c293d534af662d8cd5be15060ff0682e97af678974bdaac35e8bc6328ccba32f105034bcd38f169b92a6fb67798667891ce14d5d2a2dea
2019-08-02 12:18:16 -04:00
MarcoFalke
be0e8b4bff
Merge #15713: refactor: Replace chain relayTransactions/submitMemoryPool by higher method
fb62f128bb Tidy up BroadcastTransaction() (John Newbery)
b8eecf8e79 Remove unused submitToMemoryPool and relayTransactions Chain interfaces (Antoine Riard)
8753f5652b Remove duplicate checks in SubmitMemoryPoolAndRelay (Antoine Riard)
611291c198 Introduce CWalletTx::SubmitMemoryPoolAndRelay (Antoine Riard)
8c8aa19b4b Add BroadcastTransaction utility usage in Chain interface (Antoine Riard)

Pull request description:

  Remove CWalletTx::AcceptToMemoryPool

  Replace CWalletTx::RelayWalletTransaction by SubmitMemoryPoolAndRelay

  Add a relay flag to broadcastTransaction because wasn't sure of ReacceptWalletTransactions semantic.

  Obviously, working on implementing https://github.com/bitcoin/bitcoin/pull/14978#issuecomment-459373984 to add the new higher-method in Node interface, will add a commit, just need more thought to do it cleanly

ACKs for top commit:
  MarcoFalke:
    re-ACK fb62f128bb
  Sjors:
    re-ACK fb62f128bb

Tree-SHA512: a7ee48b0545f537fa65cac8ed4cb24e777ab90b877d4eefb87971fa93c6a59bd555b62ad8940c6ffb40592a0bd50787d27587af99f20b56af72b415b6394251f
2019-08-02 09:13:06 -04:00
MarcoFalke
d759b5d26a
Merge #15911: Use wallet RBF default for walletcreatefundedpsbt
d6b3640ac7 [test] walletcreatefundedpsbt: check RBF is disabled when -walletrbf=0 (Sjors Provoost)
9ed062b568 [doc] rpc: remove "fallback to" from RBF default help (Sjors Provoost)
4fcb698bc2 [rpc] walletcreatefundedpsbt: use wallet default RBF (Sjors Provoost)

Pull request description:

  The `walletcreatefundedpsbt` RPC call currently ignores `-walletrbf` and defaults to not use RBF. This PR fixes that.

  This PR also replaces UniValue in `ConstructTransaction` with a `bool` in preparation of moving this helper method out of the RPC codebase entirely. This may be a bit overkill, but does slightly simplify it.

  Fixes #15878

ACKs for top commit:
  achow101:
    Code Review ACK d6b3640ac7
  l2a5b1:
    re-ACK d6b3640
  MarcoFalke:
    ACK d6b3640ac7

Tree-SHA512: 55b9bccd1ef36b54f6b34793017dc0721103099ad3761b3b04862291ee13d6915915d4dbb1a8567924fa56e5e95dfe10eec070e06701610e70c87f8ea92b2a00
2019-08-02 08:53:39 -04:00
John Newbery
fb62f128bb Tidy up BroadcastTransaction() 2019-08-01 13:43:29 -04:00
Antoine Riard
b8eecf8e79 Remove unused submitToMemoryPool and relayTransactions Chain interfaces 2019-08-01 13:43:29 -04:00
Antoine Riard
8753f5652b Remove duplicate checks in SubmitMemoryPoolAndRelay
IsCoinBase check is already performed early by
AcceptToMemoryPoolWorker
GetDepthInMainChain check is already perfomed by
BroadcastTransaction

To avoid deadlock we MUST keep lock order in
ResendWalletTransactions and CommitTransaction,
even if we lock cs_main again further.
in BroadcastTransaction. Lock order will need
to be clean at once in a future refactoring
2019-08-01 13:43:29 -04:00
Antoine Riard
611291c198 Introduce CWalletTx::SubmitMemoryPoolAndRelay
Higher wallet-tx method combining RelayWalletTransactions and
AcceptToMemoryPool, using new Chain::broadcastTransaction
2019-08-01 13:43:29 -04:00
Antoine Riard
8c8aa19b4b Add BroadcastTransaction utility usage in Chain interface
Access through a broadcastTransaction method.
Add a wait_callback flag to turn off race protection when wallet
already track its tx being in mempool

Standardise highfee, absurdfee variable name to max_tx_fee

We drop the P2P check in BroadcastTransaction as g_connman is only
called by RPCs and the wallet scheduler, both of which are initialized
after g_connman is assigned and stopped before g_connman is reset.
2019-08-01 13:43:26 -04:00
Wladimir J. van der Laan
e653eeff76
Merge #16277: [Tests] Suppress output in test_bitcoin for expected errors
7a0c224289 Suppress output in test_bitcoin for expected errors (Gert-Jaap Glasbergen)

Pull request description:

  Closes #15944

  This adds two methods to noui, that allows temporarily suppressing (and then resuming) the output from `noui`. For situations where errors are expected, it's confusing for the test binary to output an error and then conclude with `No errors detected`.

  It also uses this supress/reconnect in the tests that currently produce verbose errors when running `test_bitcoin`.

  Output of `test_bitcoin` on current master:
  ```
  gertjaap@gjdesktop:~/src/bitcoin$ src/test/test_bitcoin
  Running 351 test cases...
  Error: Specified -walletdir "/tmp/test_common_Bitcoin Core/1561389554_943311758/tempdir/path_does_not_exist" does not exist
  Error: Specified -walletdir "/tmp/test_common_Bitcoin Core/1561389554_643733972/tempdir/not_a_directory.dat" is not a directory
  Error: Specified -walletdir "wallets" is a relative path

  *** No errors detected
  ```

  Output after this code is merged:

  ```
  gertjaap@gjdesktop:~/src/bitcoin$ src/test/test_bitcoin
  Running 351 test cases...

  *** No errors detected
  ```

ACKs for top commit:
  l2a5b1:
    ACK 7a0c224 - tested and reviewed.
  laanwj:
    ACK 7a0c224289

Tree-SHA512: c7881f7a431a065329360ffa9937ce4742694c646c90c019d3aff95dfd7fccbdcda9116c5762feb6dfd1108d14f9fb386e203b173c4bde9093afb2b8c977d13d
2019-08-01 15:17:10 +02:00
Wladimir J. van der Laan
75656988ac
Merge #16514: gui: Remove unused RPCConsole::tabFocus
b078067b9c gui: Remove unused RPCConsole::tabFocus (João Barbosa)

Pull request description:

  Added in #14573 but not used, so begone.

ACKs for top commit:
  practicalswift:
    utACK b078067b9c
  hebasto:
    ACK b078067b9c
  laanwj:
    ACK b078067b9c, there's nothing really to test here

Tree-SHA512: 237276dea4d174b5fca34855447146f79c3faaae7179f4245c70e2070b49282d95f886b1be6d2a33713c81a254f4483a4e4bf850053a8dcb18a3a897bd3da08e
2019-08-01 12:41:45 +02:00
MeshCollider
6841b01340
Merge #16394: Allow createwallet to take empty passwords to make unencrypted wallets
c5d3787367 Allow createwallet to take empty passwords to make unencrypted wallets (Andrew Chow)

Pull request description:

  Allow createwallet to take the empty string as a password and interpret that as leaving the wallet unencrypted. Also warn when that happens.

  This fixes a bug where it was not possible to use the `avoid_reuse` option for new unencrypted wallets without using named arguments.Thus this allows more `createwallet` options to be added that can be set on unencrypted wallets when using positional arguments.

ACKs for top commit:
  jnewbery:
    code review ACK c5d3787367
  meshcollider:
    re-utACK c5d3787367
  ryanofsky:
    utACK c5d3787367. Changes since last review are rebasing, concatenating warning strings to avoid discarding warnings, adding release notes, and choosing an unambiguous wallet name for the test.

Tree-SHA512: 146737a728dd614ba94d4b166b27e8c9e195badd1709ccab2315afe59176d9b493dfba9b61c3ed81090f059c7e464d709deb06d99451b9a3fff667f527d6f7c9
2019-08-01 19:11:01 +12:00
fanquake
b7fbf74b98
Merge #16502: wallet: Drop unused OldKey
0b1f4b3c66 wallet: Drop unused OldKey (João Barbosa)

Pull request description:

  Replaces #16494, `OldKey` (previously `CWalletKey`) was never serialized in the code history which means that unserialization support is not required, so remove the code entirely.

ACKs for top commit:
  jnewbery:
    ACK 0b1f4b3c66
  laanwj:
    ACK 0b1f4b3c66
  fanquake:
    ACK 0b1f4b3c66

Tree-SHA512: 92e9b2d6fc41f2765492d5d69d18fc4302c40ab44f28c8c30ca652c72767fbc484848c51a38ecf1f447849767a583c398784408bb5f64f9c86f9a5872b325ffc
2019-08-01 12:13:33 +08:00
João Barbosa
b078067b9c gui: Remove unused RPCConsole::tabFocus 2019-07-31 23:29:19 +01:00
Hennadii Stepanov
e6f649cb2c
test: Make tests arg type specific 2019-07-31 21:58:14 +03:00
Hennadii Stepanov
b70cc5d733
Revamp option negating policy 2019-07-31 21:57:12 +03:00
João Barbosa
0b1f4b3c66 wallet: Drop unused OldKey 2019-07-31 18:35:46 +01:00
MarcoFalke
7821821a23
Merge #16452: refactor: use RelayTransaction in BroadcastTransaction utility
9bc8b28c1d refactor : use RelayTransaction in BroadcastTransaction utility (Antoine Riard)

Pull request description:

  Implementing suggestion in https://github.com/bitcoin/bitcoin/pull/15713#discussion_r306571420.

  Seems a reason of these node utilities is to glue with already there functions, so we should reuse them.

ACKs for top commit:
  MarcoFalke:
    ACK 9bc8b28c1d
  promag:
    ACK 9bc8b28c1d, verified there are no more `PushInventory(CInv(MSG_TX, ...`, nice refactor, 👍 @amitiuttarwar.
  jnewbery:
    ACK 9bc8b28c1d
  jonatack:
    ACK 9bc8b28c1d, second @jnewbery's suggestions, my guess is they could be added without risking delaying this PR.

Tree-SHA512: 841c65d5f0d9ead5380814bb2260d7ebf03f2a9bfa58a1025785d353bdb42f9122cc257993e6a7bd2bd3f2c74db19c5978cc14be0d83258124ca22e33d6d0164
2019-07-31 10:49:28 -04:00
Wladimir J. van der Laan
00922b8720
Merge #15906: [wallet] Move min_depth and max_depth to coin control
80ba4241a6 extract min & max depth onto coin control (Amiti Uttarwar)

Pull request description:

  - Refactor `AvailableCoins` to pull min & max depths from coin control.
  - Add `m_max_depth` to coin control to support this.

  - Addresses issue https://github.com/bitcoin/bitcoin/issues/15823, see thread for further details.

ACKs for top commit:
  laanwj:
    ACK 80ba4241a6

Tree-SHA512: 8f7c0aa90b3bc3667baf6741b1da2829f3919e1df92ae097d86c6b239f0c024eb410d7100e6251ea8fc49d022fb5a1214bf79b0f8b0014945b7784b2311647d1
2019-07-31 12:11:51 +02:00
Wladimir J. van der Laan
8241b51504
Merge #16451: Remove CMerkleTx
05b56d1c93 [wallet] Remove CMerkleTx serialization logic (John Newbery)
783a76f23b [wallet] Flatten CWalletTx class hierarchy (John Newbery)
b3a9d179f2 [wallet] Move CMerkleTx functions into CWalletTx (John Newbery)

Pull request description:

  CMerkleTx is only used as a base class for
  CWalletTx. It was previously also used for vtxPrev which
  was removed in 93a18a3650.

  This PR moves all of the CMerkleTx members and logic
  into CWalletTx. The CMerkleTx class is kept for deserialization
  and serialization of old wallet files.

  This makes the refactor in #15931 cleaner.

ACKs for top commit:
  laanwj:
    ACK 05b56d1c93. Looks good to me.

Tree-SHA512: 3d3a0069ebb536b12a328f1261e7dc55158a71088d445ae4b4ace4142c432dc296f58c8183b1922e54a60b8cc77e9d17c3dce7478294cd68693594baacf2bab3
2019-07-31 09:00:55 +02:00
Jonas Schnelli
39763b7555
Merge #16433: txmempool: Remove unused default value MemPoolRemovalReason::UNKNOWN
0000ff0aa7 txmempool: Remove unused default value MemPoolRemovalReason::UNKNOWN (MarcoFalke)

Pull request description:

  The `remove*` methods set the removal reason to `UNKNOWN` by default. This is nowhere used; Except in tests, where the value doesn't matter. Fix that by removing the confusing default.

ACKs for top commit:
  practicalswift:
    utACK 0000ff0aa7
  promag:
    ACK 0000ff0aa7.
  jonasschnelli:
    utACK 0000ff0aa7

Tree-SHA512: ffc8b35dd3291a81225171577c743c8bb2645638cab02960b6361174cb68afd739aaab7ab8661d65de5750d37daf16bb7eee9338958d8609093a8d46c2ada1ab
2019-07-30 22:02:02 +02:00
MarcoFalke
fa5a4cd813
gui: Generate bech32 addresses by default (take 2, fixup) 2019-07-30 13:53:21 -04:00
John Newbery
05b56d1c93 [wallet] Remove CMerkleTx serialization logic
CMerkleTx is only used for deserialization of old wallet files. Remove
the serialization logic, and tidy up CWalletTx serialization logic.
2019-07-30 11:57:06 -04:00
John Newbery
783a76f23b [wallet] Flatten CWalletTx class hierarchy
Removes CMerkleTx as a base class for CWalletTx. Serialization logic is
moved from CMerkleTx to CWalletTx.
2019-07-30 11:57:06 -04:00
John Newbery
b3a9d179f2 [wallet] Move CMerkleTx functions into CWalletTx
CMerkleTx only exists as a base class for CWalletTx and for wallet file
serialization/deserialization. Move CMerkleTx methods into CWalletTx,
but leave class hierarchy and serialization logic in place.
2019-07-30 11:57:06 -04:00
Wladimir J. van der Laan
bd35ec36f5
Merge #16434: build: Specify AM_CPPFLAGS for ZMQ
29ee4c417d Specify AM_CPPFLAGS for ZMQ. (Daniel Kraft)

Pull request description:

  When building the ZMQ static library, add `AM_CPPFLAGS` to the library `CPPFLAGS`.  Otherwise, we may miss important flags that are specified elsewhere.  For instance, if `--enable-debug` is passed and
  `-DDEBUG_LOCKORDER` set, then that would not apply to the ZMQ library before (causing potential for hard-to-find bugs).

ACKs for top commit:
  laanwj:
    utACK 29ee4c417d

Tree-SHA512: 64085d71ed3f435a6e4df6dc42bda8b6159a4d292d0547c5b38c09d6ac95e976ad1728cd65278bffdd57363f60a58eb762b1171dafbe055cf94ffcd4f66da877
2019-07-30 15:42:05 +02:00
Peter Bushnell
914923d125 Add setting as known type 2019-07-30 06:36:34 +01:00
fanquake
478fe328a7
Merge #16475: wallet: Enumerate walletdb keys
fa6f22bf44 wallet: Rename CWalletKey to OldKey (MarcoFalke)
fa6dc7fa5f wallet: Enumerate walletdb keys (MarcoFalke)

Pull request description:

  It is nice to see all the keys that exists in a single enum

  Also, rename CWalletKey to OldKey and update the outdated documentation

ACKs for top commit:
  laanwj:
    ACK fa6f22bf44, I'm a big fan of this kind of change as it prevents typos, which can happen with 'magic' strings in the code.
  promag:
    ACK fa6f22bf44. @jnewbery suggestions are great followups, I think this is good enough.
  meshcollider:
    utACK fa6f22bf44
  achow101:
    Code review ACK fa6f22bf44
  fanquake:
    ACK fa6f22bf44 - I had a quick look over, definitely prefer this to strings floating around everywhere.

Tree-SHA512: 8ac3abd5a0d22dac1d77b8f97fe1e16c2608d650f3e9d6dd1df2fd5aeb35ef6643dfd4cd5c162404bb0100343c927d66df04dc695507ffc84a6c667e603acc54
2019-07-30 11:37:01 +08:00
Wladimir J. van der Laan
68da54987d
Merge #16471: [mempool] log correct messages when CPFP fails
42a5e912ee [mempool] log correct messages when CPFP fails (John Newbery)

Pull request description:

  Fixes a logging issue introduced in #15681

ACKs for top commit:
  laanwj:
    ACK 42a5e912ee (+utACK from bluematt that isn't registered because it has no commit id)

Tree-SHA512: ff5f423cc4d22838eea00c5b1d39ceda89cd61474c72f256a97c698eb0ec3f2156a97139f537669376132902c1e3943bf84c356a4b98a9a306b4ec57302c2761
2019-07-29 18:55:17 +02:00
Andrew Chow
c5d3787367 Allow createwallet to take empty passwords to make unencrypted wallets
Allow createwallet to take the empty string as a password and interpret that
as leaving the wallet unencrypted. Also warn when that happens.
2019-07-29 11:50:24 -04:00
Wladimir J. van der Laan
2a7c3bc498
Merge #16436: gui: Do not create payment server if -disablewallet option provided
4057b7acb7 wallet: Recognize -disablewallet option early (Hennadii Stepanov)

Pull request description:

  This PR makes early check for the `-disablewallet` option.

  If `-disablewallet=1`, objects `PaymentServer` and `WalletController` are  nor created.

ACKs for top commit:
  jonasschnelli:
    utACK 4057b7acb7
  laanwj:
    ACK 4057b7acb7

Tree-SHA512: 74633cd1eacd0914c73712e6dff190255b5378595cfee7eaeb91e17671fc9120928034739f4ae1c53b86f46c4b400390877241384376b2fc534de326d3ab0944
2019-07-29 17:18:55 +02:00
Wladimir J. van der Laan
b21acab82f
Merge #15993: net: Drop support of the insecure miniUPnPc versions
59cb722fd0 Update configure to reject unsafe miniUPnPc API ver (Hennadii Stepanov)
ab2190557e doc: Add release notes for 15993 (Hennadii Stepanov)
02709e9560 Align formatting with clang-format (Hennadii Stepanov)
91a1b85083 Use PACKAGE_NAME in UPnP description (Hennadii Stepanov)
9f76e45b9d Drop support of insecure miniUPnPc versions (Hennadii Stepanov)

Pull request description:

  1. Minimum supported miniUPnPc API version is set to 10:
  - https://packages.ubuntu.com/xenial/libminiupnpc-dev
  - https://packages.debian.org/jessie/libminiupnpc-dev

  Refs:
  - #6583
  - #6789
  - #10414

  2. The hardcoded "Bitcoin" replaced with `PACKAGE_NAME`:
  ![Screenshot from 2019-05-06 23-10-29](https://user-images.githubusercontent.com/32963518/57253178-afc60780-7056-11e9-83c9-e85670c58c1e.png)

  3. Also style-only commit applied.

  Pardon: could not reopen my previous PR #15966.

ACKs for top commit:
  ryanofsky:
    utACK 59cb722fd0. Changes since last review: adding a new commit which updates configure script to fall back to disabling upnp if version is too old, adding a requested comment explaining static_assert condition, and fixing a spelling (jessy/jessie)

Tree-SHA512: 42ed11bc2fb2ec83d5dd58e2383da5444a24fd572707f6cf10b622cb8943e28adfcca4750d06801024c4472625b5ea9279516fbd9d2ccebc9bbaafe1d148e80d
2019-07-29 16:51:36 +02:00
MarcoFalke
74ea1f3b0f
Merge #16399: wallet: Improve wallet creation
e967cae8fa Use switch on status in RpcWallet (Fabian Jahr)
ba1f128d6c Return error for ignored passphrase through disable private keys option (Fabian Jahr)
d6649d16b5 Use strong enum for WalletCreationStatus (Fabian Jahr)
3199610ad3 Place out args at the end for CreateWallet (Fabian Jahr)

Pull request description:

  This is a follow-up PR to #16244

  The following suggestions are included:
  - Usage of `enum class` (https://github.com/bitcoin/bitcoin/pull/16244#discussion_r296434142)
  - Placing out args at the end convention (https://github.com/bitcoin/bitcoin/pull/16244#discussion_r296434172)
  - Return error when passphrase would be ignored because of disabled private keys (including functional test) (https://github.com/bitcoin/bitcoin/pull/16244#pullrequestreview-252015195)
  - Make `status` return variable of `CreateWallet` (https://github.com/bitcoin/bitcoin/pull/16244#discussion_r302107394)
  - Using a `switch` statement instead of `if/else` in `RpcWallet` (https://github.com/bitcoin/bitcoin/pull/16244#discussion_r302112502)

  Not included was:
  - "new create wallet function [could take] separate option arguments instead of wallet flags" (https://github.com/bitcoin/bitcoin/pull/16244#pullrequestreview-252015195)
  - "blank wallet and disable private keys options could be combined into a single option" (https://github.com/bitcoin/bitcoin/pull/16244#pullrequestreview-252015195)

  For these last two changes, I was not sure what an ideal solution could look like and/or this might be of slightly larger scope than the other changes, but I would be happy to work on these as well in this PR or another follow-up if I get positive feedback on that. Is there a place in the codebase that handles flags like these in a better way that I can refer to? Nonetheless, I would prefer keeping it in a separate PR unless it is a really simple change.

ACKs for top commit:
  jnewbery:
    Code review utACK e967cae8fa
  MarcoFalke:
    ACK e967cae8fa

Tree-SHA512: 3d12880ff95add9e4a5702afa26ef38080b57b216a608c113a4d0a08ba2d61142c027ba0071c6402add45db90383eee0bada12dc42820dc0d602721d7175edd5
2019-07-29 09:36:55 -04:00
Wladimir J. van der Laan
f735851be2
Merge #16467: rpc: sendrawtransaction help privacy note
07e01d6258 rpc: sendrawtransaction unconditionality/privacy note (Jon Atack)

Pull request description:

  In sendrawtransaction RPCHelpMan, mention unconditionality and privacy as per http://www.erisian.com.au/bitcoin-core-dev/log-2019-07-25.html#l-522

  before

  ```
  $ bitcoin-cli help sendrawtransaction
  sendrawtransaction "hexstring" ( maxfeerate )

  Submits raw transaction (serialized, hex-encoded) to local node and network.

  Also see createrawtransaction and signrawtransactionwithkey calls.

  (...)
  ```

  after

  ```
  $ bitcoin-cli help sendrawtransaction
  sendrawtransaction "hexstring" ( maxfeerate )

  Submit a raw transaction (serialized, hex-encoded) to local node and network.

  Note that the transaction will be sent unconditionally to all peers, so using this
  for manual rebroadcast may degrade privacy by leaking the transaction's origin, as
  nodes will normally not rebroadcast non-wallet transactions already in their mempool.

  Also see createrawtransaction and signrawtransactionwithkey calls.

  (...)
  ```

ACKs for top commit:
  promag:
    ACK 07e01d6258.
  laanwj:
    ACK 07e01d6258

Tree-SHA512: 427b3ca29384eef271eb496b7b14e883220863543a536ddeb31940aaffd52ea0b607d929d50f2b7958514105ef7823fa05c1ee381d4a432808753c06bd97af58
2019-07-29 14:52:01 +02:00
David A. Harding
16b3748189
Trivial: add missing space 2019-07-28 13:33:10 -10:00
MarcoFalke
fa6f22bf44
wallet: Rename CWalletKey to OldKey 2019-07-27 16:32:30 -04:00
MarcoFalke
fa6dc7fa5f
wallet: Enumerate walletdb keys 2019-07-27 16:31:34 -04:00
Hennadii Stepanov
db08edb303
Replace IsArgKnown() with FlagsOfKnownArg() 2019-07-27 22:52:18 +03:00
Hennadii Stepanov
dde80c272a
Use ArgsManager::NETWORK_ONLY flag 2019-07-27 22:51:58 +03:00
Jon Atack
07e01d6258
rpc: sendrawtransaction unconditionality/privacy note
In sendrawtransaction RPCHelpMan, mention unconditionality and privacy
as per http://www.erisian.com.au/bitcoin-core-dev/log-2019-07-25.html#l-522

Thank you to MarcoFalke and laanwj for their review and suggestions.
2019-07-27 19:43:44 +02:00
Sjors Provoost
9ed062b568
[doc] rpc: remove "fallback to" from RBF default help 2019-07-27 19:28:39 +02:00
Sjors Provoost
4fcb698bc2
[rpc] walletcreatefundedpsbt: use wallet default RBF 2019-07-27 19:24:56 +02:00
Hennadii Stepanov
9a12733508
Remove unused m_debug_only member from Arg struct 2019-07-27 15:05:14 +03:00
Hennadii Stepanov
fb4b9f9e3b
scripted-diff: Use ArgsManager::DEBUG_ONLY flag
-BEGIN VERIFY SCRIPT-
sed -i 's/unsigned int flags, const bool debug_only,/unsigned int flags,/' src/util/system.h src/util/system.cpp
sed -i 's/ArgsManager::NONE, debug_only/flags, false/' src/util/system.cpp
sed -i 's/arg.second.m_debug_only/(arg.second.m_flags \& ArgsManager::DEBUG_ONLY)/' src/util/system.cpp
sed -i 's/ArgsManager::ALLOW_ANY, true, OptionsCategory::/ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::/' $(git grep --files-with-matches 'AddArg(' src)
sed -i 's/ArgsManager::ALLOW_ANY, false, OptionsCategory::/ArgsManager::ALLOW_ANY, OptionsCategory::/' $(git grep --files-with-matches 'AddArg(' src)
-END VERIFY SCRIPT-
2019-07-27 15:05:14 +03:00
Hennadii Stepanov
1b4b9422ca
scripted-diff: Use Flags enum in AddArg()
-BEGIN VERIFY SCRIPT-
sed -i 's/const bool debug_only,/unsigned int flags, &/' src/util/system.h src/util/system.cpp
sed -i -E 's/(true|false), OptionsCategory::/ArgsManager::ALLOW_ANY, &/' $(git grep --files-with-matches 'AddArg(' src)
-END VERIFY SCRIPT-
2019-07-27 15:05:14 +03:00
Hennadii Stepanov
265c1b58d8
Add Flags enum to ArgsManager 2019-07-27 15:05:14 +03:00
Hennadii Stepanov
e0d187dfeb
Refactor InterpretNegatedOption() function
- added args parameter
- renamed to InterpretOption()
- removed code duplication
2019-07-27 15:05:01 +03:00
Hennadii Stepanov
e0e18a1017
refactoring: Check IsArgKnown() early 2019-07-27 14:51:50 +03:00
MeshCollider
febf3a856b
Merge #15588: Log the actual wallet file version and no longer publicly expose the "version" record
35e60e790f Remove ReadVersion and WriteVersion (Andrew Chow)
b3d4f6c961 Log the actual wallet file version (Andrew Chow)
c88e87c3b2 Remove nFileVersion from CWalletScanState (Andrew Chow)

Pull request description:

  The wallet file version is stored in the "minversion" record, not the "version" record. However "version" is no longer used anywhere except to record the highest versioned client which has opened a wallet file (which is currently only used to check whether this was most recently opened by a 0.4.0 or 0.5.0rc1 client which had a broken wallet encryption implementation). Furthermore, "version" was logged to the debug.log which is confusing because it is not the actual wallet file version.

  This PR changes it so that this confusion largely no longer exists. The wallet file version logging is changed to use "minversion" and reading and writing the "version" record is no longer publicly exposed to prevent potential confusion about whether the actual file version is being read or written. Lastly, in the one place it is actually used, the variable name is changed from nFileVersion to last_client to better reflect what that record actually represents.

ACKs for top commit:
  jb55:
    ACK 35e60e7, I compiled locally as a quick sanity check.
  ryanofsky:
    utACK 35e60e790f. This code still pretty confusing, but a little simpler now. And the previous log statement was really misleading and useless compared to the new one here.
  meshcollider:
    Looks good, thanks! utACK 35e60e790f

Tree-SHA512: f782b2f215d07fbc9b806322bda8085445b81c02b65ca674a8c6a3e1de505a0abd050669afe0ead4778816144a1c18462e13930071cedb7227a058aeb39493f7
2019-07-27 22:45:31 +12:00
MeshCollider
1139e3cb76
Merge #16415: Get rid of PendingWalletTx class
4d94916f0d Get rid of PendingWalletTx class. (Russell Yanofsky)

Pull request description:

  No reason for this class to exist if it doesn't have any code to run in the destructor. e10e1e8db0 from https://github.com/bitcoin/bitcoin/pull/16208 recently removed the destructor code that would return an unused key if the transaction wasn't committed.

  This is just cleanup, there's no change in behavior.

ACKs for top commit:
  ariard:
    utACK 4d94916. Successfully built both `bitcoind` and `bitcoin-qt`. `PendingWalletTx` was only a wrapper to enforce call to `ReturnDestination` if `CommitTransaction` doesn't `KeepDestination` before.
  promag:
    ACK 4d94916f0d, refactor looks good to me.
  meshcollider:
    utACK 4d94916f0d

Tree-SHA512: f3f93d2f2f5d8f1e7810d609d881c1b1cbbaa8629f483f4293e20b3210292605e947bc4903fde9d2d8736277ca3bd6de182f7eac1e13515d5a327f2ebc130839
2019-07-27 22:35:32 +12:00
MeshCollider
dfb7fd60f2
Merge #16402: Remove wallet settings from chainparams
fa4a605a4c Remove wallet settings from chainparams (MarcoFalke)

Pull request description:

  Feels a bit odd to have wallet setting in the chainparams, so remove them from there

ACKs for top commit:
  promag:
    ACK fa4a605a4c, missed s/2018/2019?
  practicalswift:
    utACK fa4a605a4c
  darosior:
    ACK fa4a605a4c

Tree-SHA512: 2b3a5ee85d36af290d7db80bed1339e3c684607f1ce61cc65c906726e9174e40325fb1f67a34d8780f2a61fa39a1785e7c3a1cef5b6d6c364f38db5300cdbe3a
2019-07-27 22:29:09 +12:00
MeshCollider
c606e6fc53
Merge #15996: rpc: Deprecate totalfee argument in bumpfee
2f7eb772f6 Add RPC bumpfee totalFee deprecation test (Jon Atack)
a92d9ce8cf deprecate totalFee argument in bumpfee RPC call (Gregory Sanders)

Pull request description:

  totalFee argument is of questionable use, and should be removed in favor of feerate-based features.

  I first moved IsDeprecatedRPCEnabled because `bitcoin-wallet` doesn't link `libbitcoin_server`.

ACKs for top commit:
  ryanofsky:
    utACK 2f7eb772f6. Only change since last review is leaving IsDeprecatedRPCEnabled in its happy home, and switching to rpcEnableDeprecated instead. (Thanks!)
  jonatack:
    ACK 2f7eb772f6. Built locally, manually tested rpc bumpfee, help output ([gist](https://gist.github.com/jonatack/863673eacc02f9da39ff6d6712f9d837)), all tests pass. Travis failures appears to be unrelated, the [bitcoin builds are green](https://bitcoinbuilds.org/index.php?build=121).
  meshcollider:
    Code Review ACK 2f7eb772f6

Tree-SHA512: c97465205ee59575df37894bcbb6c4ecf8858dd8fe9d89503f9342b226768c1dcb553153bc9eb3055f7bf5eb41573e48b8efa57e083cd255793cbe5280f0026a
2019-07-27 22:22:03 +12:00
John Newbery
42a5e912ee [mempool] log correct messages when CPFP fails 2019-07-26 16:21:26 -04:00
MarcoFalke
dbf4f3f86a
Merge #16301: Use CWallet::Import* functions in all import* RPCs
40ad2f6a58 Have importwallet use ImportPrivKeys and ImportScripts (Andrew Chow)
78941da5ba Optionally allow ImportScripts to set script creation timestamp (Andrew Chow)
94bf156f39 Have importaddress use ImportScripts and ImportScriptPubKeys (Andrew Chow)
a00d1e5ec5 Have importpubkey use CWallet's ImportScriptPubKeys and ImportPubKeys functions (Andrew Chow)
c6a8274247 Have importprivkey use CWallet's ImportPrivKeys, ImportScripts, and ImportScriptPubKeys (Andrew Chow)
fae7a5befd Log when an import is being skipped because we already have it (Andrew Chow)
ab28e31c95 Change ImportScriptPubKeys' internal to apply_label (Andrew Chow)

Pull request description:

  #15741 introduced `ImportPrivKeys`, `ImportPubKeys`, `ImportScripts`, and `ImportScriptPubKeys` in `CWallet` which are used by `importmulti`. This PR changes the remaining `import*` RPCs (`importaddress`, `importprivkey`, `importpubkey`, and `importwallet`) to use these functions as well instead of directly adding the imported items to the wallet.

ACKs for top commit:
  MarcoFalke:
    ACK 40ad2f6a58 (checked that behavior changes are mentioned in the commit body)
  ryanofsky:
    utACK 40ad2f6a58. Only change since last review is a tweaked commit message (mentioning label update in importpubkey commit)
  Sjors:
    ACK 40ad2f6a5. Those extra tests also pass.

Tree-SHA512: 910e3bbe20b6f8809a47b7293775db234125615d886c7fd99c194f4cdf00c765eb1e24b1799260f1213b98c88f9bbe696796f36087c182925e567d44e9194c98
2019-07-26 15:19:24 -04:00
Gregory Sanders
a92d9ce8cf deprecate totalFee argument in bumpfee RPC call 2019-07-26 14:09:03 -04:00
fanquake
d5a54ce8f0
Merge #15305: [validation] Crash if disconnecting a block fails
a47df13471 [qa] Test disconnect block failure -> shutdown (Suhas Daftuar)
4433ed0f73 [validation] Crash if disconnecting a block fails (Suhas Daftuar)

Pull request description:

  If we're unable to disconnect a block during normal operation, then that is a
  failure of our local system (such as disk failure) or the chain that we are on
  (eg CVE-2018-17144), but cannot be due to failure of the (more work) chain that
  we're trying to validate.

  We should abort rather than stay on a less work chain.

  Fixes #14341.

ACKs for top commit:
  practicalswift:
    utACK a47df13471
  TheBlueMatt:
    utACK a47df13471. Didn't bother to review the test in detail, it looked fine. Debated whether invalidateblock should ever crash the node, but *not* crashing in the case of hitting a pruned block (which is the only change here) is clearly better, even if there are other cases I'd argue we should crash in.
  ryanofsky:
    utACK a47df13471. Only change since last review is new comment.
  promag:
    ACK a47df1347, it takes awhile to quit (RPC connection timeouts) but that's unrelated - hope to fix that soon.
  fanquake:
    ACK a47df13471

Tree-SHA512: 4dec8cef6e7dbbe513c138fc5821a7ceab855e603ece3c16185b51a3830ab7ebbc844a28827bf64e75326f45325991dcb672f13bd7baede53304f27289c4af8d
2019-07-25 09:05:22 +08:00
Antoine Riard
9bc8b28c1d refactor : use RelayTransaction in BroadcastTransaction utility
To do so, we also refactor RelayTransaction to take a txid
instead of passing a tx
2019-07-24 19:47:56 -04:00
Hennadii Stepanov
66f5c17f8a
Use CheckDataDirOption() for code uniformity
All other clients and tools use CheckDataDirOption() rather
fs::is_directory(GetDataDir(false)) for the first datadir check.
2019-07-24 18:54:52 +03:00
Hennadii Stepanov
7e33a18a34
Fix datadir handling in bitcoin-cli
This prevents premature tries to access or create the default datadir.
This is useful when the -datadir option is specified and the default
datadir is unreachable.
2019-07-24 18:54:46 +03:00
Hennadii Stepanov
b28dada374
Fix datadir handling in bitcoin-qt
This prevents premature tries to access or create the default datadir.
This is useful when the -datadir option is specified and the default
datadir is unreachable.
2019-07-24 18:54:32 +03:00
Hennadii Stepanov
50824093bb
Fix datadir handling in bitcoind
This prevents premature tries to access or create the default datadir.
This is useful when the -datadir option is specified and the default
datadir is unreachable.
2019-07-24 18:45:02 +03:00
Hennadii Stepanov
740d41ce9f
Add CheckDataDirOption() function 2019-07-24 18:43:07 +03:00
Hennadii Stepanov
c1f325126c
Return absolute path early in AbsPathForConfigVal
This prevents premature GetDataDir() calls, e.g., when config file is
not read yet.
2019-07-24 18:42:59 +03:00
Andrew Chow
40ad2f6a58 Have importwallet use ImportPrivKeys and ImportScripts
Behavior changes:
* An "Importing ..." line is logged for every key, even ones that are skipped
2019-07-24 11:42:46 -04:00