Commit graph

1963 commits

Author SHA1 Message Date
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
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
Andrew Poelstra
9a55d65515 Merge 92b7efcf54 into merged_master (Bitcoin PR #21148) 2021-06-25 23:51:25 +00:00
Andrew Poelstra
362765a450 Merge b9f41df1ea into merged_master (Bitcoin PR #20685) 2021-06-25 19:49:38 +00:00
Andrew Poelstra
37c94c9100 Merge b805dbb0b9 into merged_master (Bitcoin PR #19809) 2021-06-24 13:52:54 +00:00
Andrew Poelstra
5a654c9bab Merge 9017d55e7c into merged_master (Bitcoin PR #15946) 2021-06-24 02:56:40 +00:00
Andrew Poelstra
993a3aa40e Merge 372dd8da24 into merged_master (Bitcoin PR #21110) 2021-06-24 02:09:12 +00:00
Andrew Poelstra
5ac1d67769 Merge 489030f2a8 into merged_master (Bitcoin PR #20965) 2021-06-23 14:18:22 +00:00
Andrew Poelstra
401d0bb381 Merge e9c037ba64 into merged_master (Bitcoin PR #19884) 2021-06-23 03:43:29 +00:00
Vasil Dimov
d197977ae2
banman: save the banlist in a JSON format on disk
Save the banlist in `banlist.json` instead of `banlist.dat`.

This makes it possible to store Tor v3 entries in the banlist on disk
(and any other addresses that cannot be serialized in addrv1 format).

Only read `banlist.dat` if it exists and `banlist.json` does not
exist (first start after an upgrade).

Supersedes https://github.com/bitcoin/bitcoin/pull/20904
Resolves https://github.com/bitcoin/bitcoin/issues/19748
2021-06-21 14:39:44 +02:00
Andrew Poelstra
d9966231cf Merge 53730a78bc into merged_master (Bitcoin PR #21077) 2021-06-21 02:17:09 +00:00
Andrew Poelstra
84118435fe Merge ea96e17e1f into merged_master (Bitcoin PR #21060) 2021-06-20 20:12:17 +00:00