Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Commit c40e6dd

Browse files
committed
Address review issues
1 parent d424f0e commit c40e6dd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

libp2p/ENR.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ template <std::size_t N>
3232
std::array<byte, N> bytesToAddress(bytesConstRef _bytes)
3333
{
3434
std::array<byte, N> address;
35-
std::copy(_bytes.begin(), _bytes.begin() + N, address.begin());
35+
std::copy_n(_bytes.begin(), N, address.begin());
3636
return address;
3737
}
3838
} // namespace
@@ -99,7 +99,7 @@ void ENR::streamContent(RLPStream& _s) const
9999
ENR ENR::update(
100100
std::map<std::string, bytes> const& _keyValuePairs, SignFunction const& _signFunction) const
101101
{
102-
return ENR(m_seq + 1, _keyValuePairs, _signFunction);
102+
return ENR{m_seq + 1, _keyValuePairs, _signFunction};
103103
}
104104

105105
std::string ENR::id() const
@@ -227,8 +227,11 @@ std::ostream& operator<<(std::ostream& _out, ENR const& _enr)
227227

228228
try
229229
{
230-
_out << "key=" << IdentitySchemeV4::publicKey(_enr).abridged() << " ip=" << _enr.ip()
231-
<< " tcp=" << _enr.tcpPort() << " udp=" << _enr.udpPort();
230+
auto const pubKey = IdentitySchemeV4::publicKey(_enr);
231+
auto const address = _enr.ip();
232+
233+
_out << "key=" << pubKey.abridged() << " ip=" << address << " tcp=" << _enr.tcpPort()
234+
<< " udp=" << _enr.udpPort();
232235
}
233236
catch (Exception const&)
234237
{

0 commit comments

Comments
 (0)