Commit graph

1322 commits

Author SHA1 Message Date
Andrew Poelstra
de97906fad Merge 91af7ef831 into merged_master (Bitcoin PR #19289) 2020-11-28 14:31:34 +00:00
Andrew Poelstra
ddd9b819bb Merge a2a250c7d0 into merged_master (Bitcoin PR #19743) 2020-11-28 00:53:18 +00:00
Andrew Poelstra
f197c02e18 Merge c831e105c5 into merged_master (Bitcoin PR #14582) 2020-11-27 23:36:05 +00:00
Andrew Poelstra
229e81e10c Merge f269165edc into merged_master (Bitcoin PR #17458) 2020-11-27 20:32:05 +00:00
Andrew Poelstra
f3a6693ff5 Merge c0b1706964 into merged_master (Bitcoin PR #19568)
Reduction in duplicated code -and- in Elements/Bitcoin diff :)
2020-11-27 18:54:38 +00:00
Andrew Poelstra
7297f932a0 Merge 9d4b3d86b6 into merged_master (Bitcoin PR #19334) 2020-11-26 17:07:31 +00:00
Andrew Poelstra
c2e804e75b Merge 32302e5c88 into merged_master (Bitcoin PR #19490) 2020-11-26 01:09:24 +00:00
Andrew Poelstra
fc95b9bd68 Merge 89899a3448 into merged_master (Bitcoin PR #19046) 2020-11-26 01:09:24 +00:00
Andrew Poelstra
5f6468f6b8 Merge 4fc9224ee7 into merged_master (Bitcoin PR #18850) 2020-11-26 01:09:24 +00:00
Andrew Poelstra
9942d6f945 Merge 171f4a516b into merged_master (Bitcoin PR #19324) 2020-11-26 01:09:19 +00:00
Andrew Poelstra
d664527f5a Merge a24806c25d into merged_master (Bitcoin PR #19215) 2020-11-26 01:09:18 +00:00
Andrew Poelstra
9ac0c98505 Merge 7173a3c73b into merged_master (Bitcoin PR #19396) 2020-11-26 01:09:18 +00:00
Andrew Poelstra
357c4d5d39 Merge 5c3c7cc50c into merged_master (Bitcoin PR #19300) 2020-11-26 01:09:15 +00:00
Andrew Poelstra
4839db857d Merge c27330897d into merged_master (Bitcoin PR #18027) 2020-11-26 01:09:11 +00:00
Andrew Poelstra
8dcff8b5c8 Merge 6bb5f6d8e3 into merged_master (Bitcoin PR #16377)
Note that this is a breaking change in Core's RPC -- if you add pegins
to createfundedpsbt then it won't do coin selection unless you provide
the additional new add_inputs option.
2020-11-26 01:09:10 +00:00
Andrew Poelstra
b99679fa3c Merge dbd7a91fdf into merged_master (Bitcoin PR #19310) 2020-11-26 01:09:08 +00:00
Andrew Poelstra
235e1f0ec5 Merge 3faf3429e9 into merged_master (Bitcoin PR #19299) 2020-11-26 01:09:06 +00:00
Andrew Poelstra
c639197de0 Merge 23b2a68df5 into merged_master (Bitcoin PR #18275) 2020-11-26 01:09:06 +00:00
Andrew Poelstra
0663613ea7 Merge eac65d99dd into merged_master (Bitcoin PR #19261) 2020-11-26 01:09:04 +00:00
Andrew Poelstra
3aaeae55ea Merge f8364df250 into merged_master (Bitcoin PR #19176) 2020-11-26 01:09:02 +00:00
Andrew Poelstra
c8459659ed Merge 3657aee2d2 into merged_master (Bitcoin PR #18982) 2020-11-26 01:08:56 +00:00
Andrew Poelstra
d38085da61 Merge 520e435b5e into merged_master (Bitcoin PR #18918) 2020-11-26 01:08:51 +00:00
Andrew Poelstra
5dcf991eba Merge df303ceb65 into merged_master (Bitcoin PR #18787) 2020-11-26 01:08:49 +00:00
Andrew Poelstra
d0b2badc94 Merge ad3a61c5f5 into merged_master (Bitcoin PR #18895) 2020-11-26 01:08:48 +00:00
Andrew Poelstra
b7d3244d47 Merge 88b2652fad into merged_master (Bitcoin PR #18853) 2020-11-26 01:08:39 +00:00
Andrew Poelstra
e5faae4af6 Merge 60091d20f9 into merged_master (Bitcoin PR #9381) 2020-11-26 01:08:38 +00:00
Andrew Poelstra
d4711bdf91 Merge 23c926d859 into merged_master (Bitcoin PR #18699) 2020-11-26 01:08:37 +00:00
Andrew Poelstra
4414990576 Merge 608359b071 into merged_master (Bitcoin PR #16426) 2020-11-26 01:08:35 +00:00
Andrew Poelstra
e5f1b2cdaa Merge 0ef0d33f75 into merged_master (Bitcoin PR #18038) 2020-11-26 01:08:33 +00:00
Andrew Poelstra
1c12ae1719 Merge eef90c14ed into merged_master (Bitcoin PR #16528)
This is the 43-commit descriptor wallet PR. It was remarkably easy to merge, given
its magnitude. With this commit Elements supports importing Bitcoin descriptors
and deriving (Bitcoin) addresses, though of course it does not support blinding
yet. That is a post-rebase project.

The material changes were:

1. Changing constants in the tests (super annoying but nothing surprising)

2. Adding a missing "skip if this coin is not ours" check in src/script/sign.cpp
   which was causing us to erroneously remove existing witnesses from transactions.
   This wasn't a problem before this commit since we would only ask specific
   scriptpubkeymans to sign, and we'd never ask any to sign inputs we didn't
   own. Andy simplified the logic here to always try every scriptpubkeyman,
   which means they have to play a bit more nicely with each other.

Other than that, this was a big diff with many conflicts but literally all of
them were "we both added code" and the resolution was to take both sides.
2020-11-26 01:08:31 +00:00
Andrew Poelstra
569c68a0f2 Merge f8102d9088 into merged_master (Bitcoin PR #18601) 2020-11-26 01:08:25 +00:00
Andrew Poelstra
b7307be8cd Merge b470c75847 into merged_master (Bitcoin PR #15761) 2020-11-26 01:08:25 +00:00
Andrew Poelstra
9192999921 Merge bbb1ba1814 into merged_master (Bitcoin PR #17219)
This modifies the CreateTransaction loop in a way not remotely worth the complexity,
and includes an absurdly fragile test where I had to add a bunch of trace statements
and tweak pretty-much every single hardcoded number. Not to name names, but it was
Sjors. (In fairness, the PR is a pure simplification of the CreateTransaction logic,
and it wasn't hard to merge even. It was just the test that caused my grief.)

Adapting the "use a dummy CTxDestination in the case that we cannot retrieve one from
the wallet" logic to our `mapScriptChange` map was not trivial. On my first attempt I
incorrectly assigned a positive vout index to the dummy script, which caused us to
call `ReturnDestination` later on the (unused) dummy destination. This is harmless now,
but when descriptor wallets are introduced in #16528, they introduce an edge case where
returning a null destination can incorrectly mark the 0th key of a BIP32 range as
unused. This triggered a test failure much later, in #19504, which uses descriptor
wallets in fundrawtransaction. The bug was that we'd import a descriptor, mark the
first key as being used, lock the wallet, call `fundrawtransaction` on a transaction
that did not require change (incorrectly marking the first key as unused but leaving
it in the descriptor ScriptPubKeyMan's cache), then call `fundrawtransaction` again
on a transaction that *did* require change. The wallet would then incorrectly retrieve
the "unused" key from cache and use it for change, rather than correctly failing and
advising the user that it could not produce change with a locked wallet and empty
keypool. This was not a fun bug to track down.

Another interesting observation is that branch-and-bound uses the CT size-overestimate
for change when trying to create changeless outputs, while our normal dust detection
uses Core's unchanged "an output is 133 bytes" logic. So when BnB is used we're willing
to delete a far bigger change output than we are when we don't use BnB.

Lest you think this works in Core, they're also inconsistent because BnB uses a
normal fee estimate for gauging change cost, while non-BnB uses the discardfee rate.

My advice is to hold your nose, pull stuff in from Core as it comes in, and thanks
to Andy's efforts things are getting better. Don't bother reviewing this too closely.
2020-12-03 00:58:01 +00:00
Andrew Poelstra
7acaa0481b Merge c189bfd260 into merged_master (Bitcoin PR #17824) 2020-11-26 01:08:22 +00:00
Andrew Poelstra
23cab4213a Merge 4702cadca9 into merged_master (Bitcoin PR #17954) 2020-11-26 01:08:19 +00:00
Andrew Poelstra
0a87d878fa Merge 63dad67348 into merged_master (Bitcoin PR #18546) 2020-11-26 01:08:12 +00:00
Andrew Poelstra
879cfb6ad8 Merge c5966a87d1 into merged_master (Bitcoin PR #18192) 2020-11-26 01:08:11 +00:00
Andrew Poelstra
44f30e687f Merge 6bdd515ccf into merged_master (Bitcoin PR #16923) 2020-11-26 01:08:08 +00:00
Andrew Poelstra
6fae461783 Merge 9a2b5f22c1 into merged_master (Bitcoin PR #18338) 2020-11-26 01:08:06 +00:00
Andrew Poelstra
55e75466a4 Merge b47d087356 into merged_master (Elements PR #843)
Fixes the change-size estimation bug that I fixed in #17290, though incompletely
(Steven made up a size for the surjection proof which was different from the
size that I made up....this time I actually checked with libsecp to get an upper
bound.) He also found another place we were doing the wrong estimation, which
I had missed on my pass. So between the two of us I think we've done some good.

Also moves some which sets code coin_selection_params.tx_noinputs_size to after
some Elements sanity checks, which I think will have zero observable effect
(or non-observable effect) but it's part of the PR so I'm keeping it. Though
updated since we can now use BnB even with subtract-fee-from-output.
2020-11-26 01:08:05 +00:00
Andrew Poelstra
90c7d5774a Merge ac579ada7e into merged_master (Bitcoin PR #18278) 2020-11-26 01:08:00 +00:00
Andrew Poelstra
cf93edb0be Merge 312d27b11c into merged_master (Bitcoin PR #17477) 2020-11-26 01:07:59 +00:00
Andrew Poelstra
5b9f316537 Merge dcf2ccbfde into merged_master (Bitcoin PR #18115)
I really like this PR, but it wound up being pretty nontrivial to merge.
The crux is that it pulls PSBT signing logic into scriptpubkey manager,
which is where it belongs, but for us this means reasoning about pegins
inside script/sign.cpp.

However, sign.cpp is part of libbitcoin_common, which does not include
anything for reasoning about PoW or RPC (lol) or anything heavy about
that. This means that some pegin validation had to remain split between
the wallet/rpc layer and sign.cpp. I added a new file script/pegins.cpp
which has the (one) method we actually need in sign.cpp.

Aside from that, this diff is very large but is mostly just moving our
code changes to wallet/psbtwallet.* into wallet/wallet.* where those
functions now live. As far as review, it's probably not worthwhile to
spend too much too much time on this since it's going to be change
again in #16528 and others. The test coverage is pretty extensive.
2020-11-26 01:07:51 +00:00
Andrew Poelstra
5bbbba1ce1 Merge 4d80274b99 into merged_master (Bitcoin PR #18241) 2020-11-26 01:07:50 +00:00
Andrew Poelstra
0246b86872 Merge 54a7ef612a into merged_master (Bitcoin PR #17399) 2020-11-26 01:07:48 +00:00
Andrew Poelstra
8e931da20b Merge 225aa5d6d5 into merged_master (Bitcoin PR #18193) 2020-11-26 01:07:45 +00:00
Andrew Poelstra
947e32f011 Merge 051439813e into merged_master (Bitcoin PR #13339) 2020-11-26 01:07:43 +00:00
Andrew Poelstra
3f02ec4810 Merge b30a1f3e39 into merged_master (Bitcoin PR #18052) 2020-11-26 00:29:45 +00:00
Andrew Poelstra
91e195d7cd Merge 2d6e76af24 into merged_master (Bitcoin PR #17261)
Moved GetOnlinePakKey to the scriptpubkey manager; the other blinding
stuff remains in the CWallet. At some point after the rebase we should
consider whether there's a better separation to be had between the PAK
related stuff now that we have wallet boxes.
2020-11-14 17:16:10 +00:00
Andrew Poelstra
04f4f87466 Merge 7fb94c0ed4 into merged_master (Bitcoin PR #17889) 2020-11-14 16:52:08 +00:00