Commit graph

1109 commits

Author SHA1 Message Date
Andrew Poelstra
40d1f3ffc5 Merge c0224bc962 into merged_master (Bitcoin PR bitcoin/bitcoin#22415) 2021-08-02 16:39:39 +00:00
Andrew Poelstra
ab707223f6 Merge 8ab0c77299 into merged_master (Bitcoin PR bitcoin/bitcoin#22253) 2021-07-31 18:42:01 +00:00
Andrew Poelstra
47164a1e9c Merge ddc6979b8b into merged_master (Bitcoin PR bitcoin/bitcoin#19438) 2021-07-30 16:16:50 +00:00
Andrew Poelstra
cac878cf89 Merge 8071ec179d into merged_master (Bitcoin PR bitcoin/bitcoin#21789) 2021-07-29 12:55:13 +00:00
Andrew Poelstra
9fc1ba6008 Merge 3f56ef7bef into merged_master (Bitcoin PR bitcoin/bitcoin#22146) 2021-07-29 07:14:19 +00:00
Andrew Poelstra
ae37da1ad8 Merge 9c1ec689f3 into merged_master (Bitcoin PR bitcoin/bitcoin#22102) 2021-07-25 13:23:19 +00:00
Andrew Poelstra
34da23bd1a Merge a55904a80c into merged_master (Bitcoin PR bitcoin/bitcoin#21866)
Paying the piper for some lazy use of globals, including ones I added
in 8e770d3f21

Had to add another couple methods to interfaces::Chain
2021-07-29 13:18:11 +00:00
Andrew Poelstra
b413362d11 Merge ef8f2966ac into merged_master (Bitcoin PR bitcoin/bitcoin#22084) 2021-07-24 01:43:31 +00:00
Andrew Poelstra
b3fdb4bed1 Merge 82bc7faec8 into merged_master (Bitcoin PR bitcoin/bitcoin#21946)
Adds a new test which is broken, but which will be fixed in a few PRs.
Disabled it for now.
2021-07-23 13:50:58 +00:00
Andrew Poelstra
5e3a998967 Merge 346e52afd6 into merged_master (Bitcoin PR bitcoin/bitcoin#22121) 2021-07-22 13:24:16 +00:00
Andrew Poelstra
35c1809ce9 Merge a748782a11 into merged_master (Bitcoin PR bitcoin/bitcoin#15545) 2021-07-21 23:54:38 +00:00
Andrew Poelstra
69d1898e00 Merge 0a3b8ea11a into merged_master (Bitcoin PR bitcoin/bitcoin#22106) 2021-07-20 14:13:28 +00:00
Andrew Poelstra
8a669eccfb Merge 7257e50dba into merged_master (Bitcoin PR bitcoin/bitcoin#20833) 2021-07-18 18:11:25 +00:00
MarcoFalke
c0224bc962
Merge bitcoin/bitcoin#22415: Make m_mempool optional in CChainState
ceb7b35a39 refactor: move UpdateTip into CChainState (James O'Beirne)
4abf0779d6 refactor: no mempool arg to GetCoinsCacheSizeState (James O'Beirne)
46e3efd1e4 refactor: move UpdateMempoolForReorg into CChainState (James O'Beirne)
617661703a validation: make CChainState::m_mempool optional (James O'Beirne)

Pull request description:

  Make `CChainState::m_mempool` optional by making it a pointer instead of a reference. This will allow a simplification to assumeutxo semantics (see https://github.com/bitcoin/bitcoin/pull/15606#pullrequestreview-692965905) and help facilitate the `-nomempool` option.

ACKs for top commit:
  jnewbery:
    ACK ceb7b35a39
  naumenkogs:
    ACK ceb7b35a39
  ryanofsky:
    Code review ACK ceb7b35a39 (just minor style and test tweaks since last review)
  lsilva01:
    Code review ACK and tested on Signet ACK https://github.com/bitcoin/bitcoin/pull/22415/commits/ceb7b35a39145717e2d9d356fd382bd1f95d2a5a
  MarcoFalke:
    review ACK ceb7b35a39 😌

Tree-SHA512: cc445ad33439d5918cacf80a6354eea8f3d33bb7719573ed5b970fad1a0dab410bcd70be44c862b8aba1b71263b82d79876688c553e339362653dfb3d8ec81e6
2021-07-15 13:40:03 +02:00
James O'Beirne
ceb7b35a39
refactor: move UpdateTip into CChainState
Makes sense and saves on arguments.

Co-authored-by: John Newbery <john@johnnewbery.com>
2021-07-13 11:16:37 -04:00
James O'Beirne
4abf0779d6
refactor: no mempool arg to GetCoinsCacheSizeState
Unnecessary argument since we can make use of this->m_mempool

Co-authored-by: John Newbery <john@johnnewbery.com>
2021-07-13 11:16:30 -04:00
James O'Beirne
46e3efd1e4
refactor: move UpdateMempoolForReorg into CChainState
Allows fewer arguments and simplification of call sites.

Co-authored-by: John Newbery <john@johnnewbery.com>
2021-07-13 11:12:16 -04:00
James O'Beirne
617661703a
validation: make CChainState::m_mempool optional
Since we now have multiple chainstate objects, only one of them is active at any given
time. An active chainstate has a mempool, but there's no point to others having one.

This change will simplify proposed assumeutxo semantics. See the discussion here:
https://github.com/bitcoin/bitcoin/pull/15606#pullrequestreview-692965905

Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2021-07-13 11:11:35 -04:00
Andrew Poelstra
29a8292858 Merge 599000903e into merged_master (Bitcoin PR bitcoin/bitcoin#21850)
Copied GetMainchainAuthCookieFile logic from GetAuthCookieFile, since
the former no longer compiled.
2021-07-12 15:20:15 +00:00
Andrew Poelstra
1fd44e5dfc Merge ee9befe8b4 into merged_master (Bitcoin PR bitcoin/bitcoin#21584) 2021-07-09 21:14:15 +00:00
Andrew Poelstra
400268064d Merge f8176b768a into merged_master (Bitcoin PR bitcoin/bitcoin#21836) 2021-07-08 08:34:10 +00:00
glozow
fdb48163bf [validation] distinguish same txid different wtxid in mempool
Changes behavior.
2021-07-08 09:31:45 +01:00
Andrew Poelstra
7b25418b9c Merge 128b98fce3 into merged_master (Bitcoin PR bitcoin/bitcoin#21681) 2021-07-07 03:49:35 +00:00
Andrew Poelstra
87c10268ee Merge 3275c6e578 into merged_master (Bitcoin PR bitcoin/bitcoin#21727) 2021-07-06 21:07:44 +00:00
Andrew Poelstra
c4182106af Merge 2b45cf0bcd into merged_master (Bitcoin PR bitcoin/bitcoin#19521)
This is part of the "UTXO Set Statistics" project in Core, which aims
to make things like "checking coin supply" faster. This stuff, and
related things in coinstats.cpp, have always been broken for Elements
in the sense that we consider only explicit outputs and we ignore
assets (so everything just gets added together to get a meaningless
total). It probably wouldn't be too hard to restrict this to only
consider policyAsset, but it's out of scope for a rebase IMO.

Also, I think this situation is fine .. I don't understand the motivation
for this or why Core is merging this when they refuse to merge an address
index .. but I guess we'll see if there are users who care about this data
and who care about it being meaningful on Elements.

Also, apologies for the big diff -- there were some mechanical changes
to deal with CT amounts, but most of the changes related to the difference
in how fees are accounted for. While I'm not thrilled with this PR, its
functional test is really good! So I think what I eventually came up with
is internally consistent.
2021-07-04 19:51:38 +00:00
Andrew Poelstra
6f238f5ad9 Merge c6d6bc8abb into merged_master (Bitcoin PR bitcoin/bitcoin#21523) 2021-07-01 13:43:23 +00:00
Andrew Poelstra
95ab1aa7cb Merge 19a56d1519 into merged_master (Bitcoin PR bitcoin/bitcoin#21009) 2021-07-01 04:00:30 +00:00
Andrew Poelstra
6995de8b1a Merge a839303edc into merged_master (Bitcoin PR #21244) 2021-06-30 21:56:22 +00:00
Andrew Poelstra
56c521bb04 Merge a12962ca89 into merged_master (Bitcoin PR #21585) 2021-06-30 13:31:17 +00:00
Andrew Poelstra
a9ef79acbc Merge 1f14130cb0 into merged_master (Bitcoin PR #21575) 2021-06-30 03:43:01 +00:00
Anthony Towns
c5f36725e8 [refactor] Move ComputeBlockVersion into VersionBitsCache
This also changes ComputeBlockVersion to take the versionbits cache
mutex once, rather than once for each versionbits deployment.
2021-06-30 08:19:12 +10:00
Anthony Towns
4a69b4dbe0 [move-only] Move ComputeBlockVersion from validation to versionbits 2021-06-30 08:19:12 +10:00
Anthony Towns
0cfd6c6a8f [refactor] versionbits: make VersionBitsCache a full class
Moves the VersionBits* functions to be methods of the cache class,
and makes the cache and its lock private to the class.
2021-06-30 08:19:12 +10:00
Anthony Towns
c64b2c6a0f scripted-diff: rename versionbitscache
-BEGIN VERIFY SCRIPT-
sed -i -e 's/versionbitscache/g_versionbitscache/g' $(git grep -l versionbitscache)
-END VERIFY SCRIPT-
2021-06-30 08:19:12 +10:00
Anthony Towns
de55304f6e [refactor] Add versionbits deployments to deploymentstatus.h
Adds support for versionbits deployments to DeploymentEnabled,
DeploymentActiveAfter and DeploymentActiveAt. Also moves versionbitscache
from validation to deploymentstatus.
2021-06-30 08:18:58 +10:00
Andrew Poelstra
5f399720ac Merge 41a8d2b96f into merged_master (Bitcoin PR #21582) 2021-06-29 20:25:59 +00:00
Anthony Towns
2b0d291da8 [refactor] Add deploymentstatus.h
Provides DeploymentEnabled, DeploymentActiveAt, and DeploymentActiveAfter
helpers for checking the status of buried deployments. Can be overloaded
so the same syntax works for non-buried deployments, allowing future
soft forks to be changed from signalled to buried deployments without
having to touch the implementation code.

Replaces IsWitnessEnabled and IsScriptWitnessEnabled.
2021-06-29 17:11:12 +10:00
Anthony Towns
eccd736f3d versionbits: Use dedicated lock instead of cs_main 2021-06-29 17:11:12 +10:00
fanquake
8071ec179d
Merge bitcoin/bitcoin#21789: refactor: Remove ::Params() global from CChainState
fa0d9211ef refactor: Remove chainparams arg from CChainState member functions (MarcoFalke)
fa38947125 refactor: Remove ::Params() global from inside CChainState member functions (MarcoFalke)

Pull request description:

  The `::Params()` global is verbose and confusing. Also it makes tests a bit harder to write because they'd have to mock a global.

  Fix all issues by simply using a member variable that points to the right params.

  (Can be reviewed with `--word-diff-regex=.`)

ACKs for top commit:
  jnewbery:
    ACK fa0d9211ef
  kiminuo:
    utACK fa0d9211
  theStack:
    ACK fa0d9211ef 🍉

Tree-SHA512: 44676b19c9ed471ccb536331d3029bad192d7d50f394fd7b8527ec431452aeec8c4494164b9cf8e16e0123c4463b16be864366c6b599370032c17262625a0356
2021-06-29 11:22:57 +08:00
Andrew Poelstra
020de0b30c Merge 66daf4cb3b into merged_master (Bitcoin PR #21567) 2021-06-29 02:31:41 +00:00
Andrew Poelstra
bc51e4e896 Merge 80a699fda9 into merged_master (Bitcoin PR #21525) 2021-06-29 01:29:25 +00:00
MarcoFalke
3f56ef7bef
Merge bitcoin/bitcoin#22146: Reject invalid coin height and output index when loading assumeutxo
fa9ebedec3 Reject invalid coin height and output index when loading assumeutxo (MarcoFalke)

Pull request description:

  It should be impossible to have a coin at a height higher than the height of the snapshot block, so reject those early to avoid integer wraparounds and hash collisions later on.

  Same for the outpoint index.

  Both issues were found by fuzzing:

  * The height issue by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34793
  * The outpoint issue by my fuzz server: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34793#c2

ACKs for top commit:
  practicalswift:
    cr ACK fa9ebedec3: patch looks correct
  jamesob:
    crACK https://github.com/bitcoin/bitcoin/pull/22146/commits/fa9ebedec3f982bb5bb459ea33d74c94d9b5cec4
  theStack:
    Code review ACK fa9ebedec3
  benthecarman:
    crACK fa9ebedec3

Tree-SHA512: dae7caee4b3862b23ebdf2acb7edec4baf75b0dbf1409b370b1a73aa6b632b317ebfac596dcbaf4edfb1301b513f45465ea75328962460f35e2af0d7e547c9ac
2021-06-28 16:11:44 +02:00
Andrew Poelstra
3a62250bbc Merge 786654aa5e into merged_master (Bitcoin PR #21498) 2021-06-27 21:54:10 +00:00
Andrew Poelstra
651b96887d Merge 63952f73b3 into merged_master (Bitcoin PR #20921) 2021-06-27 20:52:33 +00:00
Andrew Poelstra
26fd4eb181 Merge a9d1b40d53 into merged_master (Bitcoin PR #21415) 2021-06-27 15:02:35 +00:00
Andrew Poelstra
a9e992bab1 Merge 67ec26cacf into merged_master (Bitcoin PR #19259) 2021-06-27 00:59:35 +00:00
Andrew Poelstra
8c54b98b25 Merge e0bc27a14c into merged_master (Bitcoin PR #21404) 2021-06-26 22:39:09 +00:00
Andrew Poelstra
6ab18fa738 Merge 3172615d2c into merged_master (Elements PR ElementsProject/elements#986)
Note: up to this point I still had the old "sort by UNIX timestamp"
behavior on, which may have meant that some PRs were merged out of
order (i.e. multiple merged at once, followed by no-op merges). I
turned this off, and now just use git's default topo-sort (and manually
switch between Elements merges and Bitcoin merges).
2021-06-26 20:57:54 +00:00
Andrew Poelstra
05bd3e6667 Merge 767bb7d5c5 into merged_master (Bitcoin PR #21270) 2021-06-26 19:21:09 +00:00
Andrew Poelstra
1668dac3d6 Merge 702cfc8c53 into merged_master (Bitcoin PR #21055) 2021-06-26 01:21:19 +00:00