Commit graph

24239 commits

Author SHA1 Message Date
Andrew Chow b713baa75a Implement GetMetadata in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow 8b9603bd0b Change GetMetadata to use unique_ptr<CKeyMetadata> 2020-04-23 13:59:48 -04:00
Andrew Chow 72a9540df9 Implement FillPSBT in DescriptorScriptPubKeyMan
FillPSBT will add our own scripts to the PSBT if those inputs are ours.
If an input also lists pubkeys that we happen to know the private keys
for, we will sign those inputs too.
2020-04-23 13:59:48 -04:00
Andrew Chow 84b4978c02 Implement SignMessage for descriptor wallets 2020-04-23 13:59:48 -04:00
Andrew Chow bde7c9fa38 Implement SignTransaction in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow d50c8ddd41 Implement GetSolvingProvider for DescriptorScriptPubKeyMan
Internally, a GetSigningProvider function is introduced which allows for
some private keys to be optionally included. This can be called with a
script as the argument (i.e. a scriptPubKey from our wallet when we are
signing) or with a pubkey. In order to know what index to expand the
private keys for that pubkey, we need to also cache all of the pubkeys
involved when we expand the descriptor. So SetCache and TopUp are
updated to do this too.
2020-04-23 13:59:48 -04:00
Andrew Chow f1ca5feb4a Implement GetKeypoolOldestTime and only display it if greater than 0 2020-04-23 13:59:48 -04:00
Andrew Chow 586b57a9a6 Implement ReturnDestination in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow f866957979 Implement GetReservedDestination in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow a775f7c7fd Implement Unlock and Encrypt in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow bfdd073486 Implement GetNewDestination for DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow 58c7651821 Implement TopUp in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow e014886a34 Implement SetupGeneration for DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow 46dfb99768 Implement writing descriptorkeys, descriptorckeys, and descriptors to wallet file 2020-04-23 13:59:48 -04:00
Andrew Chow 4cb9b69be0 Implement several simple functions in DescriptorScriptPubKeyMan
Implements a bunch of one liners: UpgradeKeyMetadata, IsFirstRun, HavePrivateKeys,
KeypoolCountExternalKeys, GetKeypoolSize, GetTimeFirstKey, CanGetAddresses,
RewriteDB
2020-04-23 13:59:48 -04:00
Andrew Chow d1ec3e4f19 Add IsSingleType to Descriptors
IsSingleType will return whether the descriptor will give one or multiple scriptPubKeys
2020-04-23 13:59:48 -04:00
Andrew Chow 953feb3d27 Implement loading of keys for DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow 2363e9fcaa Load the descriptor cache from the wallet file 2020-04-23 13:59:48 -04:00
Andrew Chow 46c46aebb7 Implement GetID for DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow ec2f9e1178 Implement IsHDEnabled in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow 741122d4c1 Implement MarkUnusedAddresses in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow 2db7ca765c Implement IsMine for DescriptorScriptPubKeyMan
Adds a set of scriptPubKeys that DescriptorScriptPubKeyMan tracks.
If the given script is in that set, it is considered ISMINE_SPENDABLE
2020-04-23 13:59:48 -04:00
Andrew Chow db7177af8c Add LoadDescriptorScriptPubKeyMan and SetActiveScriptPubKeyMan to CWallet 2020-04-23 13:59:42 -04:00
Andrew Chow 78f8a92910 Implement SetType in DescriptorScriptPubKeyMan 2020-04-23 13:25:50 -04:00
Andrew Chow 834de0300c Store WalletDescriptor in DescriptorScriptPubKeyMan 2020-04-23 13:25:50 -04:00
Andrew Chow d8132669e1 Add a lock cs_desc_man for DescriptorScriptPubKeyMan 2020-04-23 13:25:50 -04:00
Andrew Chow 3194a7f88a Introduce WalletDescriptor class
WalletDescriptor is a Descriptor with other wallet metadata
2020-04-23 13:25:50 -04:00
Andrew Chow 6b13cd3fa8 Create LegacyScriptPubKeyMan when not a descriptor wallet 2020-04-23 13:25:50 -04:00
Andrew Chow aeac157c9d Return nullptr from GetLegacyScriptPubKeyMan if descriptor wallet 2020-04-23 13:25:50 -04:00
Andrew Chow 96accc73f0 Add WALLET_FLAG_DESCRIPTORS 2020-04-23 13:25:50 -04:00
Andrew Chow 6b8119af53 Introduce DescriptorScriptPubKeyMan as a dummy class 2020-04-23 13:25:50 -04:00
Andrew Chow 06620302c7 Introduce SetType function to tell ScriptPubKeyMans the type and internal-ness of it 2020-04-23 13:25:50 -04:00
Andrew Chow eb37275a6f Fix naming of macOS SDK and clarify version 2020-04-23 13:22:16 -04:00
John Newbery e9ea95a30d [net processing] Move all const declarations to top of net_processing.cpp 2020-04-23 12:54:06 -04:00
John Newbery 507b36dd1b [validation] Move all const declarations to top of validation.h 2020-04-23 12:54:06 -04:00
John Newbery 0109622b08 [validation] Move validation-only consts to validation.cpp 2020-04-23 12:54:06 -04:00
John Newbery b8580cacc7 [net processing] Move net processing consts to net_processing.cpp 2020-04-23 12:54:03 -04:00
MarcoFalke 64139803f1
Merge #18690: test: Check object hashes in wait_for_getdata
9f5608c289 test: check for matching object hashes in wait_for_getdata (Danny Lee)

