Commit Graph

39644 Commits

Author SHA1 Message Date
fanquake a238356823
Merge bitcoin/bitcoin#28907: depends: bump libmultiprocess to fix capnproto deprecation warnings
21bfee0720 depends: bump libmultiprocess to fix capnproto deprecation warnings (Ryan Ofsky)

Pull request description:

  This incorporates PR chaincodelabs/libmultiprocess#88 and reverts the NO_WERROR CI workaround added in #28735

  Upstream diff: 61d5a0e661...414542f81e

  ---

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/issues/28722).

ACKs for top commit:
  maflcko:
    lgtm ACK 21bfee0720
  hebasto:
    ACK 21bfee0720, I have reviewed the code and it looks OK. I've also skimmed through the related changes in the https://github.com/chaincodelabs/libmultiprocess repository.

Tree-SHA512: b5addb0deed694eeec62a0ae08b4715a811110201f39f3e6cadee8fc4e6231b0e66c844a98512072a1445bac122ab561dc1711e27fb4d7ac5c08ac46780a4acf
2023-11-22 11:48:09 +00:00
fanquake 4374a87879
Merge bitcoin/bitcoin#28895: p2p: do not make automatic outbound connections to addnode peers
5e7cc4144b test: add unit test for CConnman::AddedNodesContain() (Jon Atack)
cc62716920 p2p: do not make automatic outbound connections to addnode peers (Jon Atack)

Pull request description:

  to allocate our limited outbound slots correctly, and to ensure addnode
  connections benefit from their intended protections.

  Our addnode logic usually connects the addnode peers before the automatic
  outbound logic does, but not always, as a connection race can occur.  If an
  addnode peer disconnects us and if it was the only one from its network, there
  can be a race between reconnecting to it with the addnode thread, and it being
  picked as automatic network-specific outbound peer.  Or our internet connection
  or router or the addnode peer could be temporarily offline, and then return
  online during the automatic outbound thread.  Or we could add a new manual peer
  using the addnode RPC at that time.

  The race can be more apparent when our node doesn't know many peers, or with
  networks like cjdns that currently have few bitcoin peers.

  When an addnode peer is connected as an automatic outbound peer and is the only
  connection we have to a network, it can be protected by our new outbound
  eviction logic and persist in the "wrong role".

  Finally, there does not seem to be a reason to make block-relay or short-lived
  feeler connections to addnode peers, as the addnode logic will ensure we connect
  to them if they are up, within the addnode connection limit.

  Fix these issues by checking if the address is an addnode peer in our automatic
  outbound connection logic.

ACKs for top commit:
  mzumsande:
    Tested ACK 5e7cc4144b
  brunoerg:
    utACK 5e7cc4144b
  vasild:
    ACK 5e7cc4144b
  guggero:
    utACK 5e7cc4144b

Tree-SHA512: 2438c3ec92e98aebca2a0da960534e4655a9c6e1192a24a085fc01326d95cdb1b67d8c44e4ee706bc1d8af8564126d446a21b5579dcbec61bdea5fce2f0115ee
2023-11-22 11:47:18 +00:00
fanquake ca041fc4ab
Merge bitcoin/bitcoin#28904: Drop CAutoFile
4eb2a9ea4b streams: Drop unused CAutoFile (Anthony Towns)
cde9a4b137 refactor: switch from CAutoFile to AutoFile (Anthony Towns)
bbd4646a2e blockstorage: switch from CAutoFile to AutoFile (Anthony Towns)
c72ddf04db streams: Remove unused CAutoFile::GetVersion (Anthony Towns)
e63f643079 streams: Base BufferedFile on AutoFile instead of CAutoFile (Anthony Towns)

Pull request description:

  Continuing the move away from `GetVersion()`, replace uses of `CAutoFile` with `AutoFile`.

ACKs for top commit:
  maflcko:
    re-ACK 4eb2a9ea4b 🖼
  TheCharlatan:
    ACK 4eb2a9ea4b
  stickies-v:
    ACK 4eb2a9ea4b

