Commit graph

19711 commits

Author SHA1 Message Date
Sjors Provoost fd46c4c001
Bump minimum Qt version to 5.5.1 2019-02-14 11:12:30 +01:00
MeshCollider 2452c6cc0a
Merge #14978: Factor out PSBT utilities from RPCs for use in GUI code; related refactoring.
102faad81 Factor out combine / finalize / extract PSBT helpers (Glenn Willen)
78b9893d0 Remove op== on PSBTs; check compatibility in Merge (Glenn Willen)
bd0dbe876 Switch away from exceptions in refactored tx code (Glenn Willen)
c6c3d42a7 Move PSBT definitions and code to separate files (Glenn Willen)
81cd95884 Factor BroadcastTransaction out of sendrawtransaction (Glenn Willen)
c734aaa15 Split DecodePSBT into Base64 and Raw versions (Glenn Willen)
162ffefd2 Add pf_invalid arg to std::string DecodeBase{32,64} (Glenn Willen)

Pull request description:

  * Move most PSBT definitions into psbt.h.
  * Move most PSBT RPC utilities into psbt.{h,cpp}.
  * Move wallet-touching PSBT RPC utilities (FillPSBT) into
      wallet/psbtwallet.{h,cpp}.
  * Switch exceptions from JSONRPCError() to new PSBTException class.
  * Split DecodePSBT into DecodeBase64PSBT (old behavior) and DecodeRawPSBT.
  * Add one new version of DecodeBase64 utility in strencodings.h (and
      corresponding DecodeBase32 for completeness).
  * Factor BroadcastTransaction utility function out of sendrawtransaction RPC
      handler in rpc/rawtransaction.cpp

  Note: For those keeping score at home wondering why refactor, this is in anticipation of (and developed in parallel with) a change to actually introduce GUI use of all this stuff, which is already under development and working-ish.

Tree-SHA512: 2197c448e657421f430943025357597e7b06c4c377d5d4b2622b9edea52a7193c48843dd731abb3a88ac4023a9c88d211991e0a9b740c22f2e1cbe72adefe390
2019-02-14 21:49:01 +13:00
MarcoFalke fa7ca8ef58
qa: Add test/fuzz/test_runner.py 2019-02-13 17:12:28 -05:00
Wladimir J. van der Laan 9c93f5d9fc
Merge #15334: wallet: Log absolute paths for the wallets
a4b92e467d Log full paths for wallets (Hennadii Stepanov)

Pull request description:

  Fix #15333

  `debug.log` with this PR:
  ```
  ...
  2019-02-03T19:02:35Z Using wallet directory /home/hebasto/.bitcoin/testnet3/wallets
  2019-02-03T19:02:35Z init message: Verifying wallet(s)...
  2019-02-03T19:02:35Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
  2019-02-03T19:02:35Z Using wallet test_alpha/wallet.dat
  2019-02-03T19:02:35Z BerkeleyEnvironment::Open: LogDir=/home/hebasto/.bitcoin/testnet3/wallets/test_alpha/database ErrorFile=/home/hebasto/.bitcoin/testnet3/wallets/test_alpha/db.log
  2019-02-03T19:02:35Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
  2019-02-03T19:02:35Z Using wallet alpha_wallet/wallet.dat
  2019-02-03T19:02:35Z BerkeleyEnvironment::Open: LogDir=/home/hebasto/.bitcoin/testnet3/wallets/alpha_wallet/database ErrorFile=/home/hebasto/.bitcoin/testnet3/wallets/alpha_wallet/db.log
  2019-02-03T19:02:35Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
  2019-02-03T19:02:35Z Using wallet wallet.dat
  2019-02-03T19:02:35Z BerkeleyEnvironment::Open: LogDir=/home/hebasto/.bitcoin/testnet3/wallets/database ErrorFile=/home/hebasto/.bitcoin/testnet3/wallets/db.log
  2019-02-03T19:02:35Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
  2019-02-03T19:02:35Z Using wallet none/wallet.dat
  2019-02-03T19:02:35Z BerkeleyEnvironment::Open: LogDir=/home/hebasto/.bitcoin/testnet3/wallets/none/database ErrorFile=/home/hebasto/.bitcoin/testnet3/wallets/none/db.log
  2019-02-03T19:02:35Z init message: Loading banlist...
  ...
  ```