Pull request description:

  Previously, `wait_for_getdata` only looked for the presence of a recent `"getdata"` message.  Additionally checking the object hashes inside the message should make tests involving `wait_for_getdata` more robust.

  `p2p_sendheaders.py` already overrides `wait_for_getdata` do this check; we can use the same approach consistently across all tests that call `wait_for_getdata`.

  This PR is progress towards #18614 , but closing that issue would also involve some additional changes to `wait_for_getheaders`.

ACKs for top commit:
  theStack:
    ACK 9f5608c289 🍻

Tree-SHA512: 8e7f95881c19631db014d4bb2399fea0d14686a32542f6ca3b60809744b0d684eac4e4c107c87143991f3cd0c2d4ab09d0c17486239768a9b40bee25f2e4d54a
2020-04-23 06:37:53 -04:00
Samuel Dobson e890c15e2c
Merge #18671: wallet: Add BlockUntilSyncedToCurrentChain to dumpwallet
fa60afc4fb wallet: Add BlockUntilSyncedToCurrentChain to dumpwallet (MarcoFalke)

Pull request description:

  dumpwallet includes the block hash in the output, so this method depends on the chainstate. According to the developer notes e84a5f0004/doc/developer-notes.md (L1095) it must include a `BlockUntilSyncedToCurrentChain`.

  This is a minor fix and does not need backport, I think.

  It fixes test failures such as https://travis-ci.org/github/bitcoin/bitcoin/jobs/675487097#L2657 , which can only happen in master because the test was not backported.

ACKs for top commit:
  promag:
    Code review ACK fa60afc4fb.
  ryanofsky:
    Code review ACK fa60afc4fb
  meshcollider:
    utACK fa60afc4fb

Tree-SHA512: 8df70b06b226b2cdf880dec9264adb72d66fd81b09b404fd1665a79e5f5236d26122eebf15df00fe71ee292b5c91b2dc23a0a42b2aa50a8d690604b23832723f
2020-04-23 14:12:35 +12:00
Samuel Dobson 4f802e59a0
Merge #17509: gui: save and load PSBT
764bfe4cba [psbt] add file size limit (Sjors Provoost)
1cd8dc2556 [gui] load PSBT (Sjors Provoost)
f6895301f7 [gui] save PSBT to file (Sjors Provoost)
1d05a9d80b Move DEFAULT_MAX_RAW_TX_FEE_RATE to node/transaction.h (Sjors Provoost)
86e22d23bb [util] GetFileSize (Sjors Provoost)
6ab3aad9a5 [gui] send dialog: split on_sendButton_clicked (Sjors Provoost)

