Commit graph

13313 commits

Author SHA1 Message Date
MarcoFalke fa965e03c7
rpc: Use IsValidNumArgs over hardcoded size checks 2019-03-18 13:55:19 -04:00
MarcoFalke fa5c511a83
refactor: Remove unused function 2019-03-18 13:30:55 -04:00
MarcoFalke c033c4b5ce
Merge #13541: wallet/rpc: sendrawtransaction maxfeerate
7abd2e697c wallet/rpc: add maxfeerate parameter to testmempoolaccept (Karl-Johan Alm)
6c0a6f73e3 wallet/rpc: add maxfeerate parameter to sendrawtransaction (Karl-Johan Alm)
e5efacb941 test: Refactor vout fetches in rpc_rawtransaction (Karl-Johan Alm)

Pull request description:

  This adds a new `maxfeerate` parameter to `sendrawtransaction` which forces the node to reject a transaction whose feerate is above the given fee rate.

  This is a safety harness from shooting yourself in the foot and accidentally overpaying fees.

  See also #12911.

Tree-SHA512: efa50134a7c17c9330cfdfd48ba400e095c0a419cc45e630618d8b44929c25d780d1bb2710c1fbbb6e687eca373505b0338cdaa7f2ff4ca22636d84c31557a2e
2019-03-18 13:22:15 -04:00
Carl Dong 340ef50772 depends: Defer to Python detected by autoconf
Since autoconf already detects the correct python binary path, we should
use that instead of going around it. Also has the benefit of working in
extremely restricted environments where /usr/bin/env might not be
available.
2019-03-18 11:05:17 -04:00
MeshCollider 7ec7aea442
Merge #15491: wallet: Improve log output for errors during load
faf369880 wallet: Improve log output for errors during load (Glenn Willen)

Pull request description:

  When loading the wallet, display the entire path in error messages, instead of
  the name (which, for the default wallet, is the empty string.)

  When an exception occurs during wallet loading, display e.what() if possible,
  instead of nothing.

Tree-SHA512: 435247628db669579bb694ba4b53ba174fe42c0329fc72f09fc274bb28463ee69f53412abb2a3b45bb8f59f7eb928c0167e397b8d0a514135142192a87294614
2019-03-18 20:34:55 +13:00
Pieter Wuille 054d01d0a8 Do not relay banned IP addresses 2019-03-17 22:05:49 -07:00
MarcoFalke fa3caa1666
rpc: decodescript use IsValidNumArgs over hardcoded check 2019-03-17 22:52:18 -04:00
MarcoFalke faad33ff15
rpc: Clarify decodescript RPCResult doc 2019-03-17 22:51:33 -04:00
Wladimir J. van der Laan 2f501fb5c6
Merge #15522: Document sizeof(size_t) assumptions and compiler assumptions in assumptions.h
c7a7250302 Document assumptions about C++ compiler (practicalswift)
c7ea8d3236 Add sizeof(size_t) assumptions (practicalswift)

Pull request description:

  Document `sizeof(size_t)` assumptions and compiler assumptions by adding compile-time checks in `assumptions.h`.

Tree-SHA512: db46481eecad6a87718ae637a7761d39d32cfe6f95fc8ad2b3a52a3d966c2a05c8f540dd3f362721279816571b04b6cce2de9b3b1d17606d7b197126cd4a8d1f
2019-03-16 17:11:14 +01:00
Glenn Willen faf3698808 wallet: Improve log output for errors during load
When loading the wallet, display the entire path in error messages, instead of
the name (which, for the default wallet, is the empty string.)

When an exception occurs during wallet loading, display e.what() if possible,
instead of nothing.
2019-03-14 18:49:19 -07:00
MarcoFalke fac1a0fe54
wallet: Remove unused GetLegacyBalance 2019-03-14 16:05:13 -04:00
MarcoFalke faa3a246e8
scripted-diff: wallet: Rename pcoin to wtx
-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended -e 's/const CWalletTx ?\* ?pcoin = &/const CWalletTx\& wtx = /g' src/wallet/wallet.cpp
sed -i -e 's/\<pcoin->/wtx./g' src/wallet/wallet.cpp
sed -i -e 's/\<pcoin\>/\&wtx/g' src/wallet/wallet.cpp
-END VERIFY SCRIPT-
2019-03-14 16:03:53 -04:00
Wladimir J. van der Laan 7fa1f6258c
Merge #15583: wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree
15c69b158d wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree (João Barbosa)

Pull request description:

  Use the `noexcept` members of `boost::filesystem::recursive_directory_iterator` in order to ignore `boost::filesystem::directory_iterator::construct: Permission denied` errors. The errors are logged though.

  Steps to reproduce the issue:

  ```sh
  # 1. create directory for -walletdir without read access:
  mkdir /tmp/foo && chmod a-r /tmp/foo

  # 2. run bitcoin-qt and should print an error, but continues running:
  /Volumes/Bitcoin-Core/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt -regtest -walletdir=/tmp/foo
  /private/tmp/foo: Permission denied

  # 4. go to File -> Open Wallet and should segfault:
  EXCEPTION: N5boost10filesystem16filesystem_errorE
  boost::filesystem::directory_iterator::construct: Permission denied: "/private/tmp/foo"
  bitcoin in Runaway exception
  ```

Tree-SHA512: 37e8bf5a1e0defc331030fd511bf9cac2765d01dfbf23e7233f37506e85b8ad07edcde9ba6dae7a2c95700c78d28c7dd248153607381852da96273cb159c4934
2019-03-14 18:58:43 +01:00
Patrick Strateman ef0019e054 Generate log entry when blocks messages are received unexpectedly. 2019-03-13 21:05:15 -04:00
Karl-Johan Alm 6c0a6f73e3
wallet/rpc: add maxfeerate parameter to sendrawtransaction 2019-03-14 08:48:46 +09:00
Karl-Johan Alm 7abd2e697c
wallet/rpc: add maxfeerate parameter to testmempoolaccept 2019-03-14 08:48:46 +09:00
João Barbosa 15c69b158d wallet: Log and ignore errors in ListWalletDir and IsBerkeleyBtree 2019-03-13 20:41:42 +00:00
MarcoFalke fae5f874d5
rpc: Document that minconf is an ignored dummy value 2019-03-13 14:43:55 -04:00
Wladimir J. van der Laan 8e1704c015
Merge #15559: doc: correct analyzepsbt rpc doc
335931df4a rpc: return a number for estimated_feerate in analyzepsbt (fanquake)
a4d0fd026b doc: correct analysepsbt rpc doc (fanquake)

Pull request description:

  Even though `missing` is optional, all its field are also all optional.

  `estimated_vsize` is optional (calculate alongside `estimated_feerate`).

  Make `estimated_feerate` output numeric.

Tree-SHA512: 5e063bcfbca73d3d08d29c5d1f59bc1791757f69248da4a9c70fe4b2fe82807ec4ed9fca48d439101d66ba924916fa5da9232167d74ea2b967fc04f0a36f190e
2019-03-13 12:18:19 +01:00
Wladimir J. van der Laan c3b1cb958f
Merge #15573: dead code: Remove dead option in HexStr conversion
56f1d28d9b dead code: Remove dead option in HexStr conversion (Lenny Maiorani)

Pull request description:

  Problem:
  - Nothing uses the `fspaces` argument to `HexStr()` besides unit
    tests. This argument results in extra complexity and a small
    performance decrease within the function.

  Solution:
  - Remove unused `fspaces` option.
  - Remove associated unit tests.

Tree-SHA512: 33d00ce354bbc62a77232fa301cdef0a9ed2c5a09e792bc40e9620c2f2f88636e322a38c76b81d10d12a1768dd1b3b2b9cf180f7e33daef9b4f27afed68ccf70
2019-03-12 13:11:26 +01:00
fanquake 335931df4a
rpc: return a number for estimated_feerate in analyzepsbt 2019-03-12 07:17:42 +08:00
fanquake a4d0fd026b
doc: correct analysepsbt rpc doc 2019-03-12 07:17:22 +08:00
Pieter Wuille c9963ae8b1 Fix overflow bug in analyzepsbt fee: CAmount instead of int 2019-03-11 15:17:05 -07:00
MarcoFalke c94852e791
Merge #15564: cli: remove duplicate wallet fields from -getinfo
3f6568d66b cli: remove duplicate wallet fields from -getinfo (fanquake)

Pull request description:

  `walletversion` and `balance` are both included below.

Tree-SHA512: cd9fe9739a2f492c8f7c0407b43a6fa95187f7e5318f05e080bac112f9f4333d2e9b84c505d098f8d66fa79439007d1c0b22e5a87d70bf5ea53ab647ee4c2046
2019-03-11 10:28:42 -04:00
MarcoFalke 887f57eb72
Merge #15566: cli: replace testnet with chain and return network name as per BIP70.
890396cbd5 cli: replace testnet with chain and return network name as per BIP70. (fanquake)

Pull request description:

  Related IRC discussion [here (line 151)](http://www.erisian.com.au/bitcoin-core-dev/log-2019-03-09.html).

Tree-SHA512: 8bdbacc7b8ce8bd2cc7c47aa9d73f2830a7c2e2ec43686430e3fba1a9db0e53a285467f26cde6dcc3bf948b7d6d59b9b7f184ce1a30a8970f39e5396dfc122f0
2019-03-11 10:26:46 -04:00
Lenny Maiorani 56f1d28d9b dead code: Remove dead option in HexStr conversion
Problem:
- Nothing uses the `fspaces` argument to `HexStr()` besides unit
  tests. This argument results in extra complexity and a small
  performance decrease within the function for branch evalulation.

Solution:
- Remove unused `fspaces` option.
2019-03-10 21:45:31 -06:00
fanquake 3f6568d66b
cli: remove duplicate wallet fields from -getinfo 2019-03-09 16:40:46 +08:00
fanquake 890396cbd5
cli: replace testnet with chain and return network name as per BIP70. 2019-03-09 16:35:26 +08:00
Wladimir J. van der Laan ff38148808
Merge #15486: [addrman, net] Ensure tried collisions resolve, and allow feeler connections to existing outbound netgroups
20e6ea259b [addrman] Improve collision logging and address nits (Suhas Daftuar)
f71fdda3bc [addrman] Ensure collisions eventually get resolved (Suhas Daftuar)
4991e3c813 [net] feeler connections can be made to outbound peers in same netgroup (Suhas Daftuar)
4d834018e3 [addrman] Improve tried table collision logging (Suhas Daftuar)

Pull request description:

  The restriction on outbound peers sharing the same network group is not intended to apply to feeler connections, so fix this.

  This fixes an issue where a tried table collision with an entry to a netgroup we already have an outbound connection to could cause feelers to stop working, because the tried collision buffer (`m_tried_collisions`) would never be drained.

  Also, ensure that all entries don't linger in `m_tried_collisions` by evicting an old entry if its collisions is unresolved after 40 minutes.

Tree-SHA512: 553fe2b01b82cd7f0f62f90c6781e373455a45b254e3bec085b5e6b16690aa9f3938e8c50e7136f19dafa250ed4578a26227d944b76daf9ce4ef0c75802389b6
2019-03-09 07:12:17 +01:00
Wladimir J. van der Laan efed9809b4
Merge #15532: Remove sharp edge (uninit member) when using the compiler-generated ctor for BlockFilter
82c3b3f8e0 Remove sharp edge (uninitialized m_filter_type) when using the compiler-generated constructor for BlockFilter (practicalswift)

Pull request description:

  Remove sharp edge (uninitialised member `m_filter_type`) when using the compiler-generated constructor for `BlockFilter`.

  Before (but after added test):

  ```
  $ src/test/test_bitcoin -t blockfilter_tests/blockfilter_basic_test
  Running 1 test case...
  test/blockfilter_tests.cpp(118): error: in "blockfilter_tests/blockfilter_basic_test": check default_ctor_block_filter_1.GetFilterType() == default_ctor_block_filter_2.GetFilterType() has failed [ != ]

  *** 1 failure is detected in the test module "Bitcoin Test Suite"
  ```

  After:

  ```
  $ src/test/test_bitcoin -t blockfilter_tests/blockfilter_basic_test
  Running 1 test case...

  *** No errors detected
  ```

Tree-SHA512: 21d41f036b0bf12adcf1a788d84747353f2023cb85fd8ea6c97222967032e8bf54e7910cadb45dfcecd78e5b5dca86685f78cad0596b6d1a08f910ebf20d90aa
2019-03-08 15:26:28 +01:00
Jonas Schnelli d211edb349
Merge #15464: gui: Drop unused return values in WalletFrame
28c86de3b gui: Drop unused return values in WalletFrame (João Barbosa)

Pull request description:

  This is a small cleanup since the return value of `WalletFrame` methods are not used. This is in line with the usual async slot declaration.

Tree-SHA512: ff0ca098804118bba200a58cd796ff90e853a6430e58125bd178b7bfa9b2b763c13d17b81e8f3ebd94395cac249d80379ba1529680c47682ba6a2ed81492ba33
2019-03-07 21:04:28 +01:00
Wladimir J. van der Laan 3db0cc3947
Merge #15402: Granular invalidateblock and RewindBlockIndex
519b0bc5dc Make last disconnected block BLOCK_FAILED_VALID, even when aborted (Pieter Wuille)
8d220417cd Optimization: don't add txn back to mempool after 10 invalidates (Pieter Wuille)
9ce9c37004 Prevent callback overruns in InvalidateBlock and RewindBlockIndex (Pieter Wuille)
9bb32eb571 Release cs_main during InvalidateBlock iterations (Pieter Wuille)
9b1ff5c742 Call InvalidateBlock without cs_main held (Pieter Wuille)
241b2c74ac Make RewindBlockIndex interruptible (Pieter Wuille)
880ce7d46b Call RewindBlockIndex without cs_main held (Pieter Wuille)
436f7d735f Release cs_main during RewindBlockIndex operation (Pieter Wuille)
1d342875c2 Merge the disconnection and erasing loops in RewindBlockIndex (Pieter Wuille)
32b2696ab4 Move erasure of non-active blocks to a separate loop in RewindBlockIndex (Pieter Wuille)
9d6dcc52c6 Abstract EraseBlockData out of RewindBlockIndex (Pieter Wuille)

Pull request description:

  This PR makes a number of improvements to the InvalidateBlock (`invalidateblock` RPC) and RewindBlockIndex functions, primarily around breaking up their long-term cs_main holding. In addition:
  * They're made safely interruptible (`bitcoind` can be shutdown, and no progress in either will be lost, though if incomplete, `invalidateblock` won't continue after restart and will need to be called again)
  * The validation queue is prevented from overflowing (meaning `invalidateblock` on a very old block will not drive bitcoind OOM) (see #14289).
  * `invalidateblock` won't bother to move transactions back into the mempool after 10 blocks (optimization).

  This is not an optimal solution, as we're relying on the scheduler call sites to make sure the scheduler doesn't overflow. Ideally, the scheduler would guarantee this directly, but that needs a few further changes (moving the signal emissions out of cs_main) to prevent deadlocks.

  I have manually tested the `invalidateblock` changes (including interrupting, and running with -checkblockindex and -checkmempool), but haven't tried the rewinding (which is probably becoming increasingly unnecessary, as very few pre-0.13.1 nodes remain that would care to upgrade).

Tree-SHA512: 692e42758bd3d3efc2eb701984a8cb5db25fbeee32e7575df0183a00d0c2c30fdf72ce64c7625c32ad8c8bdc56313da72a7471658faeb0d39eefe39c4b8b8474
2019-03-07 17:40:58 +01:00
MarcoFalke 726d0668ff
Merge #15530: doc: Move wallet lock annotations to header
faebd2ef40 doc: Move wallet lock annotations to header (MarcoFalke)

Pull request description:

  We put the annotations in a central place (the header) as opposed to spreading them over the cpp files, where they easily get outdated.

Tree-SHA512: 18d8c7329efd3471713de18fe8d63d67c50fcb9fa99bc372294d829aa7668ea33e10d44e9e50121a04d8cc3302d5fd7759224f7935451a4693c4498a555257e6
2019-03-07 11:34:04 -05:00
MarcoFalke 3515612e06
Merge #15473: bench: Benchmark MempoolToJSON
fa38535130 bench: Benchmark MempoolToJSON (MarcoFalke)
fa5dc3534b rpc: Pass mempool into MempoolToJSON (MarcoFalke)

Pull request description:

  This is used in production (e.g. https://jochen-hoenicke.de/queue/#0,24h), so add a benchmark to avoid making it even slower.

  Related:

  * "getrawmempool true RPC call is O(n^2)" #14765

Tree-SHA512: da09d2e54ee261af8671152f97f863cf1acd7a6adc6578e94046b1ec9e647a670c67499760ef765254f65522dfdf773c3c8729006fa2d63ccb6d53166bafc425
2019-03-06 16:58:37 -05:00
Russell Yanofsky d358466de1 Remove remaining wallet accesses to node globals 2019-03-06 16:47:57 -05:00
MarcoFalke df36ddf9ce
Merge #15504: fuzz: Link BasicTestingSetup (shared with unit tests)
faa9b88199 fuzz: Link BasicTestingSetup (shared with unit tests) (MarcoFalke)
fa85468cd2 test: Move main_tests to validation_tests (MarcoFalke)
fa02b22245 test: Remove useless test_bitcoin_main.cpp (MarcoFalke)
fab2daa026 test: Add missing LIBBITCOIN_ZMQ to test_test_bitcoin_LDADD (MarcoFalke)

Pull request description:

  Link against BasicTestingSetup in the fuzz tests, so we can fuzz against validation.

  Also include a commit to remove test_bitcoin_main.cpp. That file may or may not overwrite globals in the link stage depending on the link order. This is confusing and useless anyway: The unit tests should never `std::exit` in the middle of the run (especially with success as exit code), since it will skip all test modules afterward.

  Also include a commit to remove some unused forward declarations and move the main_tests to validation_tests, since main was long ago split into net_processing and validation.

Tree-SHA512: bdd34c87505450ec106d632f6664aadcbdac7c198172a77da55fab75b274f869ae1a8d06573ba2aff4cb186be9c7a34b7697894ab6f9c82b392f769c9135f36c
2019-03-06 15:16:23 -05:00
Russell Yanofsky b1b2b23892 Remove use of CCoinsViewMemPool::GetCoin in wallet code
This commit does not change behavior.
2019-03-05 10:20:00 -04:00
Russell Yanofsky 4e4d9e9f85 Remove use of CRPCTable::appendCommand in wallet code
This commit does not change behavior.
2019-03-05 10:20:00 -04:00
Russell Yanofsky 91868e6288 Remove use CValidationInterface in wallet code
This commit does not change behavior.
2019-03-05 10:20:00 -04:00
practicalswift c7a7250302 Document assumptions about C++ compiler 2019-03-05 11:19:32 +01:00
practicalswift 82c3b3f8e0 Remove sharp edge (uninitialized m_filter_type) when using the compiler-generated constructor for BlockFilter 2019-03-05 09:08:04 +01:00
MarcoFalke faebd2ef40
doc: Move wallet lock annotations to header 2019-03-04 15:59:23 -05:00
Russell Yanofsky 4d4e4c6448 Suggested interfaces::Chain cleanups from #15288
Mostly documentation improvements requested in the last review of #15288 before
it was merged
(https://github.com/bitcoin/bitcoin/pull/15288#pullrequestreview-210241864)
2019-03-04 15:57:58 -05:00
MarcoFalke 45f434f44d
Merge #15288: Remove wallet -> node global function calls
f7efd87c8f Change brace formatting (Russell Yanofsky)
a1df1b48a8 Remove use of IsInitialBlockDownload in wallet code (Russell Yanofsky)
1106a6fde4 Remove use of uiInterface.LoadWallet in wallet code (Russell Yanofsky)
318f41fb2c circular-dependencies: Avoid treating some .h/.cpp files as a unit (Russell Yanofsky)
d02b34c8a8 Remove use of AcceptToMemoryPool in wallet code (Russell Yanofsky)
e2c8ba9f6e Remove uses of InitMessage/Warning/Error in wallet code (Russell Yanofsky)
c5e59a96a8 Remove uses of GetAdjustedTime in wallet code (Russell Yanofsky)
6d6bcc77c0 Remove use of g_connman / PushInventory in wallet code (Russell Yanofsky)
00dfb2a440 Remove uses of g_connman in wallet code (Russell Yanofsky)
cc3836e8f9 Remove uses of fPruneMode in wallet code (Russell Yanofsky)
cc02c796d3 Remove uses of fee globals in wallet code (Russell Yanofsky)
1fb0a4a04e Remove use of CalculateMemPoolAncestors in wallet code (Russell Yanofsky)
cd32160af0 Remove use of GetTransactionAncestry in wallet code (Russell Yanofsky)
291276f7f4 Remove use of GetCountWithDescendants in wallet code (Russell Yanofsky)
bdc6628683 Remove use of IsRBFOptIn in wallet code (Russell Yanofsky)
80f52a2267 Remove uses of CheckFinalTx in wallet code (Russell Yanofsky)

Pull request description:

  This change removes wallet calls to node functions that access global chain and mempool state.

  This is the next step in the larger #10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in #10102.

Tree-SHA512: 40dbaf1f59fb22b32e70b054b30ba5638d638aa3240fa30e0f721d53c721cd6138a7ab4d423a24d7d2fda0b956e68d44c733abc2c9259c3d6c9fd6d4be89aa23
2019-03-04 13:13:36 -05:00
practicalswift c7ea8d3236 Add sizeof(size_t) assumptions 2019-03-04 14:15:58 +01:00
Pieter Wuille 519b0bc5dc Make last disconnected block BLOCK_FAILED_VALID, even when aborted 2019-03-03 13:01:26 -08:00
Wladimir J. van der Laan 2d46f1be0c
Merge #15118: Refactor block file logic
04cca33094 Style cleanup. (Jim Posen)
4c01e4e159 flatfile: Unit tests for FlatFileSeq methods. (Jim Posen)
65a489e93d scripted-diff: Rename CBlockDiskPos to FlatFilePos. (Jim Posen)
d6d8a78f26 Move CDiskBlockPos from chain to flatfile. (Jim Posen)
e0380933e3 validation: Refactor file flush logic into FlatFileSeq. (Jim Posen)
992404b31e validation: Refactor block file pre-allocation into FlatFileSeq. (Jim Posen)
e2d2abb99f validation: Refactor OpenDiskFile into method on FlatFileSeq. (Jim Posen)
9183d6ef65 validation: Extract basic block file logic into FlatFileSeq class. (Jim Posen)
62e7addb63 util: Move CheckDiskSpace to util. (Jim Posen)

Pull request description:

  This cleans up and refactors block file helpers so that they may be used by the block filter indexer. Per [design discussion](https://github.com/bitcoin/bitcoin/pull/14121#issuecomment-451252591) about storing BIP 157 block filters, it has been suggested that they are stored in the same way as block and undo data. This refactor is sufficient to simplify file operations for this use case, though in the future perhaps more pruning-related logic ought to be moved into the new classes.

  The basic abstraction is a `FlatFileSeq` which manages access to a sequence of numbered files into which raw data is written.

Tree-SHA512: b2108756777f2dad8964a1a2ef2764486e708a4a4a8cfac47b5de8bcb0625388964438eb096b10cfd9ea39212c299b5cb32fa943e768db2333cf49ea7def157e
2019-03-02 23:20:38 +01:00
MarcoFalke 789b0bbf2a
Merge #15335: Fix lack of warning of unrecognized section names
1a7ba84e11 Fix lack of warning of unrecognized section names (Akio Nakamura)

Pull request description:

  In #14708, It was introduced that to warn when unrecognized section names are exist in the config file.
  But ```m_config_sections.clear()```  in ```ArgsManager::ReadConfigStream()``` is called every time when reading each configuration file, so it can warn about only last reading file if ```includeconf``` exists.

  This PR fix lack of warning by collecting all section names by moving ```m_config_sections.clear()```  to ```ArgsManager::ReadConfigFiles()``` .
  Also add a test code to confirm this situation.

Tree-SHA512: 26aa0cbe3e4ae2e58cbe73d4492ee5cf465fd4c3e5df2c8ca7e282b627df9e637267af1e3816386b1dc6db2398b31936925ce0e432219fec3a9b3398f01e3e65
2019-03-02 09:59:18 -05:00
MarcoFalke 9e3122de05
Merge #15492: [rpc] remove deprecated generate method
07cae5287c [wallet] remove unused GetScriptForMining (Sjors Provoost)
8bb3e4c487 [rpc] remove deprecated generate method (Sjors Provoost)

Pull request description:

  As announced in v0.18, the wallet generate rpc method is deprecated and will be fully removed in v0.19.

  Clients should transition to using the node rpc method `generatetoaddress`.

Tree-SHA512: 9e5e913b59f3e18440b2b7b356124c7b87ad19f81a1ab6ada06a6c396b84e734895465f569296f1ba8c12abf74863bab5fd77765c9e806c239713aa83a59485f
2019-03-02 09:43:39 -05:00
Suhas Daftuar 20e6ea259b [addrman] Improve collision logging and address nits 2019-03-01 16:15:50 -05:00
Sjors Provoost 9586157c0f
[rpc] deriveaddresses: add range to CRPCConvertParam 2019-03-01 15:34:43 +01:00
Sjors Provoost 07cae5287c
[wallet] remove unused GetScriptForMining 2019-03-01 13:14:08 +01:00
Pieter Wuille ca253f6ebf Make deriveaddresses use stop/[start,stop] notation for ranges 2019-02-28 21:40:09 -08:00
Pieter Wuille 8d220417cd Optimization: don't add txn back to mempool after 10 invalidates 2019-02-28 14:12:26 -08:00
Pieter Wuille 9ce9c37004 Prevent callback overruns in InvalidateBlock and RewindBlockIndex 2019-02-28 14:12:26 -08:00
Pieter Wuille 9bb32eb571 Release cs_main during InvalidateBlock iterations 2019-02-28 14:12:22 -08:00
Pieter Wuille 1675b7ce55 Use stop/[start,stop] notation in importmulti desc range 2019-02-28 13:05:10 -08:00
Pieter Wuille 4566011631 Add support for stop/[start,stop] ranges to scantxoutset 2019-02-28 13:01:44 -08:00
Pieter Wuille 6b9f45e81b Support ranges arguments in RPC help 2019-02-28 13:00:13 -08:00
Pieter Wuille 7aa6a8aefb Add ParseRange function to parse args of the form int/[int,int] 2019-02-28 13:00:09 -08:00
MarcoFalke faa9b88199
fuzz: Link BasicTestingSetup (shared with unit tests) 2019-02-28 15:45:56 -05:00
MarcoFalke fa85468cd2
test: Move main_tests to validation_tests 2019-02-28 15:44:55 -05:00
MarcoFalke fa02b22245
test: Remove useless test_bitcoin_main.cpp 2019-02-28 15:44:02 -05:00
MarcoFalke fab2daa026
test: Add missing LIBBITCOIN_ZMQ to test_test_bitcoin_LDADD 2019-02-28 15:42:37 -05:00
Suhas Daftuar f71fdda3bc [addrman] Ensure collisions eventually get resolved
After 40 minutes, time out a test-before-evict entry and just evict without
testing. Otherwise, if we were unable to test an entry for some reason, we
might break using feelers altogether.
2019-02-27 16:53:44 -05:00
Sjors Provoost 8bb3e4c487
[rpc] remove deprecated generate method 2019-02-27 17:41:01 +01:00
Suhas Daftuar 4991e3c813 [net] feeler connections can be made to outbound peers in same netgroup
Fixes a bug where feelers could be stuck trying to resolve a collision in the
tried table that is to an address in the same netgroup as an existing outbound peer.

Thanks to Muoi Tran for the original bug report and detailed debug logs to track
this down.
2019-02-27 09:30:13 -05:00
Wladimir J. van der Laan a0d4e79b4d
Merge #15477: doc: Remove misleading hint in getrawtransaction
9999879f56 refactor: Use RPCHelpMan::IsValidNumArgs in getrawtransaction (MarcoFalke)
fa9ff8fe21 doc: Remove misleading hint in getrawtransaction (MarcoFalke)

Pull request description:

  For 0.18.0

  I asked this line to be added in #15159, which was wrong because getmempoolentry does not return the raw transaction hex.

Tree-SHA512: 7ac85500c8192314347b7283cd369196bb959c124863642b6c1ce73d5662b1cbe4f42ded9c374dac6657458ab70b01810caf1235dd1d2b404bf376ebf09efa69
2019-02-27 12:25:37 +01:00
Wladimir J. van der Laan a4f9c024c6
Merge #15468: wallet: Use fsbridge::ifstream to fix Windows path issue
6ad79cbd56 wallet: Use fsbridge::ifstream to fix Windows path issue (Chun Kuan Lee)

Pull request description:

  Fix #15460

Tree-SHA512: 1dab04184608543d49c86cbcfb679d63d35cb7bf3bde2e2d9ddf25ec8977de42b7131db5e81a305f3452858079dbcf68f6ad4624c89575d3d7e5b550687fc6ad
2019-02-27 12:05:58 +01:00
Wladimir J. van der Laan 6f43ed4c5a
Merge #15462: gui: Fix async open wallet call order
a720a98301 gui: Fix async open wallet call order (João Barbosa)

Pull request description:

  Fixes #15455. Must call `OpenWalletActivity::open` asynchronously only after all connections are made to the `OpenWalletActivity` instance, otherwise signals can be missed.

Tree-SHA512: 4e5fdbd09d2ca017ed07a1813c2707c09f96275f1498779804e322e0a4dbd7dcff0c2e9cd6ec18463cd427b88b192a8d02373de9edc2b03ba5e4b8484b264417
2019-02-27 12:00:19 +01:00
Suhas Daftuar 4d834018e3 [addrman] Improve tried table collision logging 2019-02-26 14:59:30 -05:00
MarcoFalke d88f7f8764
Merge #15471: rpc/gui: Remove 'Unknown block versions being mined' warning
ef362f2773 rpc/gui: Remove 'Unknown block versions being mined' warning (Wladimir J. van der Laan)

Pull request description:

  Due to miners inserting garbage into the version numbers causing false positives, the current version signalling has become completely useless. This removes the "unknown block versions" warning which has the tendency to scare users unnecessarily (and might get them to "update" to something bad).

  It preserves the warning in the logs. Whether this is desirable can be a point of discussion.

Tree-SHA512: 51407ccd24a571462465d9c7180f0f28307c50b82a03284abe783e181d8ab7e0638dbb710698d883f28de8a609db70763e39be2470d956e67c833da0768e43e9
2019-02-26 09:20:39 -05:00
MarcoFalke 9999879f56
refactor: Use RPCHelpMan::IsValidNumArgs in getrawtransaction 2019-02-25 23:47:36 -05:00
MarcoFalke fa9ff8fe21
doc: Remove misleading hint in getrawtransaction 2019-02-25 23:45:48 -05:00
MarcoFalke fa38535130
bench: Benchmark MempoolToJSON 2019-02-25 10:13:23 -05:00
MarcoFalke fa5dc3534b
rpc: Pass mempool into MempoolToJSON 2019-02-25 10:12:29 -05:00
Wladimir J. van der Laan ef362f2773 rpc/gui: Remove 'Unknown block versions being mined' warning
Due to miners inserting garbage into the version numbers, the current
version signalling has become completely useless. This removes the
"unknown block versions" warning which has the tendency to scare
users unnecessarily (and might get them to "update" to something
bad).

It preserves the warning in the logs. Whether this is desirable can
be a point of discussion.
2019-02-25 15:59:02 +01:00
Wladimir J. van der Laan b4fc5257b7
Merge #15456: Enable PID file creation on WIN
3f5ad622e5 Enable PID file creation on Windows - Add available WIN PID function - Consider WIN32 in each relevant case - Add new preprocessor definitions to suppress warning - Update error message for generic OS (riordant)

Pull request description:

  # Introduction

  As discussed with @laanwj on IRC:

  - PID file creation was never enabled for Windows, as the `pid_t` filetype is not available for it. However, the WIN32 API contains the header [`Processthreadsapi.h`](https://github.com/CodeShark/x86_64-w64-mingw32/blob/master/include/processthreadsapi.h) which in turn contains the function [`GetCurrentProcessId()`](https://docs.microsoft.com/en-gb/windows/desktop/api/processthreadsapi/nf-processthreadsapi-getcurrentprocessid). ~~This function is called at a higher level by [`_getpid()`](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/getpid?view=vs-2017)~~ EDIT: `_getpid()` is not available to the MSVC compiler used in the AppVeyor build. As a result, I have changed the function call to`GetCurrentProcessId()`, which performs the same function and is available to both MinGW & MSVC.
  This allows one to capture the PID in Windows, without any additional includes - the above function is already available.

  - Within this PR, I have added a separate line that calls `GetCurrentProcessId()` in the case of a WIN compilation, and the usual `getpid()` otherwise. All code blocks processing PID file logic that avoid WIN32 have been changed to consider it. I have also updated the preprocessor definitions in `libbitcoin_server.vcxproj.in` to suppress a warning related to `std::strerror` for the MSVC build, that was causing the AppVeyor build to fail (see @fanquake comment below).

  # Rationale
  - Consistency between OS's running Bitcoin
      - Applications which build off of `bitcoind`, such as novel front-end clients, often need access to the PID in order to control the daemon. Instead of designing some alternate way of doing this for one system, it should be consistent between all of them.

  In collaboration with @joernroeder

Tree-SHA512: 22fcbf866e99115d12ed29716e68d200d4c118ae2f7b188b7705dc0cf5f0cd0ce5fb18f772744c6238eecd9e6d0922c615e2f0e12a7fe7c810062a79d97aa6a2
2019-02-25 13:20:01 +01:00
riordant 3f5ad622e5 Enable PID file creation on Windows
- Add available WIN PID function
- Consider WIN32 in each relevant case
- Add new preprocessor definitions to suppress warning
- Update error message for generic OS

Co-authored-by: Jörn Röder <kontakt@joernroeder.de>
2019-02-25 16:00:34 +07:00
Wladimir J. van der Laan 1a8a5ede9f
Merge #15401: rpc: Actually throw help when passed invalid number of params
fa4ce7038d rpc: Actually throw help when passed invalid number of params (MarcoFalke)
fa05626ca7 rpc: Add RPCHelpMan::IsValidNumArgs() (MarcoFalke)

Pull request description:

  Can be tested by

  * running the included test against an old binary (compiled without this patch)
  * calling `setban 1 "add" 3 4 5 6 7 8 9 0` in the gui

Tree-SHA512: aa6a25bbe6f40722913ea292252a62a4012c964eed9f4035335a2e2d13be98eb60f368e8a3251a104a26a62c08b2cb926b06e5ab1418ef1cf4abdd71d87c2919
2019-02-25 09:31:08 +01:00
Pieter Wuille 9b1ff5c742 Call InvalidateBlock without cs_main held 2019-02-24 18:55:21 -08:00
Pieter Wuille 241b2c74ac Make RewindBlockIndex interruptible 2019-02-24 18:55:21 -08:00
Pieter Wuille 880ce7d46b Call RewindBlockIndex without cs_main held 2019-02-24 18:55:21 -08:00
Pieter Wuille 436f7d735f Release cs_main during RewindBlockIndex operation 2019-02-24 18:55:17 -08:00
Pieter Wuille 1d342875c2 Merge the disconnection and erasing loops in RewindBlockIndex 2019-02-24 18:41:13 -08:00
Pieter Wuille 32b2696ab4 Move erasure of non-active blocks to a separate loop in RewindBlockIndex
This lets us simplify the iteration to just walking back in the chain,
rather than looping over all of mapBlockIndex.
2019-02-24 12:45:48 -08:00
Pieter Wuille 9d6dcc52c6 Abstract EraseBlockData out of RewindBlockIndex
Note that the former 'else' branch in RewindBlockIndex is now
dealt with more naturally inside the EraseBlockData call (by
checking whether the parent needs to be re-added as candidate
after deleting a child).
2019-02-24 12:38:23 -08:00
Chun Kuan Lee 6ad79cbd56 wallet: Use fsbridge::ifstream to fix Windows path issue 2019-02-23 23:44:28 +08:00
João Barbosa a720a98301 gui: Fix async open wallet call order 2019-02-23 09:29:59 +00:00
Jim Posen 04cca33094 Style cleanup. 2019-02-22 17:38:45 -08:00
Jim Posen 4c01e4e159 flatfile: Unit tests for FlatFileSeq methods. 2019-02-22 17:38:45 -08:00
Jim Posen 65a489e93d scripted-diff: Rename CBlockDiskPos to FlatFilePos.
-BEGIN VERIFY SCRIPT-
sed -i 's/CDiskBlockPos/FlatFilePos/g' $(git ls-files 'src/*.h' 'src/*.cpp')
-END VERIFY SCRIPT-
2019-02-22 17:38:45 -08:00
Jim Posen d6d8a78f26 Move CDiskBlockPos from chain to flatfile. 2019-02-22 17:38:45 -08:00
Jim Posen e0380933e3 validation: Refactor file flush logic into FlatFileSeq. 2019-02-22 17:38:45 -08:00
Jim Posen 992404b31e validation: Refactor block file pre-allocation into FlatFileSeq. 2019-02-22 17:38:45 -08:00
Jim Posen e2d2abb99f validation: Refactor OpenDiskFile into method on FlatFileSeq. 2019-02-22 17:38:45 -08:00
Jim Posen 9183d6ef65 validation: Extract basic block file logic into FlatFileSeq class. 2019-02-22 17:38:45 -08:00
Jim Posen 62e7addb63 util: Move CheckDiskSpace to util. 2019-02-22 17:38:45 -08:00
Russell Yanofsky f7efd87c8f Change brace formatting
Suggested https://github.com/bitcoin/bitcoin/pull/15288#pullrequestreview-197915100
2019-02-22 14:43:02 -05:00
MarcoFalke f3f9c1de19
Merge #15435: rpc: Add missing #include
39e20fc54f Add missing #include. (Daniel Kraft)

Pull request description:

  bd0dbe8763 introduced a dependency of `rpc/util.h` on `RPCErrorCode`, defined in `rpc/protocol.h`.  The latter file is only included from `rpc/util.cpp`, though.  This commit fixes the missing include, by moving the `#include` of `rpc/protocol.h` to `rpc/util.h`.

Tree-SHA512: 75c03cfadb28a309d6deb36feeb0ee6ce0b38e8a1176919bc611ea720feff8c42ec9ed0ac8ab74ba9c531a3b7ec9ccbed0c8692ebdf5f9fc17867b9750a1d9f6
2019-02-22 14:43:02 -05:00
Russell Yanofsky a1df1b48a8 Remove use of IsInitialBlockDownload in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 1106a6fde4 Remove use of uiInterface.LoadWallet in wallet code
This also changes the uiInterface.LoadWallet signal argument type from
shared_ptr<CWallet> to unique_ptr<interfaces::Wallet> because CWallet is an
internal wallet class that shouldn't be used in non-wallet code (and also can't
be passed across process boundaries).

This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky d02b34c8a8 Remove use of AcceptToMemoryPool in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky e2c8ba9f6e Remove uses of InitMessage/Warning/Error in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky c5e59a96a8 Remove uses of GetAdjustedTime in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 6d6bcc77c0 Remove use of g_connman / PushInventory in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 00dfb2a440 Remove uses of g_connman in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky cc3836e8f9 Remove uses of fPruneMode in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky cc02c796d3 Remove uses of fee globals in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 1fb0a4a04e Remove use of CalculateMemPoolAncestors in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky cd32160af0 Remove use of GetTransactionAncestry in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 291276f7f4 Remove use of GetCountWithDescendants in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky bdc6628683 Remove use of IsRBFOptIn in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
Russell Yanofsky 80f52a2267 Remove uses of CheckFinalTx in wallet code
This commit does not change behavior.
2019-02-22 15:43:02 -04:00
João Barbosa 28c86de3b1 gui: Drop unused return values in WalletFrame 2019-02-22 16:26:09 +00:00
MarcoFalke 169dced9a4
Merge #15408: Remove unused TransactionError constants
fa9b60c842 Remove unused TransactionError constants (MarcoFalke)

Pull request description:

  Fixup to #14978, which introduced a bunch of unused enum values, such as `UNKNOWN_ERROR`, `ERROR_COUNT` and `TRANSACTION_ERR_LAST`. None of those have a meaning in the context of an `enum class`, where the compiler can infer if all cases have been covered in a switch-case.

  Also, move the global `::maxTxFee` back to the rpc caller, so it can be set on a per call basis (in the future).

Tree-SHA512: 7f1e2d795f1c1278ecd54ddab2b92c2a862f3c637b482d1d008208925befa1c9dd4b3c4bb1bfcbc5ca4b66a41004aaf01ea96ea95236f944250b8a6cf99ff173
2019-02-22 11:13:43 -05:00
MarcoFalke 77fcf252f6
Merge #15458: refactor: Drop redundant wallet reference
53b310390c refactor: Drop redundant wallet reference (João Barbosa)

Pull request description:

  Removes the redudant wallet reference from `WalletImpl`.

  ```cpp
  // before:
  std::shared_ptr<CWallet> m_shared_wallet;
  CWallet& m_wallet;

  // after
  std::shared_ptr<CWallet> m_wallet;
  ```

Tree-SHA512: c78c5a75a59df20b1684f746305c5b3505f73adfd84f00fd800da61ca07c6a37a992fedea3da390afd9564dc6b6a022d183a38995124783ad62c0cc7610be92b
2019-02-22 10:44:02 -05:00
Wladimir J. van der Laan a83aedca18
Merge #13676: Explain that mempool memory is added to -dbcache
7cb1a1401d Explain that unused mempool memory is added to -dbcache (Sjors Provoost)

Pull request description:

  Since `-maxmempool` is 450 MB by default it's quite possible for a user to accidentally OOM a low
  memory device if they increase `-dbcache` beyond the default.

  <img width="563" alt="schermafbeelding 2018-09-06 om 17 02 40" src="https://user-images.githubusercontent.com/10217/45166219-c9c4f700-b1f6-11e8-9ee5-14b8b3a9830b.png">

Tree-SHA512: 44c7419d0b06c14aee5d2c02a41e5da488bcb40a5f65ba24554a45707b222f1e4b03d42486dfef9336d917ac2990eef2b1aec287a75b3ef1ccca0e88ac86a0c0
2019-02-21 18:57:21 +01:00
João Barbosa 53b310390c refactor: Drop redundant wallet reference 2019-02-21 16:19:29 +00:00
Wladimir J. van der Laan 3e1ca1348c
Merge #15278: Improve PID file error handling
3782075a5f Move all PID file stuff to init.cpp (Hennadii Stepanov)
561e375c73 Make PID file creating errors fatal (Hennadii Stepanov)
745a2ace18 Improve PID file removing errors logging (Hennadii Stepanov)

Pull request description:

  Digging into #15240 the lack of the proper logging has been discovered.
  Fixed by this PR.

  UPDATE (inspired by @laanwj's [comment](https://github.com/bitcoin/bitcoin/pull/15278#discussion_r252641810)):
  Not being able to create the PID file is fatal now.

  Output of `bitcoind`:

  ```
  $ src/bitcoind -pid=/run/bitcoind/bitcoind.pid
  2019-02-01T23:20:10Z Bitcoin Core version v0.17.99.0-561e375c7 (release build)
  2019-02-01T23:20:10Z Assuming ancestors of block 0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75 have valid signatures.
  2019-02-01T23:20:10Z Setting nMinimumChainWork=00000000000000000000000000000000000000000000007dbe94253893cbd463
  2019-02-01T23:20:10Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
  2019-02-01T23:20:10Z Using RdRand as an additional entropy source
  2019-02-01T23:20:11Z Error: Unable to create the PID file '/run/bitcoind/bitcoind.pid': No such file or directory
  Error: Unable to create the PID file '/run/bitcoind/bitcoind.pid': No such file or directory
  2019-02-01T23:20:11Z Shutdown: In progress...
  2019-02-01T23:20:11Z Shutdown: Unable to remove PID file: File does not exist
  2019-02-01T23:20:11Z Shutdown: done
  ```

  Output of `bitcoin-qt`:
  ![screenshot from 2019-02-02 01-19-05](https://user-images.githubusercontent.com/32963518/52154886-9349b600-2688-11e9-8128-470f16790305.png)

  **Notes for reviewers**
  1. `CreatePidFile()` has been moved from `util/system.cpp` to `init.cpp` for the following reasons:
  - to get the ability to use `InitError()`
  - now `init.cpp` contains code of both creating PID file and removing it

  2. Regarding 0.18 release process: this PR modifies 1 string and introduces 2 new ones.

Tree-SHA512: ac07d0f800e61ec759e427d0afc0ca43d67f232e977662253963afdd0a220d34b871050f58149fc9fabd427bfc8e0d3f6a6032f2a38f30ad366fc0d074b0f2b3
2019-02-21 09:23:10 +01:00
MarcoFalke fa4ce7038d
rpc: Actually throw help when passed invalid number of params 2019-02-20 13:34:16 -05:00
MarcoFalke fa05626ca7
rpc: Add RPCHelpMan::IsValidNumArgs() 2019-02-20 13:32:17 -05:00
Akio Nakamura 1a7ba84e11 Fix lack of warning of unrecognized section names
1. Fix lack of warning by collecting all section names by moving
   m_config_sections.clear() to ArgsManager::ReadConfigFiles().
2. Add info(file name, line number) to warning message.
3. Add a test code to confirm this situation.
3. Do clear() in ReadConfigString().
2019-02-19 10:49:19 +09:00
MeshCollider 904308dca3
Merge #15433: Use a single wallet batch for UpgradeKeyMetadata
0bedcbafd Use a single wallet batch for UpgradeKeyMetadata (Jonas Schnelli)

Pull request description:

  Opening wallets (the first time) after #14021 took on my end around 30 seconds due to the keymetadata migration (tested on regtest).

  Using a single wallet batch reduces the required time for the migration down to <1s on my system for a default 2k keypool wallet.

Tree-SHA512: f68739e452d382f5294186f47511b94884a1a0868688dd3179034a7e091a67f93bc9dd45cdfc9fa6b1fe90362772b719278012f2f56b752b803c87db8597a7b0
2019-02-19 09:39:06 +13:00
Daniel Kraft 39e20fc54f Add missing #include.
bd0dbe8763 introduced a dependency of
rpc/util.h on RPCErrorCode, defined in rpc/protocol.h.  The latter file
is only included from rpc/util.cpp, though.  This commit fixes the
missing include, by moving the #include of rpc/protocol.h to
rpc/util.h.
2019-02-18 12:11:41 +01:00
Wladimir J. van der Laan 29e82e460e
Merge #15250: Use RdSeed when available, and reduce RdRand load
1435fabc19 Use RdSeed when available, and reduce RdRand load (Pieter Wuille)

Pull request description:

  This introduces support for autodetecting and using the RdSeed instruction on x86/x86_64 systems.

  In addition:
  * In SeedFast, only 64 bits of entropy are generated through RdRand (256 was relatively slow).
  * In SeedStartup, 256 bits of entropy are generated, using RdSeed (preferably) or RdRand (otherwise).

Tree-SHA512: fb7d3e22e93e14592f4b07282aa79d7c3cc4e9debdd9978580b8d2562bbad345e289bf3f80de2c50c9b50b8bac2aa9b838f9f272f7f8d43f1efc0913aa8acce3
2019-02-18 10:56:55 +01:00
Jonas Schnelli 0bedcbafdf
Use a single wallet batch for UpgradeKeyMetadata 2019-02-17 19:32:58 -10:00
Gregory Maxwell a083f75ba7 Update assumevalid, minimumchainwork, and getchaintxstats to height 563378.
m_assumed_blockchain_size/m_assumed_chain_state_size were still accurate.
2019-02-17 03:38:08 +00:00
Wladimir J. van der Laan 4064d048d6
Merge #15425: [Doc] add missing newline to listunspent help for witnessScript
d3661a3fd2 [Doc] add missing newline to witnessScript in listunspent help (David A. Harding)

Pull request description:

Tree-SHA512: 85bb9c693bac36da0239eb6a1f42c2173d0170d5ff3d4c2fcd8897cfab233ef8c8ebc1eb5591e3dc89d091fde221d77c872f14a1eec201fee4dc83ba788390c3
2019-02-17 02:46:59 +01:00
David A. Harding a607c9ae4c
[Doc] importmulti: add missing description of keypool option 2019-02-16 16:59:55 -05:00
David A. Harding d3661a3fd2
[Doc] add missing newline to witnessScript in listunspent help 2019-02-16 16:27:28 -05:00
Wladimir J. van der Laan f60d029a2a
Merge #15368: Descriptor checksums
fd637be8d2 Add checksums to descriptors.md (Pieter Wuille)
be62903c41 Make descriptor checksums mandatory in deriveaddresses and importmulti (Pieter Wuille)
b52cb63688 Add getdescriptorinfo to compute checksum (Pieter Wuille)
3b40bff988 Descriptor checksum (Pieter Wuille)

Pull request description:

  This adds support for a descriptor-specific 8-character checksum.

  Descriptors may optionally be suffixed with a `#` plus these 8 checksum characters. Any descriptor that contains a `#` at the end must be followed by a valid checksum. If the `#` is missing entirely, it is valid without checksum.

  All RPCs are updated to report descriptors that include the checksum. On input, they are optional except in `deriveaddress` and `importmulti`, which require descriptors which include a checksum.

  A new RPC is also added to analyse descriptors (`getdescriptorinfo`), which can be used to compute the checksum for a descriptor without.

Tree-SHA512: a8294b09155eb6c67fbc178b5e2d3fbc0e9bec8b6de57a13f8835550d51c2cb32a428b3c9a188ded42b454d594e9305edbd4797906b755de77a8f33c79165f6b
2019-02-16 21:39:32 +01:00
Wladimir J. van der Laan d5b929c813
Merge #13932: Additional utility RPCs for PSBT
540729ef4b Implement analyzepsbt RPC and tests (Andrew Chow)
77542cf2a5 Move PSBT UTXO fetching to a separate method (Andrew Chow)
cb40b3abd4 Figure out what is missing during signing (Andrew Chow)
08f749c914 Implement joinpsbts RPC and tests (Andrew Chow)
7344a7b998 Implement utxoupdatepsbt RPC and tests (Andrew Chow)

Pull request description:

  This PR adds 3 new utility RPCs for interacting with PSBTs.

  `utxoupdatepsbt` updates a PSBT with UTXO information from the node. It only works with witness UTXOs because full transactions (as would be needed for non-witness UTXOs) are not available unless txindex is enabled.

  `joinpsbts` joins the inputs from multiple distinct PSBTs into one PSBT. e.g. if PSBT 1 has inputs 1 and 2, and PSBT 2 has inputs 3 and 4, `joinpsbts` would create a new PSBT with inputs 1, 2, 3, and 4.

  `analyzepsbt` analyzes a PSBT and determines the current state of it and all of its inputs, and the next step that needs to be done.

Tree-SHA512: 3c1fa302201abca76a8901d0c2be7b4ccbce334d989533c215f8b3e50e22f2f018ce6209544b26789f58f5980a253c0655111e1e20d47d5656e0414c64891a5c
2019-02-16 20:45:03 +01:00
MarcoFalke f9d50e83e2
Merge #15410: test: txindex: interrupt threadGroup before calling destructor
fab6b07c16 test: txindex: interrupt threadGroup before calling destructor (MarcoFalke)

Pull request description:

  Fixes the data races with the tread sanitizer such as

  * https://travis-ci.org/MarcoFalke/bitcoin/jobs/492330554
  * https://github.com/bitcoin/bitcoin/pull/15402#discussion_r256676622
  * ...

Tree-SHA512: 40608c70d92a1dd68efc1d41eecc8e2fb7738508e21f91f0ad353adcceed60fa624f15bf72a5b69a9444157b261183abbe9fc4cc5dd8aebc1c49506b239e8e88
2019-02-16 12:58:26 -05:00
Andrew Chow 540729ef4b Implement analyzepsbt RPC and tests 2019-02-16 11:51:02 -05:00
Pieter Wuille be62903c41 Make descriptor checksums mandatory in deriveaddresses and importmulti 2019-02-15 22:36:05 -08:00
Pieter Wuille b52cb63688 Add getdescriptorinfo to compute checksum 2019-02-15 22:36:05 -08:00
Pieter Wuille 3b40bff988 Descriptor checksum 2019-02-15 22:36:05 -08:00
Andrew Chow 77542cf2a5 Move PSBT UTXO fetching to a separate method 2019-02-16 00:04:27 -05:00
Andrew Chow cb40b3abd4 Figure out what is missing during signing
When signing an input, figure out what was requested for but was unable
to be found and store it in a SignatureData.

Return this information in SignPSBTInput.
2019-02-16 00:04:27 -05:00
Andrew Chow 08f749c914 Implement joinpsbts RPC and tests
Adds a joinpsbts RPC which combines multiple distinct PSBTs into
one PSBT.
2019-02-16 00:04:27 -05:00
Andrew Chow 7344a7b998 Implement utxoupdatepsbt RPC and tests 2019-02-16 00:04:27 -05:00
MarcoFalke 743c2f461c
Merge #15399: fuzz: Script validation flags
fab15ff70e fuzz: Script validation flags (MarcoFalke)
fabcfa5f0c fuzz: Move deserialize tests to test/fuzz/deserialize.cpp (MarcoFalke)

Pull request description:

Tree-SHA512: 83c0cfeae0771b7ffe14e6b0eaeda06602b91f5bf4aa2f54fd4f7ef2350299679fd2d9339b02e43309bfddccc01d3aef25ce1a3d2c4f9b54f26e16e1249e05db
2019-02-15 13:14:24 -05:00
Wladimir J. van der Laan 95801902b9
Merge #15391: Add compile time verification of assumptions we're currently making implicitly/tacitly
7cee85807c Add compile time verification of assumptions we're currently making implicitly/tacitly (practicalswift)

Pull request description:

  Add compile time verification of assumptions we're currently making implicitly/tacitly.

  As suggested by @sipa in https://github.com/bitcoin/bitcoin/pull/14239#issuecomment-462508012 and @MarcoFalke in https://github.com/bitcoin/bitcoin/pull/14479#issuecomment-462534878.

Tree-SHA512: e68fe51164dbd3eeb76aa8a7e83dfcd3b4d5a66037c0f1822bbbd189bbe3c280e03b3b10af870880ecc09b612e62fb3d9bcd6cf1e16cb7ba818c257db0712ce4
2019-02-15 16:05:27 +01:00
MarcoFalke eca1273c35
Merge #15383: [rpc] mining: Omit uninitialized currentblockweight, currentblocktx
fa178a6385 [rpc] mining: Omit uninitialized currentblockweight, currentblocktx (MarcoFalke)

Pull request description:

  Previously we'd report "0", which could be mistaken for a valid number. E.g. the number of transactions is 0 or the block weight is 0, whatever that means.

Tree-SHA512: ee94ab203a329e272211b726f4c23edec4b09c650ec363b77fd59ad9264165d73064f78ebb9e11b5c2c543b73c157752410a307655560531c7d5444d203aa0ea
2019-02-15 08:57:50 -05:00
practicalswift 543ef7d626 tests: Add missing cs_main locks required when accessing pcoinsdbview, pcoinsTip or pblocktree 2019-02-15 10:41:52 +01:00
Andrew Chow f4b00b70e8 Import public keys in order
Do public key imports in the order that they are specified in the import
or in the descriptor range.
2019-02-14 18:34:03 -05:00
Andrew Chow 513719c5f8 Add option to importmulti add an imported pubkey to the keypool
Adds a new option to importmulti where the pubkeys specified in the import
object can be added to the keypool. This only works if the wallet has
private keys disabled.
2019-02-14 18:14:42 -05:00
Andrew Chow 9b81fd19ac Fetch keys from keypool when private keys are disabled
When private keys are disabled, still fetch keys from the keypool
if the keypool has keys. Those keys come from importing them and
adding them to the keypool.
2019-02-14 18:14:00 -05:00
Andrew Chow 99cccb900b Add a method to add a pubkey to the keypool
Introduces AddKeypoolPubkey in order to add a pubkey to the keypool
2019-02-14 18:14:00 -05:00