Tree-SHA512: 1a68c42fdb725ca4bf573e22794fe7809fea764a5f97ecb33435add3c609d40f336038fb22ab1ea72567530efd39678278c9016f92ed04891afdb310631b4e82
2023-11-22 11:24:39 +00:00
fanquake 3dca308bd7
Merge bitcoin/bitcoin#28891: test: fix `AddNode` unit test failure on OpenBSD
007d6f0e85 test: fix `AddNode` unit test failure on OpenBSD (Sebastian Falbesoner)

Pull request description:

  On OpenBSD 7.4, the following check of the unit test `test_addnode_getaddednodeinfo_and_connection_detection` currently fails:
  ```
  BOOST_CHECK(!connman->AddNode({/*m_added_node=*/"127.1", /*m_use_v2transport=*/true}));
  ```
  The reason for that is that this OS seemingly doesn't support the IPv4 shorthand notation with omitted zero-bytes:

  ```
  $ ping 127.1
  ping: no address associated with name
  ```

  As a simple fix, this PR skips the check for this with a pre-processor #if. On NetBSD and FreeBSD, `127.1` is resolved correctly to localhost and hence the test passes (thanks to vasild for verifying on the latter!).

ACKs for top commit:
  vasild:
    ACK 007d6f0e85

Tree-SHA512: 8ab8393c490e1ecc140e8ff74f6fa4d26d0dd77e6a77a241cd198314b8c5afee7422f95351ca05f4c1742433dab77016a8ccb8d28062f8edd4b703a918a2bbda
2023-11-22 11:18:24 +00:00
fanquake e9beaa749c
Merge bitcoin/bitcoin#28913: coins: make sure PoolAllocator uses the correct alignment
d5b4c0b69e pool: change memusage_test to use int64_t, add allocation check (Martin Leitner-Ankerl)
ce881bf9fc pool: make sure PoolAllocator uses the correct alignment (Martin Leitner-Ankerl)

Pull request description:

  The class `CTxOut` has a member `CAmount` which is an int64_t, and on ARM 32bit int64_t are 8 byte aligned, which is larger than the pointer alignment of 4 bytes.

  So for `CCoinsMap` to be able to use the pool, we need to use the alignment of the member instead of just `alignof(void*)`.

  This fixes #28906 (first noted in https://github.com/bitcoin/bitcoin/issues/28718#issuecomment-1807197107) and #28440.