Pull request description:

  This adds:
  * a dialog after Create Unsigned, which lets you save a PSBT file in binary format, e.g. to an SD card
  * a "Load PSBT" menu entry lets you pick a PSBT file. We broadcast the transaction if complete

  ## Save flow
  <img width="482" alt="Schermafbeelding 2020-01-04 om 20 39 34" src="https://user-images.githubusercontent.com/10217/71765684-ba60d580-2f32-11ea-8dea-0c4398eb6e15.png">

  <img width="287" alt="Schermafbeelding 2020-01-04 om 20 40 35" src="https://user-images.githubusercontent.com/10217/71765677-a0bf8e00-2f32-11ea-8172-12dfd34a89f3.png">

  <img width="594" alt="Schermafbeelding 2020-01-04 om 20 41 12" src="https://user-images.githubusercontent.com/10217/71765681-aa48f600-2f32-11ea-8e2c-c4f6bf9f5309.png">

  <img width="632" alt="Schermafbeelding 2020-01-04 om 20 41 28" src="https://user-images.githubusercontent.com/10217/71765691-d19fc300-2f32-11ea-97ff-70f5dd59987a.png">

  By default the file name contains the destination address(es) and amount(s).

  We only use the binary format for files, in order to avoid compatibility hell. If we do want to add base64 file format support, we should use a different extension for that (`.psbt64`?).

  ## Load flow

  Select a file:
  <img width="649" alt="Schermafbeelding 2020-01-04 om 21 08 57" src="https://user-images.githubusercontent.com/10217/71766089-2ba28780-2f37-11ea-875d-074794b5707d.png">

  Offer to send if complete:

  <img width="308" alt="Schermafbeelding 2020-01-04 om 21 09 06" src="https://user-images.githubusercontent.com/10217/71766088-2a715a80-2f37-11ea-807d-394c8b840c59.png">

  Tell user if signatures are missing, offer to copy to clipboard:
  <img width="308" alt="Schermafbeelding 2020-01-04 om 21 15 57" src="https://user-images.githubusercontent.com/10217/71766115-702e2300-2f37-11ea-9f62-a6ede499c0fa.png">

  Incomplete for another reason:

  <img width="309" alt="Schermafbeelding 2020-01-04 om 21 07 51" src="https://user-images.githubusercontent.com/10217/71766090-2c3b1e00-2f37-11ea-8a22-6188377b67a1.png">

ACKs for top commit:
  instagibbs:
    re-ACK  764bfe4cba
  achow101:
    ACK 764bfe4cba
  jb55:
    Tested ACK 764bfe4cba
  jonatack:
    ACK 764bfe4c
  promag:
    Code review ACK 764bfe4cba.

Tree-SHA512: d284ed6895f3a271fb8ff879aac388ad217ddc13f72074725608e1c3d6d90650f6dc9e9e254479544dd71fc111516b02c8ff92158153208dc40fb2726b37d063
2020-04-23 13:16:23 +12:00
fanquake 3e38023af7
scripts: add PE .reloc section check to security-check.py 2020-04-23 08:40:24 +08:00
MarcoFalke fa262712ca
test: Check submitblock return values 2020-04-22 16:56:56 -04:00
practicalswift d5a31b7cb4 tests: Add fuzzing harness for functions in primitives/block.h 2020-04-22 19:51:42 +00:00
MarcoFalke 47b94a337e
Merge #18732: test: Remove unused, undocumented and misleading CScript.__add__
faff9e4bb4 test: Remove unused, undocumented and misleading CScript.__add__ (MarcoFalke)

