Commit graph

994 commits

Author SHA1 Message Date
Andrew Poelstra
d4711bdf91 Merge 23c926d859 into merged_master (Bitcoin PR #18699) 2020-11-26 01:08:37 +00:00
Andrew Poelstra
c0fda0cc05 Merge ddc0a600b3 into merged_master (Bitcoin PR #18617)
For reasons I do not really grok, this PR changes the timing behavior of the
functional tests to reliably expose a deadlock in the claimpegin RPC that has
existed since the 0.17 rebase.

The mechanism is: in `claimpegin` in src/wallet/rpcwallet.cpp:5873, we call
`AcceptToMemoryPoolWorker`. This requires cs_main to be locked, which it is
not (contrast Core's `testmempoolaccept` RPC, which similarly calls
`AcceptToMemoryPoolWorker` from the RPC thread, and locks cs_main immediately
before).

We do *say* that it is locked, in the `LockAssertion` one the line above, but
this was added in ad3d496d78 during the 0.17
rebase (PR #620), apparently to shut up some linter on OSX, and as near as I
can tell it was never true.

Anyway, `AcceptToMemoryPoolWorker` calls through a couple layers which assume
cs_main is locked, to `AcceptSingleTransaction`, which locks m_pool.cs on line
src/validation.cpp:1101. It then calls `PreChecks`, which on line 784 calls
::ChainActive(), which _actually_ locks cs_main, though only briefly. This
line is the deadlock, because we locked m_pool.cs followed by cs_main...

...meanwhile, in src/net_processing.cpp, we lock cs_main at the top of the
`PeerLogicValidation::SendMessages` loop (src/net_processing.cpp:3628). In the
same loop, in the `feefilter` message processing, we call CTxMemPool::GetMinFee
(src/net_processing.cpp:4137), which locks m_pool.cs. Deadlock.

Anyway, that explains the change to locking behavior that I added to an
otherwise test-only PR.
2020-11-26 01:08:36 +00:00
Andrew Poelstra
4414990576 Merge 608359b071 into merged_master (Bitcoin PR #16426) 2020-11-26 01:08:35 +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
873db53fe3 Merge 3be119c0f6 into merged_master (Bitcoin PR #17579) 2020-11-26 01:08:26 +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
86082b9846 Merge 244daa4821 into merged_master (Bitcoin PR #18607) 2020-11-26 01:08:23 +00:00
Andrew Poelstra
a1367df7d3 Merge c2e53ff064 into merged_master (Bitcoin PR #18467) 2020-11-26 01:08:23 +00:00
Andrew Poelstra
23cab4213a Merge 4702cadca9 into merged_master (Bitcoin PR #17954) 2020-11-26 01:08:19 +00:00
Andrew Poelstra
f72cf74cb7 Merge d5783985eb into merged_master (Bitcoin PR #18502) 2020-11-26 01:08:18 +00:00
Andrew Poelstra
e978e137dd Merge 4eb1eeb02c into merged_master (Bitcoin PR #18504) 2020-11-26 01:08:16 +00:00
Andrew Poelstra
c8909955fa Merge 1b151e3ffc into merged_master (Bitcoin PR #18532) 2020-11-26 01:08:13 +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
09ced2d1f2 Merge 75021e80ee into merged_master (Bitcoin PR #18487) 2020-11-26 01:08:11 +00:00
Andrew Poelstra
04bbdf241a Merge c8971547d9 into merged_master (Bitcoin PR #18499) 2020-11-26 01:08:09 +00:00
Andrew Poelstra
f79b86b3ab Merge 27a82d347e into merged_master (Bitcoin PR #18459) 2020-11-26 01:08:04 +00:00
Andrew Poelstra
bdd87dc5fa Merge 694f4cbd78 into merged_master (Bitcoin PR #18312) 2020-11-26 01:08:02 +00:00
Andrew Poelstra
73c05b4416 Merge f6748b39a6 into merged_master (Elements PR #795) 2020-11-26 01:07:57 +00:00
Andrew Poelstra
80db97d6db Merge 25424cf57e into merged_master (Bitcoin PR #18346) 2020-11-26 01:07:56 +00:00
Andrew Poelstra
c718f86e8f Merge 9ed429c50a into merged_master (Bitcoin PR #18341) 2020-11-26 01:07:56 +00:00
Andrew Poelstra
cf81cec06c Merge 58c72880ff into merged_master (Bitcoin PR #18268) 2020-11-26 01:07:54 +00:00
Andrew Poelstra
f6f78117e9 Merge 0eebe45cf7 into merged_master (Bitcoin PR #18208) 2020-11-26 01:07:54 +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
cf14f230f5 Merge 6ddf435493 into merged_master (Bitcoin PR #18274) 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
c2d905db1d Merge 29298ceeb6 into merged_master (Elements PR #829) 2020-11-26 01:07:48 +00:00
Andrew Poelstra
91b1e1b4ab Merge a71c34742c into merged_master (Bitcoin PR #17809)
This was pretty-much as awful as it looks.
2020-11-26 01:07:48 +00:00
Andrew Poelstra
0246b86872 Merge 54a7ef612a into merged_master (Bitcoin PR #17399) 2020-11-26 01:07:48 +00:00
Andrew Poelstra
a0e2e69cfd Merge 31c0006a6c into merged_master (Bitcoin PR #17264) 2020-11-26 01:07:45 +00:00
Andrew Poelstra
f0e3e31c0d Merge 03f98b15ad into merged_master (Bitcoin PR #17577) 2020-11-26 01:07:45 +00:00
Andrew Poelstra
8e931da20b Merge 225aa5d6d5 into merged_master (Bitcoin PR #18193) 2020-11-26 01:07:45 +00:00
Andrew Poelstra
2dde4faa5c Merge a2fa6ba736 into merged_master (Elements PR #825) 2020-11-26 01:07:45 +00:00
Andrew Poelstra
d6ed4831e0 Merge 56fc2dfcc3 into merged_master (Bitcoin PR #18122) 2020-11-26 01:07:44 +00:00
Andrew Poelstra
e81fccc9a5 Merge 263f53e2d0 into merged_master (Bitcoin PR #18098) 2020-11-26 01:07:43 +00:00
Andrew Poelstra
54b93c4315 Merge 470664f2b7 into merged_master (Bitcoin PR #17746) 2020-11-26 01:07:43 +00:00
Andrew Poelstra
dd22beb3b3 Merge e5ab941489 into merged_master (Elements PR #813) 2020-11-26 01:07:41 +00:00
Andrew Poelstra
bcf509470b Merge 75fb37ce68 into merged_master (Bitcoin PR #18032) 2020-11-26 01:07:40 +00:00
Andrew Poelstra
d20bafff5e Merge 712b7d9b47 into merged_master (Bitcoin PR #17804) 2020-11-26 00:29:45 +00:00
Andrew Poelstra
ca0936ab69 Merge 6d0e532ae0 into merged_master (Bitcoin PR #17585) 2020-11-26 00:29:43 +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
7c53615bb6 Merge af05bd9e1e into merged_master (Bitcoin PR #17891) 2020-11-14 16:52:07 +00:00
Andrew Poelstra
74d2e8da1b Merge 7ea3b85ecf into merged_master (Bitcoin PR #17578) 2020-11-14 16:52:04 +00:00
Andrew Poelstra
c0f55c006c Merge 45f151913e into merged_master (Bitcoin PR #16373) 2020-11-14 16:52:04 +00:00
Andrew Poelstra
4f611f400d Merge bcb4cdcca3 into merged_master (Bitcoin PR #17621) 2020-11-14 16:52:04 +00:00
Andrew Poelstra
fe9767f625 Merge d4b335c60a into merged_master (Bitcoin PR #17617) 2020-11-14 16:51:58 +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
6a5fc1dd58 Merge d8a66626d6 into merged_master (Bitcoin PR #17283) 2020-11-14 16:51:50 +00:00
Andrew Poelstra
569c46ca22 Merge 6d00035cae into merged_master (Elements PR #778) 2020-11-14 16:51:50 +00:00