Tree-SHA512: 8dd4408d3f6b04f396dd0ae0d248fedc3a0f6d36788556ae1662443f06f2ecce1c2be9456bf8d1b3d25b29c2a0cfb03cb805bde0a40387e68988ab932e17e118
2019-02-13 22:51:44 +01:00
MarcoFalke 9c4a90040d
Merge #15390: [wallet-tool] Close bdb when flushing wallet
318b1f7af1 [wallet] Close bdb when flushing wallet. (John Newbery)

Pull request description:

  bdb would not be closed when closing the wallet in wallet-tool. Fix this by calling wallet->flush with true.

Tree-SHA512: f722e527e4806eca5254221e944f57853d11bf89a9264309fa558a6cc2b23feefb7bb2963e87b4fad9cfb31ac4cffe563688988e0614a481a8ff1d393aceb132
2019-02-13 15:49:13 -05:00
MarcoFalke fab15ff70e
fuzz: Script validation flags 2019-02-13 14:53:57 -05:00
MarcoFalke fabcfa5f0c
fuzz: Move deserialize tests to test/fuzz/deserialize.cpp 2019-02-13 11:46:36 -05:00
Wladimir J. van der Laan cbe7efe9ea
Merge #15389: Remove unnecessary const_cast
5039e4b61b Remove unnecessary const_cast (Julian Fleischer)

Pull request description:

  The const_cast

  ```C++
  CBlock &block = const_cast<CBlock&>(chainparams.GenesisBlock());
  ```

  is not necessary as all the functions invoked form this block receive a `const CBlock&` anyway. Simply add the `const` to `block`:

  ```C++
  const CBlock& block = chainparams.GenesisBlock();
  ```

  Casting away `const`, especially from something as precious as the genesis block, feels really weird to me as a reader of bitcoin-core source code.

Tree-SHA512: 0290b2cabb216a60655ded153ed1f213c051fb216cec6f3f810f8b760e276f8def86eb696c492e89631682531e215f56d7897b59685d3aa787bcd80cc4f86c90
2019-02-13 17:09:32 +01:00
Gregory Sanders 6aaa0abc12 Remove manual byte editing in wallet_tx_clone func test 2019-02-13 09:49:36 -05:00
MeshCollider 6ca836ab3a Add release note for listunspent P2WSH change 2019-02-13 14:35:16 +13:00
MeshCollider 928beae007 Add test for P2SH-P2WSH in signrawtransactionwithkey and listunspent 2019-02-13 14:35:16 +13:00
MeshCollider 314784a60f Make listunspent and signrawtransaction RPCs support witnessScript 2019-02-13 14:26:19 +13:00
MarcoFalke 0d1160e421
Merge #14918: RPCHelpMan: Check default values are given at compile-time
fa0ad4e7ce RPCHelpMan: Check default values are given at compile-time (MarcoFalke)

Pull request description:

  Remove the run time assertions on the default values and ensure that the correct default type and value is provided at compile time.

Tree-SHA512: 80df2f3fab4379b500c773c27da63f22786c58be5963fe99744746320e43627a5d433eedf8b32209158df7805ebdce65ed4d242c829c4fe6e5d13deb4799ed42
2019-02-12 18:43:06 -05:00
Hennadii Stepanov a4b92e467d
Log full paths for wallets 2019-02-13 00:47:45 +02:00
João Barbosa 94086fb59d gui: Add close wallet action 2019-02-12 22:07:45 +00:00
João Barbosa f77ba34313 gui: Add closeWallet to WalletController 2019-02-12 22:07:45 +00:00
João Barbosa f6122abe03 interfaces: Add remove to Wallet 2019-02-12 22:07:45 +00:00
MarcoFalke 029d28a7aa
Merge #15238: [QA] remove some magic mining constants in functional tests
b651ef7e1c submitheader: more directly test missing prev block header (Gregory Sanders)
1e7f741745 remove some magic mining constants in functional tests (Gregory Sanders)

Pull request description:

  The fewer magic numbers the better.

  Also more directly tested a `submitheader` case of bad previous blockhash.

Tree-SHA512: 52b01a6aa199fa909eea4e9e84409a901933e545724e33149cc4132c82168199fd678809b6d94d95c9ff6ad02238a9552363620d13b8beaa5d4b67ade9ef425c
2019-02-12 16:52:06 -05:00
MarcoFalke d73918447f
Merge #15216: Scripts and tools: Replace script name with a special parameter
8c9b8a3668 Replace script name with special parameter (Hennadii Stepanov)

