This repository was archived by the owner on Oct 28, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -368,7 +368,7 @@ class Host: public Worker
368368 // / Alias for network communication.
369369 KeyPair m_alias;
370370 // / Host's Ethereum Node Record restored from network.rlp
371- ENR m_restoredENR;
371+ ENR const m_restoredENR;
372372 std::shared_ptr<NodeTable> m_nodeTable; // /< Node table (uses kademlia-like discovery).
373373 mutable std::mutex x_nodeTable;
374374 std::shared_ptr<NodeTable> nodeTable () const { Guard l (x_nodeTable); return m_nodeTable; }
Original file line number Diff line number Diff line change @@ -238,6 +238,23 @@ BOOST_AUTO_TEST_CASE(saveENR)
238238 BOOST_REQUIRE (enr1.signature () == enr2.signature ());
239239}
240240
241+ BOOST_AUTO_TEST_CASE (updateENRfromConfig)
242+ {
243+ NetworkConfig config (" " , " " , 30303 , false );
244+ Host host1 (" Test" , config);
245+ ENR enr1 = host1.enr ();
246+
247+ bytes store (host1.saveNetwork ());
248+
249+ NetworkConfig config2 (" 13.74.189.148" , " " , 30303 , false );
250+ Host host2 (" Test" , config2, bytesConstRef (&store));
251+ host2.start ();
252+ host2.stop ();
253+ ENR enr2 = host2.enr ();
254+
255+ BOOST_REQUIRE_EQUAL (enr2.sequenceNumber (), enr1.sequenceNumber () + 1 );
256+ BOOST_REQUIRE_EQUAL (enr2.ip (), bi::address::from_string (" 13.74.189.148" ));
257+ }
241258
242259BOOST_AUTO_TEST_SUITE_END ()
243260
You can’t perform that action at this time.
0 commit comments