Pull request description:

  See the corresponding pull #18612

ACKs for top commit:
  laanwj:
    ACK faff9e4bb4 provided it passes Travis

Tree-SHA512: 5d9c4d5b6453c70b24a6960d3b42834e9b31f6dbb99ac47a6abfd85f2739d5372563e7188c22aceabeee1c37eb218bf580848356f4a77268d65f178a9419b269
2020-04-22 15:49:22 -04:00
MarcoFalke fb89af26d8
Merge #18733: doc: Add wallet release notes for 0.21.0
facaefadd3 doc: Add wallet release notes for 0.21.0 (MarcoFalke)
faa4243c11 Add release notes skeleton, so that notes can be filled easier (MarcoFalke)

Pull request description:

ACKs for top commit:
  fjahr:
    ACK facaefadd3
  achow101:
    ACK facaefadd3

Tree-SHA512: a17ab86e422ca3d3e53deffa7fecf09cdd9b816588deeded3a15e80a1c268ff1e8b56a0e052a417f1a091872099cd3d2b89993d4773a86516b0bdef880a949a0
2020-04-22 15:45:56 -04:00
Danny Lee 9f5608c289 test: check for matching object hashes in wait_for_getdata 2020-04-22 10:46:08 -07:00
practicalswift bb1ec36fb1 doc: Document how to fuzz Bitcoin Core using honggfuzz 2020-04-22 15:22:36 +00:00
MarcoFalke a7a6f1ff41
Merge #18575: bench: Remove requirement that all benches use same testing setup
fa1fdb02fc bench: Replace ::mempool globabl with test_setup.mempool (MarcoFalke)
fab1170964 bench: Remove requirement that all benches use RegTestingSetup (MarcoFalke)

Pull request description:

  The benches have always set up one global testing setup. This makes it hard to pick no testing setup at all or one with different params.

  Fix this by removing any global state setup from the main `bench.cpp` and leave the setup to each individual bench.

  One reason to have one global testing setup is to set the datadir location to a tempdir to avoid reading or writing in the default datadir location. But #13687 should prevent this already.

Top commit has no ACKs.

Tree-SHA512: 7c98aea7725a20f4b9225221f4279b9e9f7257ed5c14712ad01ea80d87c3b0fed760b40f413892498bbb354a917ee02d4c575cbe8423a403b86755e8ee11f33b
2020-04-22 10:52:40 -04:00
MarcoFalke facaefadd3
doc: Add wallet release notes for 0.21.0 2020-04-22 09:22:49 -04:00
Russell Yanofsky 1e94a2bcbc depends: Add --sysroot option to mac os native compile flags
Catalina SDK clang stopped automatically searching the SDK include paths when
invoked without --sysroot:

https://github.com/bitcoin/bitcoin/pull/16367#issuecomment-594600985
https://github.com/Homebrew/homebrew-core/issues/45061

This hasn't been a problem for current native depends packages because are
passing their own --sysroot values, and hasn't been a problem for current host
packages because they use `darwin_` commands instead of `build_darwin_`
commands.  But the current `build_darwin_CC` and `build_darwin_CXX` commands
are still unnecessarily fragile, and incompatible with new native depends
packages added in https://github.com/bitcoin/bitcoin/pull/18677.

Cory Fields <cory-nospam-@coryfields.com> suggested in
https://github.com/bitcoin/bitcoin/pull/16367#issuecomment-595393546 switching
compiler from SDK clang to native clang (from $PATH) to avoid this problem.
This is easy and makes a certain amount of sense for building native packages,
as opposed to host packages. But fanquake <fanquake@gmail.com> pointed out in
https://github.com/bitcoin/bitcoin/pull/18677#discussion_r409934309 that it
would be inconsistent use switch to non-SDK compilers while still using other
SDK tools like ranlib and install_name_tool. So simplest, minimal fix seems to
be just adding the missing --sysroot option.
2020-04-22 08:18:11 -05:00