Merge bitcoin/bitcoin#22169: p2p, rpc, fuzz: various tiny follow-ups

c274574458 p2p, rpc, fuzz: various tiny follow-ups (Jon Atack)

Pull request description:

  - p2p: pass `Span` by value per https://github.com/bitcoin/bitcoin/pull/22143#issuecomment-853953438 as a follow-up to 8be56f0f8e
  - rpc: remove duplicate `CAddress` constructor per https://github.com/bitcoin/bitcoin/pull/22043#discussion_r638535703
  - fuzz: rename 3 fuzz targets changed in eba9a94b9f back to their original names per https://github.com/bitcoin-core/qa-assets/pull/63#issuecomment-855281865

ACKs for top commit:
  MarcoFalke:
    cr ACK c274574458
  practicalswift:
    cr ACK c274574458: patch looks correct
  jarolrod:
    ACK  c274574458

Tree-SHA512: 3672b210d30b3a91f3a6455005e4d3cb1f89621820c417c645d24b06e53459440122a1f75758e0e04c3d04eff9d6f88ef62865216aa3e42301c6df783f7c0b4a
This commit is contained in:
fanquake 2021-06-07 13:03:13 +08:00
commit 1cc123f405
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
3 changed files with 5 additions and 5 deletions

View file

@ -594,7 +594,7 @@ static std::string IPv6ToString(Span<const uint8_t> a, uint32_t scope_id)
return r; return r;
} }
static std::string OnionToString(const Span<const uint8_t>& addr) static std::string OnionToString(Span<const uint8_t> addr)
{ {
uint8_t checksum[torv3::CHECKSUM_LEN]; uint8_t checksum[torv3::CHECKSUM_LEN];
torv3::Checksum(addr, checksum); torv3::Checksum(addr, checksum);

View file

@ -939,7 +939,7 @@ static RPCHelpMan addpeeraddress()
bool success{false}; bool success{false};
if (LookupHost(addr_string, net_addr, false)) { if (LookupHost(addr_string, net_addr, false)) {
CAddress address{CAddress({net_addr, port}, ServiceFlags(NODE_NETWORK | NODE_WITNESS))}; CAddress address{{net_addr, port}, ServiceFlags{NODE_NETWORK | NODE_WITNESS}};
address.nTime = GetAdjustedTime(); address.nTime = GetAdjustedTime();
// The source address is set equal to the address. This is equivalent to the peer // The source address is set equal to the address. This is equivalent to the peer
// announcing itself. // announcing itself.

View file

@ -143,7 +143,7 @@ FUZZ_TARGET_DESERIALIZE(script_deserialize, {
CScript script; CScript script;
DeserializeFromFuzzingInput(buffer, script); DeserializeFromFuzzingInput(buffer, script);
}) })
FUZZ_TARGET_DESERIALIZE(subnet_deserialize, { FUZZ_TARGET_DESERIALIZE(sub_net_deserialize, {
CSubNet sub_net_1; CSubNet sub_net_1;
DeserializeFromFuzzingInput(buffer, sub_net_1, INIT_PROTO_VERSION); DeserializeFromFuzzingInput(buffer, sub_net_1, INIT_PROTO_VERSION);
AssertEqualAfterSerializeDeserialize(sub_net_1, INIT_PROTO_VERSION); AssertEqualAfterSerializeDeserialize(sub_net_1, INIT_PROTO_VERSION);
@ -223,7 +223,7 @@ FUZZ_TARGET_DESERIALIZE(coins_deserialize, {
Coin coin; Coin coin;
DeserializeFromFuzzingInput(buffer, coin); DeserializeFromFuzzingInput(buffer, coin);
}) })
FUZZ_TARGET_DESERIALIZE(net_address_deserialize, { FUZZ_TARGET_DESERIALIZE(netaddr_deserialize, {
CNetAddr na; CNetAddr na;
DeserializeFromFuzzingInput(buffer, na); DeserializeFromFuzzingInput(buffer, na);
if (na.IsAddrV1Compatible()) { if (na.IsAddrV1Compatible()) {
@ -231,7 +231,7 @@ FUZZ_TARGET_DESERIALIZE(net_address_deserialize, {
} }
AssertEqualAfterSerializeDeserialize(na, INIT_PROTO_VERSION | ADDRV2_FORMAT); AssertEqualAfterSerializeDeserialize(na, INIT_PROTO_VERSION | ADDRV2_FORMAT);
}) })
FUZZ_TARGET_DESERIALIZE(net_service_deserialize, { FUZZ_TARGET_DESERIALIZE(service_deserialize, {
CService s; CService s;
DeserializeFromFuzzingInput(buffer, s); DeserializeFromFuzzingInput(buffer, s);
if (s.IsAddrV1Compatible()) { if (s.IsAddrV1Compatible()) {