Pull request description:

  This PR improves UX; all others shell scripts ~(excluding travis linters)~ in the bitcoin repo have this feature.

  Before:
  ![screenshot from 2019-01-20 17-45-42](https://user-images.githubusercontent.com/32963518/51442159-b5cfec80-1ce2-11e9-8017-3b0b464ccaf8.png)

  After:
  ![screenshot from 2019-01-20 18-30-27](https://user-images.githubusercontent.com/32963518/51442166-bf595480-1ce2-11e9-9520-481518c3b288.png)

  cc: @jamesob @laanwj

Tree-SHA512: 7924e5658a2efe81fd5591390ca5af1ff0558bd9d5693363b9f8addedb1d6b90aa16f11c9b361c6fdfbd931a959255817473a240c175dee95aefc7d2d4a10a36
2019-02-12 16:39:39 -05:00
Hennadii Stepanov 8c9b8a3668
Replace script name with special parameter 2019-02-12 23:25:54 +02:00
Julian Fleischer 5039e4b61b Remove unnecessary const_cast
Signed-off-by: Julian Fleischer <julian@thirdhash.com>
2019-02-12 22:25:47 +01:00
MarcoFalke ea022d9fd0
Merge #15378: tests: Added missing tests for RPC wallet errors
dc3b2ccb5f tests: Added missing tests for RPC wallet errors (Ben Carman)

Pull request description:

Tree-SHA512: b18dcd4f7547c974c93ae67dcd92a168bdb55951b164cf174cb1e59e0daa463187068aec43108309a75d65721a5c0bcdf10a16a9869620f160121e2287559926
2019-02-12 15:27:15 -05:00
John Newbery 318b1f7af1 [wallet] Close bdb when flushing wallet.
bdb would not be closed when closing the wallet in wallet-tool. Fix this
by calling wallet->flush with true.
2019-02-12 13:27:18 -05:00
Jonas Schnelli 7d3f255316
Merge #15153: gui: Add Open Wallet menu
1951ea434 gui: Show indeterminate progress dialog while opening walllet (João Barbosa)
8847cdaaa gui: Add OpenWalletActivity (João Barbosa)
4c8982a88 interfaces: Avoid interface instance if wallet is null (João Barbosa)
be82dea23 gui: Add thread to run background activity in WalletController (João Barbosa)
6c49a55b4 gui: Add Open Wallet menu (João Barbosa)
32a8c6abf gui: Add openWallet and getWalletsAvailableToOpen to WalletController (João Barbosa)
ab288b4e5 interfaces: Add loadWallet to Node (João Barbosa)
17abc0fd5 wallet: Factor out LoadWallet (João Barbosa)

Pull request description:

  The *Open Wallet* menu has all the available wallets currently not loaded. The list of the available wallets comes from `listWalletDir`.

  In the future the menu can be replaced by a custom dialog.

  <img width="674" alt="screenshot 2019-01-12 at 12 17 02" src="https://user-images.githubusercontent.com/3534524/51073166-ac041480-1664-11e9-8302-be81702bc146.png">

Tree-SHA512: ebfd75eee0c8264863748899843afab67dadb7dff21313c11e3cb5b6108d954978dd1f1ae786bc07580c5a771ea4ab38d18c1643c9b9b3683ed53f0f6c582e38
2019-02-12 08:20:50 -10:00
MarcoFalke fa178a6385
[rpc] mining: Omit uninitialized currentblockweight, currentblocktx 2019-02-12 11:34:57 -05:00
MarcoFalke d8794a78a8
Merge #13787: Test for Windows encoding issue
15b31032a6 appveyor: Remove outdated libraries (Chun Kuan Lee)
ae892adceb tests: accept unicode characters on Windows (Chun Kuan Lee)

Pull request description:

  This PR removes unused Windows compatible path. Encoding issues has been solved.

Tree-SHA512: d24dce035fe3b576eaa002896f815a6691e88618ea371171d7e39883e1d63b3ed4d4631ab3b3a26bd67ae4e8ae13b1ff188942ab7ac6a93d704e0de301368cd0
2019-02-12 11:15:11 -05:00
MarcoFalke 03732f8644
Merge #14543: [QA] minor p2p_sendheaders fix of height in coinbase
1cdb9bb51f minor p2p_sendheaders fix of height in coinbase (Gregory Sanders)

Pull request description:

  > \# Now announce a header that forks the last two blocks

  Doesn't effect any behavior since BIP34 isn't active in regtest for many blocks.

Tree-SHA512: 3f214b956a94250bb640f63b6ff707930e1d4cb8df1bbf0fef4012d89a94bafbde0d7b42bbe7113ec33810169281c22c6e389445921d99decb74aa56e87a0f27
2019-02-12 11:10:02 -05:00
Wladimir J. van der Laan 65435701ef
Merge #15358: util: Add SetupHelpOptions()
a99999cc04 util: Add SetupHelpOptions() (MarcoFalke)

Pull request description:

  Every binary we have sets up the help option in their own way and wording.

  Solve that by having one function take care of it for all of them.

Tree-SHA512: 6e947fa8bc2a46fa6ca9f45777020aa269a5df0dd916ebc863224f9a1e0f79e8e7754a1478567307edd9461e8babd77d26bc2710bbd56e8f8da9020aa85a8c9c
2019-02-12 15:27:39 +01:00
Ben Carman dc3b2ccb5f
tests: Added missing tests for RPC wallet errors 2019-02-11 18:19:22 -06:00
Glenn Willen 102faad81e Factor out combine / finalize / extract PSBT helpers
Refactor the new CombinePSBT, FinalizePSBT, and FinalizeAndExtractPSBT
general-purpose functions out of the combinepsbt and finalizepsbt RPCs,
for use in the GUI code.
2019-02-11 14:08:04 -08:00
Glenn Willen 78b9893d02 Remove op== on PSBTs; check compatibility in Merge
Remove the op== on PartiallySignedTransaction, which only checks that the
CTransactions are equal. Instead, check this directly in Merge, and return
false if the CTransactions are not equal (so the PSBTs cannot be merged.)
2019-02-11 14:08:04 -08:00
Glenn Willen bd0dbe8763 Switch away from exceptions in refactored tx code
After refactoring general-purpose PSBT and transaction code out of RPC code,
for use in the GUI, it's no longer appropriate to throw exceptions. Instead we
now return bools for success, and take an output parameter for an error object.
We still use JSONRPCError() for the error objects, since only RPC callers
actually care about the error codes.
2019-02-11 14:08:04 -08:00
Chun Kuan Lee 15b31032a6 appveyor: Remove outdated libraries 2019-02-12 05:45:53 +08:00
Chun Kuan Lee ae892adceb tests: accept unicode characters on Windows 2019-02-12 05:17:15 +08:00
Glenn Willen c6c3d42a7d Move PSBT definitions and code to separate files
Move non-wallet PSBT code to src/psbt.{h,cpp}, and PSBT wallet code to
src/wallet/psbtwallet.{h,cpp}. This commit contains only code movement (and
adjustments to includes and Makefile.am.)
2019-02-11 12:23:14 -08:00
Glenn Willen 81cd958848 Factor BroadcastTransaction out of sendrawtransaction
Factor out a new BroadcastTransaction function, performing the core work of the
sendrawtransaction rpc, so that it can be used from the GUI code. Move it from
src/rpc/ to src/node/.
2019-02-11 12:23:14 -08:00
Glenn Willen c734aaa15d Split DecodePSBT into Base64 and Raw versions
Split up DecodePSBT, which both decodes base64 and then deserializes a
PartiallySignedTransaction, into two functions: DecodeBase64PSBT, which retains
the old behavior, and DecodeRawPSBT, which only performs the deserialization.

Add a test for base64 decoding failure.
2019-02-11 12:23:14 -08:00
Glenn Willen 162ffefd2f Add pf_invalid arg to std::string DecodeBase{32,64}
Add support for the optional "pf_invalid" out parameter (which allows the caller
to detect decoding failures) to the std::string versions of DecodeBase32 and
DecodeBase64. The char* versions already have this feature.

Also, rename all uses of pfInvalid to pf_invalid to match style guidelines.
2019-02-11 12:23:14 -08:00
Luke Dashjr 84f53154e1 Travis: Add test without BIP70 (but still full wallet + tests) 2019-02-11 15:14:33 +00:00
Luke Dashjr 113f0004be GUI: If BIP70 is disabled, give a proper error when trying to open a payment request file 2019-02-11 15:08:41 +00:00
Luke Dashjr 9975282fa8 GUI: If BIP70 is disabled, attempt to fall back to BIP21 parsing 2019-02-11 15:08:41 +00:00
MarcoFalke 1bc149d05b
Merge #15353: docs: Minor textual improvements in translation_strings_policy.md
a94e470921 A few textual improvements (Martin Erlandsson)

Pull request description:

  Found a few places where the reading flow was interrupted by minor grammar and punctuation issues.

Tree-SHA512: 50640288449eb035f463bce563d259efbe97c14517d92c916e1bc52b7c54961ba2fc6fca1272470153803397f20ae7570bd090c16850ebd0180ebcf6bb2415d1
2019-02-11 10:00:01 -05:00
MarcoFalke fa0ad4e7ce
RPCHelpMan: Check default values are given at compile-time 2019-02-11 08:40:10 -05:00
MarcoFalke ad039aa0d3
Merge #15373: Move ParseConfirmTarget from rpc/mining to rpc/util
50e647210d Move ParseConfirmTarget from rpc/mining to rpc/util (Russell Yanofsky)

Pull request description:

  Util is a better home since it's called both by wallet and mining code.

  Suggested https://github.com/bitcoin/bitcoin/pull/15288#discussion_r254449444

Tree-SHA512: 4320caf2a3f70d2885c421de04f2ec68ff3f6519258c5155fc46e245dc1765fd15c81f260af5096318f24ff9deb88fc3c5ef40eec8b7393f467f5b963d17215b
2019-02-11 08:34:14 -05:00
MarcoFalke ff9e197212
Merge #15380: trivial: correct parameter name in comments
1a0139cbaf trivial: correct parameter name in comments (andrewtoth)

Pull request description:

Tree-SHA512: 029b5ca5406cd7bf704b4d7611dac072cdc46a8659041bf631d77372ed4c16fa9ddf02c754044e310b16ea9bdd0803d051bef6ef6a86815d523826666134c649
2019-02-11 08:20:27 -05:00
MarcoFalke e84e0d4b5e
Merge #15337: rpc: Fix for segfault if combinepsbt called with empty inputs
30d0f7be6e rpc: Fix for segfault if combinepsbt called with empty inputs (benthecarman)

Pull request description:

  Fixes #15300

Tree-SHA512: 25e7b4e6e48d8b0d197f0ab96df308fff33e2110f8929cb48914877fa7f4c4a84f173b1378fdb2dec5d03fe7d6d1aced4b577e55f9fe180d8147d9106ebf543f
2019-02-11 08:08:17 -05:00
andrewtoth 1a0139cbaf trivial: correct parameter name in comments 2019-02-10 17:17:32 -05:00
MeshCollider 6f4e0d1542
Merge #15226: Allow creating blank (empty) wallets (alternative)
7687f7873 [wallet] Support creating a blank wallet (Andrew Chow)

Pull request description:

  Alternative (kind of) to #14938

  This PR adds a `blank` parameter to the `createwallet` RPC to create a wallet that has no private keys initially. `sethdseed` can then be used to make a clean wallet with a custom seed. `encryptwallet` can also be used to make a wallet that is born encrypted.

  Instead of changing the version number as done in #14938, a wallet flag is used to indicate that the wallet should be blank. This flag is set at creation, and then unset when the wallet is no longer blank. A wallet becomes non-blank when a HD seed is set or anything is imported. The main change to create a blank wallet is primarily taken from #14938.

  Also with this, the term "blank wallet" is used instead of "empty wallet" to avoid confusion with wallets that have balance which would also be referred to as "empty".

  This is built on top of #15225 in order to fix GUI issues.

Tree-SHA512: 824d685e11ac2259a26b5ece99c67a7bda94a570cd921472c464243ee356b7734595ad35cc439b34357135df041ed9cba951e6edac194935c3a55a1dc4fcbdea
2019-02-11 08:08:33 +13:00
Andrew Chow 7687f7873b [wallet] Support creating a blank wallet
A blank wallet is a wallet that has no keys, script or watch only things.
A new wallet flag indicating that it is blank will be set when the wallet
is blank. Once it is no longer blank (a seed has been generated, keys or
scripts imported, etc), the flag will be unset.
2019-02-10 12:24:53 -05:00
Russell Yanofsky 50e647210d Move ParseConfirmTarget from rpc/mining to rpc/util
Util is a better home since it's called both by wallet and mining code.

Suggested https://github.com/bitcoin/bitcoin/pull/15288#discussion_r254449444
2019-02-08 15:29:45 -05:00