Commit graph

498 commits

Author SHA1 Message Date
Andrew Poelstra
009bc2fdfb Merge 99813a9745 into merged_master (Bitcoin PR #17829) 2020-11-14 16:52:02 +00:00
Andrew Poelstra
381cd9cd01 Merge 4ee8a58ce7 into merged_master (Bitcoin PR #17373)
This PR associates OutputType::BECH32 to PAK online keys, where before we
were able to directly access keys from the keypool. In a future refactoring
we should give PAK keys their own output type (and own scriptpubkey manager)
so that the wallet won't accept payments "to the PAK key".

Also changes `ReserveDestination::SetBlindingPubKey` to use a visitor pattern
to apply a blinding pubkey to a destination directly, rather than using the
old hacky method of regenerating the destination by pulling its key (which
is no longer contained in the class) out and giving it to a new constructor.
This was a long-overdue refactoring and the minimal-diff way to get the code
compiling (and it's not bad, maybe 10LOC to add a new visitor class) but
nonetheless I apologize for sticking this into a merge commit.
2020-11-14 16:51:54 +00:00
Andrew Poelstra
c7bf5baf96 Merge 526e802d69 into merged_master (Elements PR #755)
This Elements PR includes components of Core PR #17211, which since the
refactors to use effective value landed, no longer provides the right
error message when a user provides an unowned input from a wallet tx.
See https://github.com/bitcoin/bitcoin/pull/17211#pullrequestreview-528389011

This breaks a functional test which was included in this PR, but which
conveniently has been changed in the current version of the Core PR. I
fixed the behavior (commented, in SelectCoins) rather than updating the
test to the most recent version.
2020-11-14 16:51:53 +00:00
Andrew Poelstra
01f4eb2404 Merge 5ff798c39b into merged_master (Bitcoin PR #17439) 2020-11-09 23:10:13 +00:00
Andrew Poelstra
38f8a01825 Merge 36191a8bb5 into merged_master (Bitcoin PR #12461) 2020-11-09 23:10:13 +00:00
Andrew Poelstra
c82f65f262 Merge 73b26e38d7 into merged_master (Bitcoin PR #17351) 2020-11-09 21:20:50 +00:00
Andrew Poelstra
e910b15aa8 Merge 6a97e8a060 into merged_master (Bitcoin PR #17260) (multiple commits)
This is the start of some nontrivial wallet refactoring by achow. See
https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Wallet-Class-Structure-Changes
for a high-level design.

This PR moves some stuff out of CWallet into a dummy "box" LegacyScriptPubKeyMan
which is (currently) very tightly coulped to CWallet. Because of the coupling there
are currently null-checks that cannot fail, things which assume non-nullness which
will eventually be wrong, and a plethora of currently-equivalent ways to get from
a CWallet to a provider or back.

Our approach is basically to ignore the refactoring; leave the blinding key stuff
in CWallet and have it call into the wallet's provider when we are obtaining the
underlying keys.

Later, probably in a post-rebase PR, we should rethink how we manage blinding keys
to more closely match Core's "all keys go into providers" model.
2020-11-09 21:20:47 +00:00
Andrew Poelstra
fdb06a8ceb Merge 4c1090c882 into merged_master (Bitcoin PR #17279) 2020-11-09 21:20:46 +00:00
Andrew Poelstra
4749945d77 Merge 0ff7cd7d0c into merged_master (Bitcoin PR #16889) 2020-11-09 21:20:42 +00:00
Andrew Poelstra
75e090ffc0 Merge 4daadce36c into merged_master (Bitcoin PR #17162) 2020-11-09 21:20:41 +00:00
Andrew Poelstra
821f5256a5 Merge 46d6930f8c into merged_master (Bitcoin PR #16659) 2020-11-09 21:20:41 +00:00
Andrew Poelstra
d8efec9501 Merge 561a7d3047 into merged_master (Bitcoin PR #16947) 2020-11-09 21:20:38 +00:00
Andrew Poelstra
f3f736f76d Merge befdef8aee into merged_master (Bitcoin PR #16887) 2020-11-09 21:20:37 +00:00
Andrew Poelstra
382e167ab3 Merge 520d140e6e into merged_master (Bitcoin PR #17056)
Recreated addresses for functional tests using `hal elements address create --script`
with the given script from data/rpc_bip67.json, taking the P2SH output
2020-11-09 21:20:35 +00:00
Andrew Poelstra
ccdb481c55 Merge 752debdbdb into merged_master (Bitcoin PR #13266) 2020-11-09 21:20:32 +00:00
Andrew Poelstra
b8a1b9df4d Merge ed03bfc899 into merged_master (Elements PR #726) 2020-11-09 21:20:31 +00:00
Andrew Poelstra
a3139d9501 Merge 280c33f865 into merged_master (Elements PR #723) 2020-11-09 21:20:29 +00:00
Andrew Poelstra
ca7b7f3810 Merge feb162d500 into merged_master (Bitcoin PR #14696) 2020-11-09 21:20:26 +00:00
Andrew Poelstra
9cc26a716a Merge 5b2fe5563b into merged_master (Elements PR #642)
FIXME: we disable standardness checks for the non-PAK node in the PAK tests.
This is because of a bug in Elements which causes non-PAK nodes to reject
pegouts for standardness reasons. Need to fix it after the rebase.
2020-11-09 21:20:21 +00:00
Andrew Poelstra
1b2ba86a9e Merge e8a6d52724 into merged_master (Bitcoin PR #16542) 2020-11-09 21:20:15 +00:00
Andrew Poelstra
d6c98c0663 Merge 7a960ba775 into merged_master (Bitcoin PR #15986) 2020-11-09 21:20:15 +00:00
Andrew Poelstra
441fbf5fec Merge e7df1ecd17 into merged_master (Bitcoin PR #14934) 2020-11-09 21:20:13 +00:00
Andrew Poelstra
a50b652932 Merge 735d6b57e7 into merged_master (Bitcoin PR #16227) 2020-11-09 03:58:21 +00:00
Andrew Poelstra
69dd3ef807 Merge c799976c86 into merged_master (Bitcoin PR #16128) 2020-11-09 03:58:20 +00:00
Andrew Poelstra
16a3be0fc8 Merge 2f717fb5cd into merged_master (Bitcoin PR #15427) 2020-11-09 03:58:18 +00:00
Andrew Poelstra
f68fbc1a56 Merge fd333e15a5 into merged_master (Bitcoin PR #16226) 2020-11-06 15:20:16 +00:00
Andrew Poelstra
4a70305bf8 Merge 44d8172323 into merged_master (Bitcoin PR #13756)
This PR introduces a `avoid_reuse` flag to the `getnewaddress` `sendtoaddress` `getbalance`
RPCs, which we've also added some asset-specific stuff. Since both changes have default
values they aren't individually breaking, but together they are since some existing
asset-related RPC workflows now require the user to jam a `False` in there to make
the new avoid-reuse stuff go away.
2020-11-06 15:20:16 +00:00
Andrew Poelstra
2834091bbf Merge 5d2ccf0ce9 into merged_master (Bitcoin PR #15024)
lol thank Steven for hal
2020-11-06 15:20:13 +00:00
Andrew Poelstra
68d9951825 Merge d0f81a96d9 into merged_master (Bitcoin PR #16129) 2020-11-06 15:20:13 +00:00
Andrew Poelstra
e5f9a5f873 Merge 1ccb0b67f9 into merged_master (Elements PR #610) 2020-11-06 15:20:11 +00:00
Andrew Poelstra
ff1c4012ad Merge de5af41e35 into merged_master (Bitcoin PR #15452) 2020-10-29 14:52:44 +00:00
Andrew Poelstra
cbc704afd2 Merge 2d5419feed into merged_master (Bitcoin PR #15780) 2020-10-28 22:06:46 +00:00
Andrew Poelstra
e1b0ebf5a2 Merge 6ce77a3668 into merged_master (Bitcoin PR #15833) 2020-10-28 17:07:34 +00:00
Andrew Poelstra
8597b2f437 Merge adc55dbac5 into merged_master (Bitcoin PR #15748) 2020-10-28 15:35:17 +00:00
Andrew Poelstra
f58b9ee068 Merge 54798c3a31 into merged_master (Bitcoin PR #15749) 2020-10-28 01:51:02 +00:00
MarcoFalke
aaaaad6ac9
scripted-diff: Bump copyright of files changed in 2019
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2019-12-30 10:42:20 +13:00
MarcoFalke
5ff798c39b
Merge #17439: refactor: Use proper MAX_SCRIPT_ELEMENT_SIZE constants consistently
cb9d830a00 test: Use proper MAX_SCRIPT_ELEMENT_SIZE (Hennadii Stepanov)
402ee706d8 refactor: Use proper MAX_SCRIPT_ELEMENT_SIZE const (Hennadii Stepanov)

Pull request description:

  This PR replaces well-known "magic" numbers with proper `MAX_SCRIPT_ELEMENT_SIZE` constants.

ACKs for top commit:
  practicalswift:
    ACK cb9d830a00 -- diff looks correct and change appears to be complete
  instagibbs:
    utACK https://github.com/bitcoin/bitcoin/pull/17439/commits/cb9d830a00995ee60e71780c04f6193efd02c511

Tree-SHA512: 5fa033275d6df7e35962c38bfdf09a7b5cd7ef2ccdd5e30a39ba47d0c21ac779a5559c23f5ef5bfd4293be0fc639e836a308bbedf0e34717e1eead983b389bbd
2019-11-21 10:11:06 -05:00
Wladimir J. van der Laan
36191a8bb5
Merge #12461: scripted-diff: Rename key size consts to be relative to their class
0580f86bb4 Fixup whitespace (Ben Woosley)
47101bbb27 scripted-diff: Rename CPubKey and CKey::*_KEY_SIZE and COMPRESSED_*_KEY_SIZE (Ben Woosley)

Pull request description:

  ~~And introduce CPubKeySig to host code relative to key sigs.~~

ACKs for top commit:
  meshcollider:
    utACK https://github.com/bitcoin/bitcoin/pull/12461/commits/0580f86bb48004b797d4cb6273e7ffee0b0a0584

Tree-SHA512: 29aa0be54912358b138e391b9db78639786f56580493e590ec9f773c0e1b421740133d05a79be247c7ee57e71c9c9e41b9cb54088cb3c0e3f813f74f0895287b
2019-11-20 12:43:55 +01:00
Hennadii Stepanov
402ee706d8
refactor: Use proper MAX_SCRIPT_ELEMENT_SIZE const 2019-11-11 11:51:49 +02:00
randymcmillan
ac831339cb
doc: Fix some misspellings 2019-11-04 04:22:53 -05:00
MarcoFalke
6a97e8a060
Merge #17260: Split some CWallet functions into new LegacyScriptPubKeyMan
f201ba59ff Refactor: Split up CWallet and LegacyScriptPubKeyMan and classes (Andrew Chow)
6702048f91 MOVEONLY: Move key handling code out of wallet to keyman file (Andrew Chow)
ab053ec6d1 Move wallet enums to walletutil.h (Andrew Chow)

Pull request description:

  Moves key management functions into a new class LegacyScriptPubKeyMan. First two commits are move-only commits which move stuff out of wallet.{h/cpp} and into newly created scriptpubkeyman.{h/cpp}. Third commit changes several things in CWallet to use LegacyScriptPubKeyMan.

  First step in the wallet boxes refactor. Note that LegacyScriptPubKeyMan and ScriptPubKeyMan cannot be used standalone yet and are still very much tied into CWallet with both accessing functions within each other. This PR is to help reduce review burden.

ACKs for top commit:
  Sjors:
    Code review ACK f201ba5.
  promag:
    Code review ACK f201ba59ff.
  ryanofsky:
    Code review ACK f201ba59ff
  MarcoFalke:
    ACK f201ba59ff

Tree-SHA512: bdc0d8595a06233fe003afcf968a38e0e8cc584a6a89c5bcd05309ac29dca852391802d46763ef81a108d146d0f40c79ea5438e87234ed12b4b8360c9aec94c0
2019-10-29 08:19:23 -04:00
Wladimir J. van der Laan
c72906dcc1 refactor: Remove redundant c_str() calls in formatting
Our formatter, tinyformat, *never* needs `c_str()` for strings.
Remove redundant `c_str()` calls for:

- `strprintf`
- `LogPrintf`
- `tfm::format`
2019-10-28 13:31:33 +01:00
Andrew Chow
6702048f91 MOVEONLY: Move key handling code out of wallet to keyman file
Start moving wallet and ismine code to scriptpubkeyman.h, scriptpubkeyman.cpp

The easiest way to review this commit is to run:

   git log -p -n1 --color-moved=dimmed_zebra

And check that everything is a move (other than includes and copyrights comments).

This commit is move-only and doesn't change code or affect behavior.
2019-10-25 19:20:24 -04:00
MarcoFalke
0ff7cd7d0c
Merge #16889: Add some general std::vector utility functions
7d8d3e6a2a Add tests for util/vector.h's Cat and Vector (Pieter Wuille)
e65e61c812 Add some general std::vector utility functions (Pieter Wuille)

Pull request description:

  This is another general improvement extracted from #16800 .

  Two functions are added are:

  * Vector(arg1,arg2,arg3,...) constructs a vector with the specified arguments as elements. The vector's type is derived from the arguments. If some of the arguments are rvalue references, they will be moved into place rather than copied (which can't be achieved using list initialization).
  * Cat(vector1,vector2) returns a concatenation of the two vectors, efficiently moving elements when relevant.

  Vector generalizes (and replaces) the `Singleton` function in src/descriptor.cpp, and `Cat` replaces the function in bech32.cpp

ACKs for top commit:
  laanwj:
    ACK 7d8d3e6a2a
  MarcoFalke:
    ACK 7d8d3e6a2a (enjoyed reading the tests, but did not compile)

Tree-SHA512: 92325f14e90d7e7d9d920421979aec22bb0d730e0291362b4326cccc76f9c2d865bec33a797c5c0201773468c3773cb50ce52c8eee4c1ec1a4d10db5cf2b9d2a
2019-10-18 09:57:00 -04:00
Pieter Wuille
e65e61c812 Add some general std::vector utility functions
Added are:

* Vector(arg1,arg2,arg3,...) constructs a vector with the specified
  arguments as elements. The vector's type is derived from the
  arguments. If some of the arguments are rvalue references, they
  will be moved into place rather than copied (which can't be achieved
  using list initialization).

* Cat(vector1,vector2) returns a concatenation of the two vectors,
  efficiently moving elements when relevant.

Vector generalizes (and replaces) the Singleton function in
src/descriptor.cpp, and Cat replaces the Cat function in bech32.cpp
2019-10-16 08:56:57 -07:00
practicalswift
084e17cebd Remove unused includes 2019-10-15 22:56:43 +00:00
MarcoFalke
561a7d3047
Merge #16947: doc: Doxygen-friendly script/descriptor.h comments
15ac916642 doc: Doxygen-friendly descriptor.h comments (Jon Layton)

Pull request description:

  Closes #16942.

  - Make `Descriptor` overview subtext of `Interface for parsed descriptor objects.`
  - Conform to `@param[in, out] argname: Info` in parameter comments. Present in code: feb162d500/src/net_processing.cpp (L1001)
  - Remove redundant argument type, `in` vs `out` mentions
  - Removed unnecessary backticks around `IsSolvable()`, since Doxygen builds a link to the known function's docs
  - Add backticks to refer to `argname`s

  `descriptor.cpp` has more documentation, but Doxygen's output doesn't include anything inside unnamed namespaces for some reason. Tried to access them via searchbar.

Top commit has no ACKs.

Tree-SHA512: 587cc7596de46358a08b0321a7cf08a08785945715dbdce8945d837e1bee0664d1e11b1e47b7be85c4f35262f7ea173fb1f6202efcacc2023e2c6b0bd44133b3
2019-10-11 16:28:03 -04:00
MarcoFalke
befdef8aee
Merge #16887: Abstract out some of the descriptor Span-parsing helpers
bb36372b8f test: add unit tests for Span-parsing helpers (Sebastian Falbesoner)
5e69aeec3f Add documenting comments to spanparsing.h (Pieter Wuille)
230d43fdbc Abstract out some of the descriptor Span-parsing helpers (Pieter Wuille)

Pull request description:

  As suggested here: https://github.com/bitcoin/bitcoin/pull/16800#issuecomment-531605482.

  This moves the Span parsing functions out of the descriptor module, making them more easily usable for other parsers (in particular, in preparation for miniscript parsing).

ACKs for top commit:
  MarcoFalke:
    ACK bb36372b8f

Tree-SHA512: b5c5c11a9bc3f0a1c2c4cfa22755654ecfb8d4b69da0dc1fb9f04e1556dc0f6ffd87ad153600963279ac465d587d7971b53d240ced802d12693682411ac73deb
2019-10-10 12:33:03 -04:00
Andrew Chow
6f588fd227 Add sortedmulti descriptor and unit tests 2019-10-08 13:56:56 -04:00
Wladimir J. van der Laan
752debdbdb
Merge #13266: refactor: privatize SignatureExtractorChecker [moveonly]
73aaf4ecf8 Make SignatureExtractorChecker private to its own file (Ben Woosley)

Pull request description:

  ~If we add a CTxIn constructor to SignatureData, then constructing the
  SignatureData directly is no more verbose than calling DataFromTransaction,
  and grants the caller additional flexibiliy in how to provide the CTxIn.~

  A simple change to enhance encapsulation.

ACKs for top commit:
  MarcoFalke:
    utACK 73aaf4ecf8
  laanwj:
    ACK 73aaf4ecf8

Tree-SHA512: f7eafbce22b0e9917a8487e88d1f5a1061f2a0959ae1a097cbd9c8ea0d774edfb807da56813cb5fb26f6ca98499a0604a8ff024c198a7c8dc755164de66d972a
2019-10-02 13:25:48 +02:00