ACKs for top commit:
  pinheadmz:
    ACK d5b4c0b69e
  hebasto:
    re-ACK d5b4c0b69e, the only change since my recent [review](https://github.com/bitcoin/bitcoin/pull/28913#pullrequestreview-1739334189) is an updated test.
  theStack:
    Tested ACK d5b4c0b69e

Tree-SHA512: 4446793fad6d56f0fe22e09ac9ade051e86de11ac039cd61c0f6b7f79874242878a6a46a2c76ac3b8f1d53464872620d39139f54b1471daccad26d6bb1ae8ca1
2023-11-22 11:15:27 +00:00
ismaelsadeeq 91504cbe0d rpc: `SyncWithValidationInterfaceQueue` on fee estimation RPC's
This ensures that the most recent fee estimation data is used for the
fee estimation with `estimateSmartfee` and `estimaterawfee` RPC's.
2023-11-22 11:48:21 +01:00
ismaelsadeeq 714523918b tx fees, policy: CBlockPolicyEstimator update from `CValidationInterface` notifications
`CBlockPolicyEstimator` will implement `CValidationInterface` and
subscribe to its notification to process transactions added and removed
from the mempool.

Re-delegate calculation of `validForFeeEstimation` from validation to fee estimator.

Also clean up the validForFeeEstimation arg thats no longer needed in `CTxMempool`.

Co-authored-by: Matt Corallo <git@bluematt.me>
2023-11-22 11:48:21 +01:00
ismaelsadeeq dff5ad3b99 CValidationInterface: modify the parameter of `TransactionAddedToMempool`
Create a new struct `NewMempoolTransactionInfo` that will be used as the new parameter of
`TransactionAddedToMempool` callback.
2023-11-22 11:48:21 +01:00
ismaelsadeeq 91532bd382 tx fees, policy: update `CBlockPolicyEstimator::processBlock` parameter
Update `processBlock` parameter to reference to a vector of `RemovedMempoolTransactionInfo`.
2023-11-22 11:48:21 +01:00
ismaelsadeeq bfcd401368 CValidationInterface, mempool: add new callback to `CValidationInterface`
This commit adds a new callback `MempoolTransactionsRemovedForBlock` which notify
its listeners of the transactions that are removed from the mempool because a new
block is connected, along with the block height the transactions were removed.
The transactions are in `RemovedMempoolTransactionInfo` format.

`CTransactionRef`, base fee, virtual size, and height which the transaction was added
to the mempool are all members of the struct called `RemovedMempoolTransactionInfo`.

A struct `NewMempoolTransactionInfo`, which has fields similar to `RemovedMempoolTransactionInfo`,
will be added in a later commit, create a struct `TransactionInfo` with all similar fields.
They can both have a member with type `TransactionInfo`.
2023-11-22 11:48:21 +01:00
ismaelsadeeq 0889e07987 tx fees, policy: cast with static_cast instead of C-Style cast 2023-11-22 11:48:21 +01:00
ismaelsadeeq a0e3eb7549 tx fees, policy: bugfix: move `removeTx` into reason != `BLOCK` condition
If the removal reason of a transaction is BLOCK, then the `removeTx`
boolean argument should be true.

Before this PR, `CBlockPolicyEstimator` have to complete updating the fee stats
before the mempool clears that's why having removeTx call outside reason!= `BLOCK`
in `addUnchecked` was not a bug.

But in a case where the `CBlockPolicyEstimator` update is asynchronous, the mempool might
clear before we update the `CBlockPolicyEstimator` fee stats.
Transactions that are removed for `BLOCK` reasons will also be incorrectly removed from
`CBlockPolicyEstimator` stats as failures.
2023-11-22 11:48:21 +01:00
Hennadii Stepanov 640b450530
Merge bitcoin/bitcoin#28925: ci: Update apt cache
710da28c72 ci: Switch from `apt` to `apt-get` (Hennadii Stepanov)
a6cc059ea5 ci: Update apt cache (Hennadii Stepanov)

Pull request description:

  This PR aims to fix the recent errors in the "test each commit" CI job.

ACKs for top commit:
  maflcko:
    lgtm ACK 710da28c72
  ismaelsadeeq:
    utACK 710da28c72

Tree-SHA512: b42340aea00e80f791000e19791629f27df2da98adefb839cb4389d81b5eee094089ea5092a2d7b56b3990683a72e4d2fa986fc86c823c7245649af37873b790
2023-11-22 10:43:18 +00:00
Hennadii Stepanov 710da28c72
ci: Switch from `apt` to `apt-get` 2023-11-22 10:02:08 +00:00
Hennadii Stepanov a6cc059ea5
ci: Update apt cache 2023-11-22 10:01:19 +00:00
Sjors Provoost f053024273
wallet: batch external signer descriptor import
Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
2023-11-21 23:07:00 -03:00
furszy 1f65241b73
wallet: descriptors setup, batch db operations
Instead of doing one db transaction per descriptor setup,
batch all descriptors' setup writes in a single db txn.

Speeding up the process and preventing the wallet from entering
an inconsistent state if any of the intermediate transactions
fail.
2023-11-21 23:01:42 -03:00
furszy 3eb769f150
wallet: batch legacy spkm TopUp
Instead of performing multiple atomic write
operations per legacy spkm setup call, batch
them all within a single atomic db txn.
2023-11-21 23:01:30 -03:00
furszy 075aa44ceb
wallet: batch descriptor spkm TopUp
Instead of performing multiple atomic write
operations per descriptor setup call, batch
them all within a single atomic db txn.
2023-11-21 23:01:30 -03:00
MarcoFalke fa63f16018
test: Add uint256 string parse tests 2023-11-21 17:37:57 +01:00
MarcoFalke facf629ce8
refactor: Remove unused and fragile string interface from arith_uint256 2023-11-21 17:37:25 +01:00
dergoegge 9e58c5bcd9 Use Txid in COutpoint 2023-11-21 13:15:44 +00:00
Hennadii Stepanov daa56f7f66
Merge bitcoin/bitcoin#28905: ci: Avoid toolset ambiguity that MSVC can't handle
91d5bd8ac9 ci: Avoid toolset ambiguity that MSVC can't handle (Hennadii Stepanov)

Pull request description:

  This PR introduces a workaround, which is similar to the one removed in https://github.com/bitcoin/bitcoin/pull/28796, required to work with the new windows-2022 image version [20231115](https://github.com/actions/runner-images/blob/win22/20231115.2/images/windows/toolsets/toolset-2022.json) properly.

  Tested on the following image versions:
  - [20231029.1.0](https://github.com/hebasto/bitcoin/actions/runs/6904313692/job/18784722567)
  - [20231115.2.0](https://github.com/hebasto/bitcoin/actions/runs/6905808606/job/18789398318)

  Fixes https://github.com/bitcoin/bitcoin/issues/28901.

ACKs for top commit:
  maflcko:
    lgtm ACK 91d5bd8ac9 , assuming it fixes the CI failures
  TheCharlatan:
    utACK 91d5bd8ac9
  pablomartin4btc:
    utACK 91d5bd8ac9

Tree-SHA512: 13c325a24e09cdaa26b04a1c8c9968fe3525d1c0c887d42739c51fdb62c184667367cf56d0e7f64ff616b1f62998f28197b95291164418bb29c576b3f738a6a7
2023-11-21 11:07:40 +00:00
brunoerg 47e5c9994c fuzz: add target for `DescriptorScriptPubKeyMan` 2023-11-20 15:57:56 -03:00
brunoerg 641dddf018 fuzz: create ConsumeCoins 2023-11-20 15:57:56 -03:00
brunoerg 2e1833ca13 fuzz: move `MockedDescriptorConverter` to `fuzz/util` 2023-11-20 15:57:50 -03:00
Martin Leitner-Ankerl d5b4c0b69e pool: change memusage_test to use int64_t, add allocation check
If alignment of the PoolAllocator would be insufficient, then the test would fail. This also catches the issue with ARM 32bit,
where int64_t is aligned to 8 bytes but void* is aligned to 4 bytes. The test adds a check to ensure the pool has allocated
a minimum number of chunks
2023-11-20 17:10:34 +01:00
Hennadii Stepanov 228d6a2969
build: Fix regression in "ARMv8 CRC32 intrinsics" test
The `vmull_p64` is a part of the Crypto extensions from the ACLE. They
are optional extensions, so they get enabled with a `+crypto` for
architecture flags.
2023-11-20 13:37:44 +00:00
MarcoFalke fa9b5f4fe3
refactor: NetMsg::Make() without nVersion
The nVersion field is unused, so remove it.

This is also required for future commits.

Also, add PushMessage aliases in PeerManagerImpl to make calling code
less verbose.

Co-Authored-By: Anthony Towns <aj@erisian.com.au>
2023-11-20 14:02:27 +01:00
Martin Leitner-Ankerl ce881bf9fc pool: make sure PoolAllocator uses the correct alignment
This changes the PoolAllocator to default the alignment to the given type. This makes the code simpler, and most importantly
fixes a bug on ARM 32bit that caused OOM: The class CTxOut has a member CAmount which is an int64_t and on ARM 32bit int64_t
are 8 byte aligned which is larger than the pointer alignment of 4 bytes. So for CCoinsMap to be able to use the pool, we
need to use the alignment of the member instead of just alignof(void*).
2023-11-19 18:43:29 +01:00
TheCharlatan 705e3f1de0
refactor: Make CTxMemPoolEntry only explicitly copyable
This has the goal of prohibiting users from accidentally creating
runtime failures, e.g. by interacting with iterator_to with a copied
entry.

CTxMemPoolEntry is already implicitly not move-constructable. So be
explicit about this and use a std::list to collect the values in the
policy_estimator fuzz test instead of a std::vector.

Co-authored-by: Anthony Towns <aj@erisian.com.au>
2023-11-17 23:02:02 +01:00
Ryan Ofsky 21bfee0720 depends: bump libmultiprocess to fix capnproto deprecation warnings
This incorporates PR https://github.com/chaincodelabs/libmultiprocess/pull/88
"Fix current deprecation warnings as of capnproto-1.0.1" and reverts the
NO_WERROR CI workaround added in https://github.com/bitcoin/bitcoin/pull/28735
2023-11-17 15:27:19 -05:00
Anthony Towns 4eb2a9ea4b streams: Drop unused CAutoFile 2023-11-18 03:01:41 +10:00
Anthony Towns cde9a4b137 refactor: switch from CAutoFile to AutoFile 2023-11-18 03:01:41 +10:00
Anthony Towns bbd4646a2e blockstorage: switch from CAutoFile to AutoFile
Also bump includes per suggestions from iwyu.
2023-11-18 03:01:03 +10:00
fanquake d752349029
Merge bitcoin/bitcoin#28900: doc: remove mingw-w64 install for "older" systems
656a7e9de6 doc: remove mingw-w64 install for "older" systems (fanquake)

Pull request description:

  Now that we require GCC 10.1+, the posix variant is available on supported systems.

  i.e:
  https://packages.debian.org/bullseye/g++-mingw-w64-x86-64-posix
  https://packages.ubuntu.com/jammy/g++-mingw-w64-x86-64-posix

ACKs for top commit:
  maflcko:
    ACK 656a7e9de6
  BrandonOdiwuor:
    ACK 656a7e9de6
  hebasto:
    ACK 656a7e9de6.

Tree-SHA512: b7d3696ad5d0322c107ced5750d20c40167caaf7d063cf01da5fc12c4086827f4f73185aa5cc9ac170778b0523c0c16cca3b2419b11019da9d30b936ee897e14
2023-11-17 15:38:50 +00:00
Hennadii Stepanov 91d5bd8ac9
ci: Avoid toolset ambiguity that MSVC can't handle
This change is required to work with the new windows-2022 image version
20231115 properly.
2023-11-17 15:15:06 +00:00
fanquake b2309c47da
Merge bitcoin/bitcoin#28902: doc: Simplify guix install doc, after 1.4 release
fa552e8a4e doc: Simplify guix install doc, after 1.4 release (MarcoFalke)

Pull request description:

  Now that 1.4 is out (for a while), remove the recommendation to build a random commit.

ACKs for top commit:
  fanquake:
    ACK fa552e8a4e
  hebasto:
    ACK fa552e8a4e.

Tree-SHA512: f5642df201ff0e2af8a7ae9660a66920ddbb5f522b3e921f6f4aa7c411ced23afa91bdfe43b943ac012228eebbaad3396df505d00aa8f721a4358f03fda9d8e3
2023-11-17 14:18:58 +00:00
Anthony Towns c72ddf04db streams: Remove unused CAutoFile::GetVersion 2023-11-18 00:15:25 +10:00
Anthony Towns e63f643079 streams: Base BufferedFile on AutoFile instead of CAutoFile 2023-11-18 00:15:22 +10:00
MarcoFalke 66669da4a5
Remove unused Make() overload in netmessagemaker.h 2023-11-17 14:38:40 +01:00
MarcoFalke fa0ed07941
refactor: VectorWriter without nVersion
The field is unused, so remove it.

This is also required for future commits.
2023-11-17 14:38:26 +01:00
MarcoFalke fa552e8a4e
doc: Simplify guix install doc, after 1.4 release 2023-11-17 12:45:00 +01:00
fanquake 98b0acda0f
Merge bitcoin/bitcoin#28725: test: refactor: use built-in collection types for type hints (Python 3.9 / PEP 585)
a478c817b2 test: replace `Callable`/`Iterable` with their `collections.abc` alternative (PEP 585) (stickies-v)
4b9afb18e6 scripted-diff: use PEP 585 built-in collection types for verify-binary script (Sebastian Falbesoner)
d516cf83ed test: use built-in collection types for type hints (Python 3.9 / PEP 585) (Sebastian Falbesoner)

Pull request description:

  With Python 3.9 / [PEP 585](https://peps.python.org/pep-0585/), [type hinting has become a little less awkward](https://docs.python.org/3.9/whatsnew/3.9.html#type-hinting-generics-in-standard-collections), as for collection types one doesn't need to import the corresponding capitalized types (`Dict`, `List`, `Set`, `Tuple`, ...) anymore, but can use the built-in types directly (see  https://peps.python.org/pep-0585/#implementation for the full list).

  This PR applies the replacement for all Python scripts (i.e. in the contrib and test folders) for the basic types, i.e.:

  - typing.Dict -> dict
  - typing.List -> list
  - typing.Set  -> set
  - typing.Tuple -> tuple

  For an additional check, I ran mypy 1.6.1 on both master and the PR branch via
  ```
  $ mypy --ignore-missing-imports --explicit-package-bases $(git ls-files "*.py")
  ```
  and verified that the output is identical -- (from the 22 identified problems, most look like false-positives, it's probably worth it to go deeper here and address them in a follow-up though).

ACKs for top commit:
  stickies-v:
    ACK a478c817b2
  fanquake:
    ACK a478c817b2

Tree-SHA512: 6948c905f6abd644d84f09fcb3661d7edb2742e8f2b28560008697d251d77a61a1146ab4b070e65b0d27acede7a5256703da7bf6eb1c7c3a897755478c76c6e8
2023-11-17 11:19:17 +00:00
fanquake 656a7e9de6
doc: remove mingw-w64 install for "older" systems
Now that we require GCC 10.1+, the posix variant is available on
supported systems.

i.e:
https://packages.debian.org/bullseye/g++-mingw-w64-x86-64-posix
https://packages.ubuntu.com/jammy/g++-mingw-w64-x86-64-posix
2023-11-17 10:57:51 +00:00
fanquake 950af7c876
Merge bitcoin/bitcoin#28878: Remove version field from GetSerializeSize
83986f464c Include version.h in fewer places (Anthony Towns)
c7b61fd61b Convert some CDataStream to DataStream (Anthony Towns)
1410d300df serialize: Drop useless version param from GetSerializeSize() (Anthony Towns)
bf574a7501 serialize: drop GetSerializeSizeMany (Anthony Towns)
efa9eb6d7c serialize: Drop nVersion from [C]SizeComputer (Anthony Towns)

Pull request description:

  Drops the version field from `GetSerializeSize()`, simplifying the code in various places. Also drop `GetSerializeSizeMany()` (as just removing the version parameter could result in silent bugs) and remove unnecessary instances of `#include <version.h>`.

ACKs for top commit:
  maflcko:
    ACK 83986f464c 📒
  theuni:
    ACK 83986f464c.

Tree-SHA512: 36617b6dfbb1b4b0afbf673e905525fc6d623d3f568d3f86e3b9d4f69820db97d099e83a88007bfff881f731ddca6755ebf1549e8d8a7762437dfadbf434c62e
2023-11-17 10:56:41 +00:00
fanquake afd3e99856
Merge bitcoin/bitcoin#28873: fuzz: AutoFile with XOR
faa25718b3 fuzz: AutoFile with XOR (MarcoFalke)
fab5cb9066 fuzz: Reduce LIMITED_WHILE limit for file fuzzing (MarcoFalke)
fa5388fad3 fuzz: Remove FuzzedAutoFileProvider (MarcoFalke)

Pull request description:

  This should help to get fuzz coverage for https://maflcko.github.io/b-c-cov/fuzz.coverage/src/streams.cpp.gcov.html

  Also, remove unused code and fix a timeout bug.

ACKs for top commit:
  dergoegge:
    ACK faa25718b3

Tree-SHA512: 56f1e6fd5cb2b66ffd9a7d9c09c9b8e396be3e7485feb03b35b6bd3c48e624fdaed50b472e4ffec21f09efb5e949d7ee32a13851849c9140b6b4cf25917dd7ac
2023-11-17 10:12:35 +00:00
stickies-v a478c817b2 test: replace `Callable`/`Iterable` with their `collections.abc` alternative (PEP 585) 2023-11-16 19:12:14 +01:00
Jon Atack 5e7cc4144b test: add unit test for CConnman::AddedNodesContain() 2023-11-16 10:38:25 -06:00
Jon Atack cc62716920 p2p: do not make automatic outbound connections to addnode peers
to allocate our limited outbound slots correctly, and to ensure addnode
connections benefit from their intended protections.

Our addnode logic usually connects the addnode peers before the automatic
outbound logic does, but not always, as a connection race can occur.  If an
addnode peer disconnects us and if it was the only one from its network, there
can be a race between reconnecting to it with the addnode thread, and it being
picked as automatic network-specific outbound peer.  Or our internet connection
or router, or the addnode peer, could be temporarily offline, and then return
online during the automatic outbound thread.  Or we could add a new manual peer
using the addnode RPC at that time.

The race can be more apparent when our node doesn't know many peers, or with
networks like cjdns that currently have few bitcoin peers.

When an addnode peer is connected as an automatic outbound peer and is the only
connection we have to a network, it can be protected by our new outbound
eviction logic and persist in the "wrong role".

Examples on mainnet using logging added in the same pull request:

2023-08-12T14:51:05.681743Z [opencon] [net.cpp:1949] [ThreadOpenConnections]
[net:debug] Not making automatic network-specific outbound-full-relay connection
to i2p peer selected for manual (addnode) connection: [geh...odq.b32.i2p]:0

2023-08-13T03:59:28.050853Z [opencon] [net.cpp:1949] [ThreadOpenConnections]
[net:debug] Not making automatic block-relay-only connection to onion peer
selected for manual (addnode) connection: kpg...aid.onion:8333

2023-08-13T16:21:26.979052Z [opencon] [net.cpp:1949] [ThreadOpenConnections]
[net:debug] Not making automatic network-specific outbound-full-relay connection
to cjdns peer selected for manual (addnode) connection: [fcc...8ce]:8333

2023-08-14T20:43:53.401271Z [opencon] [net.cpp:1949] [ThreadOpenConnections]
[net:debug] Not making automatic network-specific outbound-full-relay connection
to cjdns peer selected for manual (addnode) connection: [fc7...59e]:8333

2023-08-15T00:10:01.894147Z [opencon] [net.cpp:1949] [ThreadOpenConnections]
[net:debug] Not making automatic feeler connection to i2p peer selected for
manual (addnode) connection: geh...odq.b32.i2p:8333

Finally, there does not seem to be a reason to make block-relay or short-lived
feeler connections to addnode peers, as the addnode logic will ensure we connect
to them if they are up, within the addnode connection limit.

Fix these issues by checking if the address is an addnode peer in our automatic
outbound connection logic.
2023-11-16 10:38:25 -06:00