Helper function to create a node out of the network (#3921)
This commit is contained in:
parent
de16a87d71
commit
931fe423a3
2 changed files with 11 additions and 0 deletions
|
|
@ -23,3 +23,11 @@ std::shared_ptr<nano::transport::channel_tcp> nano::test::establish_tcp (nano::t
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<nano::node> nano::test::add_outer_node (nano::test::system & system_a, uint16_t port_a)
|
||||||
|
{
|
||||||
|
auto outer_node = std::make_shared<nano::node> (system_a.io_ctx, port_a, nano::unique_path (), system_a.logging, system_a.work);
|
||||||
|
outer_node->start ();
|
||||||
|
system_a.nodes.push_back (outer_node);
|
||||||
|
return outer_node;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <nano/node/common.hpp>
|
#include <nano/node/common.hpp>
|
||||||
|
#include <nano/test_common/system.hpp>
|
||||||
|
|
||||||
namespace nano
|
namespace nano
|
||||||
{
|
{
|
||||||
|
|
@ -17,5 +18,7 @@ namespace test
|
||||||
class system;
|
class system;
|
||||||
/** Waits until a TCP connection is established and returns the TCP channel on success*/
|
/** Waits until a TCP connection is established and returns the TCP channel on success*/
|
||||||
std::shared_ptr<nano::transport::channel_tcp> establish_tcp (nano::test::system &, nano::node &, nano::endpoint const &);
|
std::shared_ptr<nano::transport::channel_tcp> establish_tcp (nano::test::system &, nano::node &, nano::endpoint const &);
|
||||||
|
/** Adds a node to the system without establishing connections */
|
||||||
|
std::shared_ptr<nano::node> add_outer_node (nano::test::system & system, uint16_t port_a = nano::test::get_available_port ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue