bitcoin/src
MarcoFalke 3d974960d3
Merge bitcoin/bitcoin#26515: rpc: skip getpeerinfo for a peer without CNodeStateStats
6fefd49527 rpc: Require NodeStateStats object in getpeerinfo (Martin Zumsande)

Pull request description:

  The objects `CNode`, `CNodeState` and `Peer` store different info about a peer - `InitializeNode()` and `FinalizeNode()` make sure that for the duration of a connection, we should always have one of each for a peer.

  Therefore, there is no situation in which, as part of getpeerinfo RPC,  `GetNodeStateStats()` (which requires a `CNodeState` and a `Peer` entry for a `NodeId` to succeed)  could fail for a legitimate reason while the peer is connected - this can only happen if there is a race condition between peer disconnection and the `getpeerinfo` processing (see also a more detailed description of this in https://github.com/bitcoin/bitcoin/pull/26457#pullrequestreview-1181641835).

  But in this case I think it's better to just not include the newly disconnected peer in the response instead of returning just parts of its data.

  An earlier version of this PR also made the affected `CNodeStateStats` fields non-optional (see 5f900e27d0). Since this conflicts with #25923 and should be a separate discussion, I removed that commit from this PR.

ACKs for top commit:
  dergoegge:
    Approach ACK 6fefd49527
  MarcoFalke:
    review ACK 6fefd49527 👒

Tree-SHA512: 89c8f7318df4634c1630415de9c8350e6dc2d14d9d07e039e5b180c51bfd3ee2ce99eeac4f9f858af7de846f7a6b48fcae96ebac08495b30e431a5d2d4660532
2022-12-19 13:59:17 +01:00
..
bench Merge bitcoin/bitcoin#26609: refactor: Move txmempool_entry.h --> kernel/mempool_entry.h 2022-12-06 19:04:31 +01:00
common refactor: Rename ambiguous interfaces::MakeHandler functions 2022-11-29 08:12:24 -04:00
compat moveonly: move IsSelectableSocket() from compat.h to sock.{h,cpp} 2022-07-20 16:26:19 +02:00
config
consensus refactor: use <cstdlib> over stdlib.h 2022-09-23 10:48:47 +01:00
crc32c Update crc32c subtree to latest upstream master 2022-08-13 13:55:38 +01:00
crypto Fix typo in comment SHA256->SHA512 2022-10-26 15:55:29 +03:00
index Merge bitcoin/bitcoin#19888: rpc, test: Improve getblockstats for unspendables 2022-12-05 17:46:54 -05:00
init Update -debug and -debugexclude help docs for severity level logging 2022-08-20 11:55:17 +02:00
interfaces refactor: Rename ambiguous interfaces::MakeHandler functions 2022-11-29 08:12:24 -04:00
ipc refactor: use <cstdlib> over stdlib.h 2022-09-23 10:48:47 +01:00
kernel refactor: Move txmempool_entry.h --> kernel/mempool_entry.h 2022-11-30 10:37:57 +00:00
leveldb Update leveldb-subtree subtree to latest upstream 2022-09-29 16:43:30 +01:00
logging util, refactor: Add UNIQUE_NAME helper macro 2022-02-16 14:59:20 +02:00
minisketch Update minisketch subtree to latest upstream 2022-10-23 15:03:04 +01:00
node Merge bitcoin/bitcoin#26298: refactor: Move src/interfaces/*.cpp files to libbitcoin_common.a 2022-12-07 14:54:23 +00:00
policy refactor: Move txmempool_entry.h --> kernel/mempool_entry.h 2022-11-30 10:37:57 +00:00
primitives wallet: Move fee underpayment check to after fee setting 2022-12-09 14:52:26 -05:00
qt clang-tidy: Fix readability-redundant-string-init in headers 2022-12-15 21:24:14 +00:00
rpc Merge bitcoin/bitcoin#26515: rpc: skip getpeerinfo for a peer without CNodeStateStats 2022-12-19 13:59:17 +01:00
script sign: Fill in taproot pubkey info for all script path sigs 2022-10-28 20:03:22 -04:00
secp256k1 Update secp256k1 subtree to latest upstream master 2022-06-11 14:55:18 +01:00
support refactor: use <cstdlib> over stdlib.h 2022-09-23 10:48:47 +01:00
test Merge bitcoin/bitcoin#25311: refactor: remove CBlockIndex copy construction 2022-12-19 09:34:39 +00:00
univalue univalue: Remove confusing getBool method 2022-12-09 10:03:26 -05:00
util util: Include full version id in bug reports 2022-12-06 11:14:47 +01:00
wallet Merge bitcoin/bitcoin#24865: rpc: Enable wallet import on pruned nodes and add test 2022-12-16 17:30:57 -05:00
zmq zmq: remove LOCK(cs_main) from NotifyBlock 2022-12-06 15:07:04 -05:00
.bear-tidy-config tidy: enable modernize-use-nullptr 2022-04-26 10:43:33 +01:00
.clang-format Use c++17 in clang-format 2021-11-12 11:46:34 +01:00
.clang-tidy Merge bitcoin/bitcoin#25872: Fix issues when calling std::move(const&) 2022-08-31 08:38:24 +01:00
addrdb.cpp Use steady clock for all millis bench logging 2022-07-30 10:23:58 +02:00
addrdb.h [net] Move asmap into NetGroupManager 2022-04-20 14:29:29 +01:00
addrman_impl.h addrman: Use system time instead of adjusted network time 2022-07-30 11:04:09 +02:00
addrman.cpp addrman: Use system time instead of adjusted network time 2022-07-30 11:04:09 +02:00
addrman.h addrman: Use system time instead of adjusted network time 2022-07-30 11:04:09 +02:00
arith_uint256.cpp Merge bitcoin/bitcoin#24077: util: Make base_uint::GetHex() and base_uint::SetHex() not depend on uint256 2022-04-14 07:15:22 +02:00
arith_uint256.h Remove duplicate static_asserts 2022-04-14 19:26:22 +02:00
attributes.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
banman.cpp Use steady clock for all millis bench logging 2022-07-30 10:23:58 +02:00
banman.h refactor: Add thread safety annotation to BanMan::SweepBanned() 2022-05-20 15:17:00 +02:00
base58.cpp scripted-diff: Rename ValidAsCString to ContainsNoNUL 2022-04-27 14:16:35 +02:00
base58.h refactor: Remove defunct attributes.h includes 2022-05-21 13:54:33 -05:00
bech32.cpp refactor: Make 64-bit shift explicit 2022-10-04 21:49:07 +01:00
bech32.h Make Bech32 LocateErrors return error list rather than using out-arg 2021-12-06 14:17:41 +13:00
bitcoin-chainstate.cpp scripted-diff: rename CChainState -> Chainstate 2022-09-09 11:47:27 -04:00
bitcoin-cli-res.rc windres: use PACKAGE_VERSION rather than building more version numbers 2021-08-17 16:54:47 +08:00
bitcoin-cli.cpp src/bitcoin-cli.cpp: -getinfo help - grammar correction 2022-11-15 09:41:23 -05:00
bitcoin-tx-res.rc windres: use PACKAGE_VERSION rather than building more version numbers 2021-08-17 16:54:47 +08:00
bitcoin-tx.cpp refactor: use <cstdio> over stdio.h 2022-09-21 16:53:11 +01:00
bitcoin-util-res.rc windres: use PACKAGE_VERSION rather than building more version numbers 2021-08-17 16:54:47 +08:00
bitcoin-util.cpp Make bitcoin-util grind_task tsan friendly 2022-12-16 09:56:06 +01:00
bitcoin-wallet-res.rc windres: use PACKAGE_VERSION rather than building more version numbers 2021-08-17 16:54:47 +08:00
bitcoin-wallet.cpp refactor: move url.h/cpp from lib util to lib common 2022-10-31 10:17:04 +00:00
bitcoind-res.rc windres: use PACKAGE_VERSION rather than building more version numbers 2021-08-17 16:54:47 +08:00
bitcoind.cpp refactor: move url.h/cpp from lib util to lib common 2022-10-31 10:17:04 +00:00
blockencodings.cpp Remove fUseWTXID parameter from CBlockHeaderAndShortTxIDs constructor 2022-05-17 10:37:10 +01:00
blockencodings.h Remove fUseWTXID parameter from CBlockHeaderAndShortTxIDs constructor 2022-05-17 10:37:10 +01:00
blockfilter.cpp Use new Join() helper for ListBlockFilterTypes() 2022-08-24 10:15:32 +02:00
blockfilter.h refactor: add LIFETIMEBOUND to blockfilter where needed 2022-08-31 16:51:32 +01:00
chain.cpp CBlockLocator: performance-move-const-arg Clang tidy fixups 2022-08-31 15:10:26 +02:00
chain.h remove CBlockIndex copy construction 2022-12-15 14:52:28 -05:00
chainparams.cpp Update chainparams for 24.0 release 2022-08-31 15:31:34 +03:00
chainparams.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
chainparamsbase.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
chainparamsbase.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
chainparamsseeds.h Merge bitcoin/bitcoin#25853: net: update testnet torv3 hardcoded seeds for 24.x 2022-09-09 10:07:39 +02:00
checkqueue.h Remove g_parallel_script_checks 2022-10-18 14:12:42 +02:00
clientversion.cpp refactor: shift CopyrightHolders() and LicenseInfo() to clientversion.cpp 2022-02-22 15:36:19 +00:00
clientversion.h refactor: shift CopyrightHolders() and LicenseInfo() to clientversion.cpp 2022-02-22 15:36:19 +00:00
coins.cpp Merge bitcoin/bitcoin#25707: refactor: Make const references to avoid unnecessarily copying objects and enable two clang-tidy checks 2022-08-19 17:11:06 +02:00
coins.h refactor: remove unused methods {CDBIterator,CCoinsViewDBCursor}::GetValueSize() 2022-06-21 16:19:10 +02:00
compressor.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
compressor.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
core_io.h refactor: Remove defunct attributes.h includes 2022-05-21 13:54:33 -05:00
core_memusage.h
core_read.cpp refactor: Make const refs vars where applicable 2022-07-27 13:27:57 +02:00
core_write.cpp refactor: add stdd:: includes to core_write 2022-03-30 20:11:15 +01:00
cuckoocache.h validationcaches: Use size_t for sizes 2022-08-03 12:03:28 -04:00
dbwrapper.cpp db: add StoragePath to CDBWrapper/CCoinsViewDB 2022-09-13 12:38:06 -04:00
dbwrapper.h db: add StoragePath to CDBWrapper/CCoinsViewDB 2022-09-13 12:38:06 -04:00
deploymentinfo.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
deploymentinfo.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
deploymentstatus.cpp validation: move g_versionbitscache into ChainstateManager 2022-05-10 12:09:33 +10:00
deploymentstatus.h validation: move g_versionbitscache into ChainstateManager 2022-05-10 12:09:33 +10:00
dummywallet.cpp wallet: ensure wallet files are not reused across chains 2022-02-16 15:02:26 +02:00
external_signer.cpp Merge bitcoin/bitcoin#23578: Add external signer taproot support 2022-10-26 11:10:23 +08:00
external_signer.h refactor: make ExternalSigner NetworkArg() and m_chain private 2021-06-16 10:48:58 +02:00
flatfile.cpp Disallow more unsafe string->path conversions allowed by path append operators 2022-04-21 12:01:00 -05:00
flatfile.h
fs.cpp fs: fully initialize _OVERLAPPED for win32 2022-09-14 11:55:10 +01:00
fs.h fs: work around u8path deprecated-declaration warnings with libc++ 2022-08-19 08:58:56 +01:00
hash.cpp Fix link to MurmurHash3.cpp from Austin Appleby 2022-08-30 13:52:45 +02:00
hash.h Use HashWriter where possible 2022-07-20 15:34:36 +02:00
headerssync.cpp Move headerssync logging to BCLog::NET 2022-08-30 12:09:04 -04:00
headerssync.h Track headers presync progress and log it 2022-08-29 08:10:35 -04:00
httprpc.cpp scripted-diff: Use getInt<T> over get_int/get_int64 2022-05-18 19:15:03 +02:00
httprpc.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
httpserver.cpp refactor: Refactored RequestMethodString function to follow developer notes 2022-12-09 16:14:27 +00:00
httpserver.h Merge bitcoin/bitcoin#24681: build: Bump libevent minimum version up to 2.1.8 2022-04-06 13:19:36 +01:00
i2p.cpp util: move threadinterrupt into util 2022-11-01 10:14:49 +00:00
i2p.h util: move threadinterrupt into util 2022-11-01 10:14:49 +00:00
indirectmap.h
init.cpp Fixup clang-tidy named argument comments 2022-12-05 15:51:46 +00:00
init.h Move init::SanityCheck to kernel::SanityCheck 2022-06-02 11:42:12 -04:00
key_io.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
key_io.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
key.cpp extended keys: fail to derive too large depth instead of wrapping around 2022-08-04 11:32:26 +02:00
key.h (pubk)key: mark Derive() as nodiscard 2022-08-04 11:32:25 +02:00
logging.cpp wallet: fast rescan: show log message for every non-skipped block 2022-10-25 15:57:38 +02:00
logging.h wallet: fast rescan: show log message for every non-skipped block 2022-10-25 15:57:38 +02:00
Makefile.am Merge bitcoin/bitcoin#26298: refactor: Move src/interfaces/*.cpp files to libbitcoin_common.a 2022-12-07 14:54:23 +00:00
Makefile.bench.include Merge bitcoin/bitcoin#16981: Improve runtime performance of --reindex 2022-11-15 19:23:39 -05:00
Makefile.crc32c.include build: Create .la library for crc32c 2022-04-26 16:25:38 -04:00
Makefile.leveldb.include Use more specific path when including memenv.h header 2022-06-23 15:33:01 +02:00
Makefile.minisketch.include build: add minisketch build file and include it 2021-10-21 09:37:30 +08:00
Makefile.qt_locale.include qt: Pre-branch translation updates for 23.x 2022-02-28 16:59:56 +01:00
Makefile.qt.include build: extract $(BOOST_CPPFLAGS) from $(BITCOIN_INCLUDES) 2022-09-13 17:15:17 +01:00
Makefile.qttest.include build: extract $(BOOST_CPPFLAGS) from $(BITCOIN_INCLUDES) 2022-09-13 17:15:17 +01:00
Makefile.test_fuzz.include [fuzz] Move ConsumeNetAddr to fuzz/util/net.h 2022-11-17 14:52:45 +00:00
Makefile.test_util.include refactor: unify test/util/wallet.h with wallet/test/util.h 2022-11-21 17:30:00 -03:00
Makefile.test.include refactor: unify test/util/wallet.h with wallet/test/util.h 2022-11-21 17:30:00 -03:00
Makefile.univalue.include Integrate univalue into our buildsystem 2021-10-11 20:46:25 +08:00
mapport.cpp util: move threadinterrupt into util 2022-11-01 10:14:49 +00:00
mapport.h net: Add -natpmp command line option 2021-01-07 18:07:09 +02:00
memusage.h refactor: use <cstdlib> over stdlib.h 2022-09-23 10:48:47 +01:00
merkleblock.cpp doc: fix various typos 2021-01-04 12:31:31 +08:00
merkleblock.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
net_permissions.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
net_permissions.h doc: clarify that NetPermissionFlags::Implicit is only about whitelists 2022-11-07 15:20:20 +01:00
net_processing.cpp Merge bitcoin/bitcoin#26199: p2p: Don't self-advertise during version processing 2022-12-12 10:12:09 +01:00
net_processing.h net: add NetEventsInterface::g_msgproc_mutex 2022-09-15 14:44:38 +10:00
net_types.cpp scripted-diff: Use getInt<T> over get_int/get_int64 2022-05-18 19:15:03 +02:00
net_types.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
net.cpp util: move threadinterrupt into util 2022-11-01 10:14:49 +00:00
net.h Merge bitcoin/bitcoin#26292: util: move threadinterrupt into util/ 2022-11-22 09:52:53 +00:00
netaddress.cpp [netaddress] Make OnionToString public 2022-11-17 14:52:45 +00:00
netaddress.h [netaddress] Make OnionToString public 2022-11-17 14:52:45 +00:00
netbase.cpp Merge bitcoin/bitcoin#25421: net: convert standalone IsSelectableSocket() and SetSocketNonBlocking() to Sock methods 2022-10-12 15:49:02 -04:00
netbase.h moveonly: move SetSocketNonBlocking() from netbase to util/sock 2022-07-20 16:26:24 +02:00
netgroup.cpp [netgroup] Use nStartByte as offset for the last byte of the group 2022-04-25 15:09:14 +02:00
netgroup.h [netgroupman] Remove NetGroupManager::GetAsmap() 2022-04-20 14:35:53 +01:00
netmessagemaker.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
noui.cpp scripted-diff: Avoid incompatibility with CMake AUTOUIC feature 2022-06-14 10:38:51 +02:00
noui.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
outputtype.cpp Merge bitcoin/bitcoin#25734: wallet, refactor: #24584 follow-ups 2022-08-16 20:00:19 -04:00
outputtype.h wallet: remove UNKNOWN type from OUTPUT_TYPES array 2022-08-18 16:47:15 -03:00
pow.cpp Add function to validate difficulty changes 2022-08-23 11:34:10 -04:00
pow.h Add function to validate difficulty changes 2022-08-23 11:34:10 -04:00
prevector.h refactor: use <cstdlib> over stdlib.h 2022-09-23 10:48:47 +01:00
protocol.cpp p2p: Announce reconciliation support 2022-10-17 12:35:43 +03:00
protocol.h p2p: Drop roles from sendtxrcncl 2022-11-10 09:21:57 +02:00
psbt.cpp Verify PSBT inputs rather than check for fields being empty 2022-10-17 11:13:02 -04:00
psbt.h clang-tidy: Fix performance-for-range-copy in headers 2022-12-16 10:53:55 +00:00
pubkey.cpp Merge bitcoin/bitcoin#25642: Don't wrap around when deriving an extended key at a too large depth 2022-08-10 14:25:43 -04:00
pubkey.h (pubk)key: mark Derive() as nodiscard 2022-08-04 11:32:25 +02:00
random.cpp refactor: use <cstdlib> over stdlib.h 2022-09-23 10:48:47 +01:00
random.h refactor: Make FEELER_SLEEP_WINDOW type safe (std::chrono) 2022-07-13 15:21:12 +02:00
randomenv.cpp refactor: move compat.h into compat/ 2022-07-20 10:34:46 +01:00
randomenv.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
rest.cpp rest: reduce LOCK(cs_main) scope in rest_block 2022-12-06 15:07:04 -05:00
rest.h Handle query string when parsing data format 2022-03-10 12:01:53 +01:00
reverse_iterator.h
scheduler.cpp refactor: use C++11 default initializers 2022-05-17 17:18:58 +01:00
scheduler.h Increase threadsafety annotation coverage 2022-05-12 02:25:55 +10:00
serialize.h Add ChronoFormatter to serialize 2022-07-26 11:05:04 +02:00
shutdown.cpp scripted-diff: Avoid incompatibility with CMake AUTOUIC feature 2022-06-14 10:38:51 +02:00
shutdown.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
signet.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
signet.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
span.h scripted-diff: rename BytePtr to AsBytePtr 2022-04-26 09:41:45 +01:00
streams.h util: add CBufferedFile::SkipTo() to move ahead in the stream 2022-10-24 13:02:37 -06:00
sync.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
sync.h Merge bitcoin/bitcoin#25676: sync: simplify and remove unused code from sync.h 2022-10-11 09:18:55 +08:00
threadsafety.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
timedata.cpp Make adjusted time type safe 2022-08-05 14:59:15 +02:00
timedata.h Make adjusted time type safe 2022-08-05 14:59:15 +02:00
tinyformat.h clang-tidy: Fix modernize-use-nullptr in headers 2022-12-15 20:58:19 +00:00
torcontrol.cpp refactor: move compat.h into compat/ 2022-07-20 10:34:46 +01:00
torcontrol.h torcontrol: Query Tor for correct -onion configuration 2022-03-15 01:33:52 +00:00
txdb.cpp CDiskBlockIndex: rename GetBlockHash() to ConstructBlockHash() 2022-07-22 12:45:07 +02:00
txdb.h db: add StoragePath to CDBWrapper/CCoinsViewDB 2022-09-13 12:38:06 -04:00
txmempool.cpp Merge bitcoin/bitcoin#17786: refactor: Nuke policy/fees->mempool circular dependencies 2022-11-18 17:04:49 -08:00
txmempool.h refactor: Move txmempool_entry.h --> kernel/mempool_entry.h 2022-11-30 10:37:57 +00:00
txorphanage.cpp scripted-diff: rename and de-globalise g_cs_orphans 2022-10-11 23:35:37 +10:00
txorphanage.h scripted-diff: rename and de-globalise g_cs_orphans 2022-10-11 23:35:37 +10:00
txrequest.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
txrequest.h
uint256.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
uint256.h Use ReadLE64 in uint256::GetUint64() instead of duplicating logic 2022-09-15 16:48:50 -04:00
undo.h
validation.cpp Merge bitcoin/bitcoin#26477: validation: fix broken maxtipage comparison 2022-12-13 10:07:37 +00:00
validation.h Merge bitcoin/bitcoin#26513: Make static nLastFlush and nLastWrite Chainstate members 2022-12-08 15:35:28 +00:00
validationinterface.cpp log: mempool: log removal reason in validation interface 2022-11-04 09:38:39 -04:00
validationinterface.h scripted-diff: Rename MainSignalsInstance() class to MainSignalsImpl() 2022-05-09 18:35:44 +02:00
version.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
versionbits.cpp Sanity assert GetAncestor() != nullptr where appropriate 2022-05-05 15:55:44 +02:00
versionbits.h Increase threadsafety annotation coverage 2022-05-12 02:25:55 +10:00
walletinitinterface.h Add src/node/* code to node:: namespace 2022-01-06 22:14:16 -05:00
warnings.cpp scripted-diff: Convert global Mutexes to GlobalMutexes 2022-05-21 01:23:23 +10:00
warnings.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00