Commit graph

13110 commits

Author SHA1 Message Date
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
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
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
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
MeshCollider 8d0ec74801
Merge #14021: Import key origin data through descriptors in importmulti
cb3511b9d Add release notes for importing key origin info change (Andrew Chow)
4c75a69f3 Test importing descriptors with key origin information (Andrew Chow)
02d6586d7 Import KeyOriginData when importing descriptors (Andrew Chow)
3d235dff5 Implement a function to add KeyOriginInfo to a wallet (Andrew Chow)
eab63bc26 Store key origin info in key metadata (Andrew Chow)
345bff601 Remove hdmasterkeyid (Andrew Chow)
bac8c676a Add a method to CWallet to write just CKeyMetadata (Andrew Chow)
e7652d3f6 Add WriteHDKeypath function and move *HDKeypath to util/bip32.{h,cpp} (Andrew Chow)
c45415f73 Refactor keymetadata writing to a separate method (Andrew Chow)

Pull request description:

  This PR allows for key origin data as defined by the descriptors document to be imported to the wallet when importing a descriptor using `importmulti`. This allows the `walletprocesspsbt` to include the BIP 32 derivation paths for keys that it is watching that are from a different HD wallet.

  In order to make this easier to use, a new field `hdmasterkeyfingerprint` has been added to `getaddressinfo`. Additionally I have removed `hdmasterkeyid` as was planned. I think that this API change is fine since it was going to be removed in 0.18 anyways. `CKeyMetadata` has also been extended to store key origin info to facilitate this.

Tree-SHA512: 9c7794f3c793da57e23c5abbdc3d58779ee9dea3d53168bb86c0643a4ad5a11a446264961e2f772f35eea645048cb60954ed58050002caee4e43cd9f51215097
2019-02-15 12:11:28 +13:00
Andrew Chow 02d6586d7a Import KeyOriginData when importing descriptors 2019-02-14 17:58:25 -05:00
Andrew Chow 3d235dff5d Implement a function to add KeyOriginInfo to a wallet 2019-02-14 17:58:25 -05:00