Commit graph

1973 commits

Author SHA1 Message Date
Glenn Willen
8cad8cda44 Further fixes from code review 2023-01-04 16:33:35 -08:00
Glenn Willen
7c555578b7 Add a flag for header-trimming; clear P2P network feature bits when enabled. 2022-12-12 09:46:07 -08:00
Glenn Willen
83ad381f47
Merge pull request #1117 from andreabonel/elements-qt_sourcecode
Source code URL correction (in Help - About Elements Core) elements-qt
2022-07-11 09:25:16 -07:00
Andrea Bonel
9554211b8c Source code URL correction in Help-AboutElementsCore elements-qt 2022-05-20 13:47:20 -03:00
Andrew Poelstra
e4c9cc06dc Merge 250c8e59d5 into merged_master (Elements PR ElementsProject/elements#1030) 2021-09-18 03:17:06 +00:00
Glenn Willen
d5042b41c8 Finish removing 'recheckpeginblockinterval'; move MainchainRPCCheck
- Finish removing all references to 'recheckpeginblockinterval', including
  documentation and tests.
- Remove periodic calls to MainchainRPCCheck; use it only at startup (and
  refactor accordingly to simplify logic.)
- Move MainchainRPCCheck from validation.h/cpp (public) to an internal
  helper function of init.cpp.
- Comment out definition of 'revalidation queue' type in txdb, to suppress
  "unused variable" warning. (Leave it visible to avoid future reuse.)
2021-09-13 22:10:33 +00:00
Andrew Poelstra
313f73d5b2 When validation is waiting for parent chain daemon, "stall".
Currently, if -validatepegin is given, and block validation can't proceed
because the parent chain is not synced, we mark the block invalid and put
it in a queue to be "revalidated" later. Unfortunately, marking a block
invalid has downstream consequences, in particular causing descendant blocks
to be marked invalid, which are not currently fixed by the queue.

Instead, we'll use a different strategy: if the mainchain daemon isn't
sufficiently synced to validate a block, we will "stall" connecting that
block to the chain, and have ActivateBestChain simply keep the tip at the
previous block until we're ready.

We can still download and validate (partly) blocks past this point while
we're waiting. They will be connected once the parent chain daemon catches
up.
2021-09-13 22:10:09 +00:00
Andrew Poelstra
40d1f3ffc5 Merge c0224bc962 into merged_master (Bitcoin PR bitcoin/bitcoin#22415) 2021-08-02 16:39:39 +00:00
Andrew Poelstra
78c3a94eb8 Merge d8f1e1327f into merged_master (Bitcoin PR bitcoin/bitcoin#22112) 2021-07-31 21:46:05 +00:00
Andrew Poelstra
a4a4d73a44 Merge 842e2a9c54 into merged_master (Bitcoin PR bitcoin/bitcoin#20234) 2021-07-31 19:55:26 +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
e8b84fa091 Merge d6e0d78c31 into merged_master (Bitcoin PR bitcoin/bitcoin#20966) 2021-07-28 14:05:54 +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
25981aeceb Merge f66eceaecf into merged_master (Bitcoin PR bitcoin/bitcoin#22216) 2021-07-24 20:31:41 +00:00
Andrew Poelstra
b654bb7f5e Merge f63fc53c2a into merged_master (Bitcoin PR bitcoin/bitcoin#21767) 2021-07-20 05:10:30 +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
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
W. J. van der Laan
d8f1e1327f
Merge bitcoin/bitcoin#22112: Force port 0 in I2P
4101ec9d2e doc: mention that we enforce port=0 in I2P (Vasil Dimov)
e0a2b390c1 addrman: reset I2P ports to 0 when loading from disk (Vasil Dimov)
41cda9d075 test: ensure I2P ports are handled as expected (Vasil Dimov)
4f432bd738 net: do not connect to I2P hosts on port!=0 (Vasil Dimov)
1f096f091e net: distinguish default port per network (Vasil Dimov)
aeac3bce3e net: change I2P seeds' ports to 0 (Vasil Dimov)
38f900290c net: change assumed I2P port to 0 (Vasil Dimov)

Pull request description:

  _This is an alternative to https://github.com/bitcoin/bitcoin/pull/21514, inspired by https://github.com/bitcoin/bitcoin/pull/21514#issuecomment-815049933. They are mutually exclusive. Just one of them should be merged._

  Change assumed ports for I2P to 0 (instead of the default 8333) as this is closer to what actually happens underneath with SAM 3.1 (https://github.com/bitcoin/bitcoin/pull/21514#issuecomment-812632520, https://github.com/bitcoin/bitcoin/pull/21514#issuecomment-816564719).

  Don't connect to I2P peers with advertised port != 0 (we don't specify a port to our SAM 3.1 proxy and it always connects to port = 0).

  Note, this change:
  * Keeps I2P addresses with port != 0 in addrman and relays them to others via P2P gossip. There may be non-bitcoin-core-22.0 peers using SAM 3.2 and for them such addresses may be useful.
  * Silently refuses to connect to I2P hosts with port != 0. This is ok for automatically chosen peers from addrman. Not so ok for peers provided via `-addnode` or `-connect` - a user who specifies `foo.b32.i2p:1234` (non zero port) may wonder why "nothing is happening".

  Fixes #21389

ACKs for top commit:
  laanwj:
    Code review ACK 4101ec9d2e
  jonatack:
    re-ACK 4101ec9d2e per `git range-diff efff9c3 0b0ee03 4101ec9`, built with DDEBUG_ADDRMAN, did fairly extensive testing on mainnet both with and without a peers.dat / -dnsseeds=0 to test boostrapping.

Tree-SHA512: 0e3c019e1dc05e54f559275859d3450e0c735596d179e30b66811aad9d5b5fabe3dcc44571e8f7b99f9fe16453eee393d6e153454dd873b9ff14907d4e6354fe
2021-07-13 14:52:41 +02:00
Andrew Poelstra
916944ed6e Merge aeecb1c2eb into merged_master (Bitcoin PR bitcoin/bitcoin#21992) 2021-07-12 22:11:35 +00: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
W. J. van der Laan
842e2a9c54
Merge bitcoin/bitcoin#20234: net: don't bind on 0.0.0.0 if binds are restricted to Tor
2feec3ce31 net: don't bind on 0.0.0.0 if binds are restricted to Tor (Vasil Dimov)

Pull request description:

  The semantic of `-bind` is to restrict the binding only to some address.
  If not specified, then the user does not care and we bind to `0.0.0.0`.
  If specified then we should honor the restriction and bind only to the
  specified address.

  Before this change, if no `-bind` is given then we would bind to
  `0.0.0.0:8333` and to `127.0.0.1:8334` (incoming Tor) which is ok -
  the user does not care to restrict the binding.

  However, if only `-bind=addr:port=onion` is given (without ordinary
  `-bind=`) then we would bind to `addr:port` _and_ to `0.0.0.0:8333` in
  addition.

  Change the above to not do the additional bind: if only
  `-bind=addr:port=onion` is given (without ordinary `-bind=`) then bind
  to `addr:port` (only) and consider incoming connections to that as Tor
  and do not advertise it. I.e. a Tor-only node.

ACKs for top commit:
  laanwj:
    Code review ACK 2feec3ce31
  jonatack:
    utACK 2feec3ce31 per `git diff a004833 2feec3c`
  hebasto:
    ACK 2feec3ce31, tested on Linux Mint 20.1 (x86_64):

Tree-SHA512: a04483af601706da928958b92dc560f9cfcc78ab0bb9d74414636eed1c6f29ed538ce1fb5a17d41ed82c9c9a45ca94899d0966e7ef93da809c9bcdcdb1d1f040
2021-07-12 10:08:22 +02:00
Andrew Poelstra
e56472be53 Merge d2ec37221a into merged_master (Bitcoin PR bitcoin/bitcoin#21796) 2021-07-09 17:38:32 +00:00
Andrew Poelstra
99cc7a5245 Merge 2e30e328a7 into merged_master (Bitcoin PR bitcoin/bitcoin#19064) 2021-07-09 13:03:17 +00:00
Vasil Dimov
38f900290c
net: change assumed I2P port to 0
* When accepting an I2P connection, assume the peer has port 0 instead
  of the default 8333 (for mainnet). It is not being sent to us, so we
  must assume something.
* When deriving our own I2P listen CService use port 0 instead of the
  default 8333 (for mainnet). So that we later advertise it to peers
  with port 0.

In the I2P protocol SAM 3.1 and older (we use 3.1) ports are not used,
so they are irrelevant. However in SAM 3.2 and newer ports are used and
from the point of view of SAM 3.2, a peer using SAM 3.1 seems to have
specified port=0.
2021-07-09 11:19:35 +02:00
Andrew Poelstra
3402d0aa23 Merge 94f83534e4 into merged_master (Bitcoin PR bitcoin/bitcoin#21752) 2021-07-09 03:24:22 +00:00
Andrew Poelstra
400268064d Merge f8176b768a into merged_master (Bitcoin PR bitcoin/bitcoin#21836) 2021-07-08 08:34:10 +00:00
Vasil Dimov
2feec3ce31
net: don't bind on 0.0.0.0 if binds are restricted to Tor
The semantic of `-bind` is to restrict the binding only to some address.
If not specified, then the user does not care and we bind to `0.0.0.0`.
If specified then we should honor the restriction and bind only to the
specified address.

Before this change, if no `-bind` is given then we would bind to
`0.0.0.0:8333` and to `127.0.0.1:8334` (incoming Tor) which is ok -
the user does not care to restrict the binding.

However, if only `-bind=addr:port=onion` is given (without ordinary
`-bind=`) then we would bind to `addr:port` _and_ to `0.0.0.0:8333` in
addition.

Change the above to not do the additional bind: if only
`-bind=addr:port=onion` is given (without ordinary `-bind=`) then bind
to `addr:port` (only) and consider incoming connections to that as Tor
and do not advertise it. I.e. a Tor-only node.
2021-07-07 15:46:38 +02:00
Andrew Poelstra
b20d4cbdb5 Merge b8b6801412 into merged_master (Bitcoin PR bitcoin/bitcoin#21710) 2021-07-07 00:26:09 +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
3c9222f410 Merge 59869704c0 into merged_master (Bitcoin PR bitcoin/bitcoin#21818) 2021-07-05 01:03:56 +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
33d8878160 Merge f8f55522c4 into merged_master (Bitcoin PR bitcoin/bitcoin#21746) 2021-07-01 03:48:03 +00:00
Andrew Poelstra
931655f99d Merge 8f80092d78 into merged_master (Bitcoin PR bitcoin/bitcoin#21563) 2021-07-01 02:07:23 +00:00
Andrew Poelstra
0f00842a22 Merge 66fd3b28e8 into merged_master (Bitcoin PR bitcoin/bitcoin#21732) 2021-07-01 01:54:34 +00:00
Andrew Poelstra
6995de8b1a Merge a839303edc into merged_master (Bitcoin PR #21244) 2021-06-30 21:56:22 +00:00
Andrew Poelstra
a9ef79acbc Merge 1f14130cb0 into merged_master (Bitcoin PR #21575) 2021-06-30 03:43:01 +00:00
Andrew Poelstra
770892540f Merge 6664211be2 into merged_master (Bitcoin PR #21574) 2021-06-29 22:00:51 +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
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
d20af8f9ea Merge 602b038d43 into merged_master (Bitcoin PR #21366) 2021-06-29 00:32:18 +00:00
Andrew Poelstra
f313d8edec Merge 1999baac30 into merged_master (Bitcoin PR #20228) 2021-06-28 22:56:51 +00:00
Andrew Poelstra
2fe92c0077 Merge b1281b5d8f into merged_master (Bitcoin PR #21516) 2021-06-28 13:25:43 +00:00
Andrew Poelstra
07d04a45c3 Merge 01bb3afb51 into merged_master (Bitcoin PR #21447) 2021-06-27 03:13:21 +00:00
Andrew Poelstra
3b7df88c5c Merge af6ee17545 into merged_master (Bitcoin PR #21405) 2021-06-27 02:24:17 +00:00
Andrew Poelstra
8c54b98b25 Merge e0bc27a14c into merged_master (Bitcoin PR #21404) 2021-06-26 22:39:09 +00:00
Andrew Poelstra
7602228cf0 Merge 92cf3a22e3 into merged_master (Bitcoin PR #21007) 2021-06-26 19:51:03 +00:00
Andrew Poelstra
1668dac3d6 Merge 702cfc8c53 into merged_master (Bitcoin PR #21055) 2021-06-26 01:21:19 +00:00