mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
Merge abbc17048a into merged_master (Elements PR #1432)
This commit is contained in:
commit
a41021b283
7 changed files with 69 additions and 60 deletions
|
|
@ -670,10 +670,13 @@ BOOST_AUTO_TEST_CASE(get_local_addr_for_peer_port)
|
|||
const uint16_t bind_port = 20001;
|
||||
m_node.args->ForceSetArg("-bind", strprintf("3.4.5.6:%u", bind_port));
|
||||
|
||||
const auto current_time{Now<NodeSeconds>()};
|
||||
SetMockTime(current_time.time_since_epoch());
|
||||
|
||||
// Our address:port as seen from the peer, completely different from the above.
|
||||
in_addr peer_us_addr;
|
||||
peer_us_addr.s_addr = htonl(0x02030405);
|
||||
const CService peer_us{peer_us_addr, 20002};
|
||||
const CAddress peer_us{CService{peer_us_addr, 20002}, NODE_NETWORK, current_time};
|
||||
|
||||
// Create a peer with a routable IPv4 address (outbound).
|
||||
in_addr peer_out_in_addr;
|
||||
|
|
@ -693,7 +696,7 @@ BOOST_AUTO_TEST_CASE(get_local_addr_for_peer_port)
|
|||
// Without the fix peer_us:8333 is chosen instead of the proper peer_us:bind_port.
|
||||
auto chosen_local_addr = GetLocalAddrForPeer(peer_out);
|
||||
BOOST_REQUIRE(chosen_local_addr);
|
||||
const CService expected{peer_us_addr, bind_port};
|
||||
const CAddress expected{CService{peer_us_addr, bind_port}, NODE_NETWORK, current_time};
|
||||
BOOST_CHECK(*chosen_local_addr == expected);
|
||||
|
||||
// Create a peer with a routable IPv4 address (inbound).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue