mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-02 09:15:04 +02:00
Merge #20228: addrman: Make addrman a top-level component
3fc06d3d7b[net] remove fUpdateConnectionTime from FinalizeNode (John Newbery)7c4cc67c0c[net] remove CConnman::AddNewAddresses (John Newbery)bcd7f30b79[net] remove CConnman::MarkAddressGood (John Newbery)8073673dbc[net] remove CConnman::SetServices (John Newbery)392a95d393[net_processing] Keep addrman reference in PeerManager (John Newbery)1c25adf6d2[net] Construct addrman outside connman (John Newbery) Pull request description: Addrman is currently a member variable of connman. Make it a top-level component with lifetime owned by node.context, and add a reference to addrman in peerman. This allows us to eliminate some functions in connman that are simply forwarding requests to addrman, and simplifies the connman-peerman interface. By constructing the addrman in init, we can also add parameters to the ctor, which allows us to test it better. See #20233, where we enable consistency checking for addrman in our functional tests. ACKs for top commit: MarcoFalke: re-ACK3fc06d3d7bonly change is squash 🏀 vasild: ACK3fc06d3d7bTree-SHA512: 17662c65cbedcd9bd1c194914bc4bb4216f4e3581a06222de78f026d6796f1da6fe3e0bf28c2d26a102a12ad4fbf13f815944a297f000e3acf46faea42855e07
This commit is contained in:
@@ -25,39 +25,24 @@ FUZZ_TARGET_INIT(connman, initialize_connman)
|
||||
{
|
||||
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
||||
SetMockTime(ConsumeTime(fuzzed_data_provider));
|
||||
CConnman connman{fuzzed_data_provider.ConsumeIntegral<uint64_t>(), fuzzed_data_provider.ConsumeIntegral<uint64_t>(), fuzzed_data_provider.ConsumeBool()};
|
||||
CAddress random_address;
|
||||
CAddrMan addrman;
|
||||
CConnman connman{fuzzed_data_provider.ConsumeIntegral<uint64_t>(), fuzzed_data_provider.ConsumeIntegral<uint64_t>(), addrman, fuzzed_data_provider.ConsumeBool()};
|
||||
CNetAddr random_netaddr;
|
||||
CNode random_node = ConsumeNode(fuzzed_data_provider);
|
||||
CService random_service;
|
||||
CSubNet random_subnet;
|
||||
std::string random_string;
|
||||
while (fuzzed_data_provider.ConsumeBool()) {
|
||||
CallOneOf(
|
||||
fuzzed_data_provider,
|
||||
[&] {
|
||||
random_address = ConsumeAddress(fuzzed_data_provider);
|
||||
},
|
||||
[&] {
|
||||
random_netaddr = ConsumeNetAddr(fuzzed_data_provider);
|
||||
},
|
||||
[&] {
|
||||
random_service = ConsumeService(fuzzed_data_provider);
|
||||
},
|
||||
[&] {
|
||||
random_subnet = ConsumeSubNet(fuzzed_data_provider);
|
||||
},
|
||||
[&] {
|
||||
random_string = fuzzed_data_provider.ConsumeRandomLengthString(64);
|
||||
},
|
||||
[&] {
|
||||
std::vector<CAddress> addresses;
|
||||
while (fuzzed_data_provider.ConsumeBool()) {
|
||||
addresses.push_back(ConsumeAddress(fuzzed_data_provider));
|
||||
}
|
||||
// Limit nTimePenalty to int32_t to avoid signed integer overflow
|
||||
(void)connman.AddNewAddresses(addresses, ConsumeAddress(fuzzed_data_provider), fuzzed_data_provider.ConsumeIntegral<int32_t>());
|
||||
},
|
||||
[&] {
|
||||
connman.AddNode(random_string);
|
||||
},
|
||||
@@ -97,9 +82,6 @@ FUZZ_TARGET_INIT(connman, initialize_connman)
|
||||
[&] {
|
||||
(void)connman.GetNodeCount(fuzzed_data_provider.PickValueInArray({ConnectionDirection::None, ConnectionDirection::In, ConnectionDirection::Out, ConnectionDirection::Both}));
|
||||
},
|
||||
[&] {
|
||||
connman.MarkAddressGood(random_address);
|
||||
},
|
||||
[&] {
|
||||
(void)connman.OutboundTargetReached(fuzzed_data_provider.ConsumeBool());
|
||||
},
|
||||
@@ -127,9 +109,6 @@ FUZZ_TARGET_INIT(connman, initialize_connman)
|
||||
[&] {
|
||||
connman.SetNetworkActive(fuzzed_data_provider.ConsumeBool());
|
||||
},
|
||||
[&] {
|
||||
connman.SetServices(random_service, ConsumeWeakEnum(fuzzed_data_provider, ALL_SERVICE_FLAGS));
|
||||
},
|
||||
[&] {
|
||||
connman.SetTryNewOutboundPeer(fuzzed_data_provider.ConsumeBool());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user