assumeutxo: net_processing changes
This is part of the assumeutxo project (parent PR: #27596)
This PR includes the changes necessary to perform network functionality with multiple chainstates in use. Various pieces of net_processing logic have to be modified in order to support block download that is simultaneous across numerous chainstates.
Changes include
-
Modify FindNextBlocksToDownload() to parameterize the chainstate being worked on.
-
Change GetNodeStateStats to take the max nCommonHeight per peer across all chainstates.
-
Add CNodeState::chainstate_to_last_common_block
- we need this to allow handling for a single peer to distinguish between separate chainstates we're simultaneously downloading blocks for
-
Share
requests_availableacross chainstates when finding the next blocks to download (during calls to FindNextBlocksToDownload()).
This PR shares commit https://github.com/jamesob/bitcoin/commit/17906dd52543fb75d2c45de884799b35ec5721f4 with #24006, and is included here so that the two changes can be reviewed in parallel.
This PR excludes a small net_processing commit, https://github.com/jamesob/bitcoin/commit/3e6164d96f9a42ecbf34359f6fd1af5413346933, which will be proposed for merge after #24006 since it relies on the introduction of the BackgroundBlockConnected() validationinterface event that the indexing changes introduce.
Some commits here are best reviewed with --ignore-space-change.
Unit-testing net_processing is notoriously difficult and with that in mind I haven't included any unittests here, but in parallel with review of these changes I will attempt to write some tests. Note that this behavior is covered in the functional tests included in the parent PR: https://github.com/jamesob/bitcoin/commit/c4949f2daf05289e76123b3c705277bf735a79d6