Skip to content

Commit e1afcec

Browse files
heifnerspoonincode
authored andcommitted
Merge pull request EOSIO#698 from EOSIO/p2p-sync-vs-newblocks-697
P2p sync vs newblocks 697 (reapplied on noon branch)
1 parent 281a7ca commit e1afcec

File tree

9 files changed

+155
-201
lines changed

9 files changed

+155
-201
lines changed

mesh.dot

+47-66
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,49 @@
11
digraph G
2-
{
3-
inita->initb [dir="both"]
4-
inita->initc [dir="both"]
5-
inita->initd [dir="both"]
6-
inita->inite [dir="both"]
7-
inita->initf [dir="both"]
8-
inita->initg [dir="both"]
9-
inita->inith [dir="both"]
10-
inita->initi [dir="both"]
11-
inita->initj [dir="both"]
12-
inita->initk [dir="both"]
13-
14-
initb->initc [dir="both"]
15-
initb->initd [dir="both"]
16-
initb->inite [dir="both"]
17-
initb->initf [dir="both"]
18-
initb->initg [dir="both"]
19-
initb->inith [dir="both"]
20-
initb->initi [dir="both"]
21-
initb->initj [dir="both"]
22-
initb->initk [dir="both"]
23-
24-
initc->initd [dir="both"]
25-
initc->inite [dir="both"]
26-
initc->initf [dir="both"]
27-
initc->initg [dir="both"]
28-
initc->inith [dir="both"]
29-
initc->initi [dir="both"]
30-
initc->initj [dir="both"]
31-
initc->initk [dir="both"]
32-
33-
initd->inite [dir="both"]
34-
initd->initf [dir="both"]
35-
initd->initg [dir="both"]
36-
initd->inith [dir="both"]
37-
initd->initi [dir="both"]
38-
initd->initj [dir="both"]
39-
initd->initk [dir="both"]
40-
41-
inite->initf [dir="both"]
42-
inite->initg [dir="both"]
43-
inite->inith [dir="both"]
44-
inite->initi [dir="both"]
45-
inite->initj [dir="both"]
46-
inite->initk [dir="both"]
47-
48-
initf->initg [dir="both"]
49-
initf->inith [dir="both"]
50-
initf->initi [dir="both"]
51-
initf->initj [dir="both"]
52-
initf->initk [dir="both"]
53-
54-
initg->inith [dir="both"]
55-
initg->initi [dir="both"]
56-
initg->initj [dir="both"]
57-
initg->initk [dir="both"]
58-
59-
inith->initi [dir="both"]
60-
inith->initj [dir="both"]
61-
inith->initk [dir="both"]
62-
63-
initi->initj [dir="both"]
64-
initi->initk [dir="both"]
65-
66-
initj->initk [dir="both"]
2+
{
3+
layout="circo";
4+
"testnet_0\nprod=inita,initk,initu"->"testnet_1\nprod=initb,initl" [dir="forward"];
5+
"testnet_0\nprod=inita,initk,initu"->"testnet_2\nprod=initc,initm" [dir="forward"];
6+
"testnet_0\nprod=inita,initk,initu"->"testnet_3\nprod=initd,initn" [dir="forward"];
7+
"testnet_0\nprod=inita,initk,initu"->"testnet_4\nprod=inite,inito" [dir="forward"];
8+
"testnet_0\nprod=inita,initk,initu"->"testnet_5\nprod=initf,initp" [dir="forward"];
9+
"testnet_0\nprod=inita,initk,initu"->"testnet_6\nprod=initg,initq" [dir="forward"];
10+
"testnet_0\nprod=inita,initk,initu"->"testnet_7\nprod=inith,initr" [dir="forward"];
11+
"testnet_0\nprod=inita,initk,initu"->"testnet_8\nprod=initi,inits" [dir="forward"];
12+
"testnet_0\nprod=inita,initk,initu"->"testnet_9\nprod=initj,initt" [dir="forward"];
13+
"testnet_1\nprod=initb,initl"->"testnet_2\nprod=initc,initm" [dir="forward"];
14+
"testnet_1\nprod=initb,initl"->"testnet_3\nprod=initd,initn" [dir="forward"];
15+
"testnet_1\nprod=initb,initl"->"testnet_4\nprod=inite,inito" [dir="forward"];
16+
"testnet_1\nprod=initb,initl"->"testnet_5\nprod=initf,initp" [dir="forward"];
17+
"testnet_1\nprod=initb,initl"->"testnet_6\nprod=initg,initq" [dir="forward"];
18+
"testnet_1\nprod=initb,initl"->"testnet_7\nprod=inith,initr" [dir="forward"];
19+
"testnet_1\nprod=initb,initl"->"testnet_8\nprod=initi,inits" [dir="forward"];
20+
"testnet_1\nprod=initb,initl"->"testnet_9\nprod=initj,initt" [dir="forward"];
21+
"testnet_2\nprod=initc,initm"->"testnet_3\nprod=initd,initn" [dir="forward"];
22+
"testnet_2\nprod=initc,initm"->"testnet_4\nprod=inite,inito" [dir="forward"];
23+
"testnet_2\nprod=initc,initm"->"testnet_5\nprod=initf,initp" [dir="forward"];
24+
"testnet_2\nprod=initc,initm"->"testnet_6\nprod=initg,initq" [dir="forward"];
25+
"testnet_2\nprod=initc,initm"->"testnet_7\nprod=inith,initr" [dir="forward"];
26+
"testnet_2\nprod=initc,initm"->"testnet_8\nprod=initi,inits" [dir="forward"];
27+
"testnet_2\nprod=initc,initm"->"testnet_9\nprod=initj,initt" [dir="forward"];
28+
"testnet_3\nprod=initd,initn"->"testnet_4\nprod=inite,inito" [dir="forward"];
29+
"testnet_3\nprod=initd,initn"->"testnet_5\nprod=initf,initp" [dir="forward"];
30+
"testnet_3\nprod=initd,initn"->"testnet_6\nprod=initg,initq" [dir="forward"];
31+
"testnet_3\nprod=initd,initn"->"testnet_7\nprod=inith,initr" [dir="forward"];
32+
"testnet_3\nprod=initd,initn"->"testnet_8\nprod=initi,inits" [dir="forward"];
33+
"testnet_3\nprod=initd,initn"->"testnet_9\nprod=initj,initt" [dir="forward"];
34+
"testnet_4\nprod=inite,inito"->"testnet_5\nprod=initf,initp" [dir="forward"];
35+
"testnet_4\nprod=inite,inito"->"testnet_6\nprod=initg,initq" [dir="forward"];
36+
"testnet_4\nprod=inite,inito"->"testnet_7\nprod=inith,initr" [dir="forward"];
37+
"testnet_4\nprod=inite,inito"->"testnet_8\nprod=initi,inits" [dir="forward"];
38+
"testnet_4\nprod=inite,inito"->"testnet_9\nprod=initj,initt" [dir="forward"];
39+
"testnet_5\nprod=initf,initp"->"testnet_6\nprod=initg,initq" [dir="forward"];
40+
"testnet_5\nprod=initf,initp"->"testnet_7\nprod=inith,initr" [dir="forward"];
41+
"testnet_5\nprod=initf,initp"->"testnet_8\nprod=initi,inits" [dir="forward"];
42+
"testnet_5\nprod=initf,initp"->"testnet_9\nprod=initj,initt" [dir="forward"];
43+
"testnet_6\nprod=initg,initq"->"testnet_7\nprod=inith,initr" [dir="forward"];
44+
"testnet_6\nprod=initg,initq"->"testnet_8\nprod=initi,inits" [dir="forward"];
45+
"testnet_6\nprod=initg,initq"->"testnet_9\nprod=initj,initt" [dir="forward"];
46+
"testnet_7\nprod=inith,initr"->"testnet_8\nprod=initi,inits" [dir="forward"];
47+
"testnet_7\nprod=inith,initr"->"testnet_9\nprod=initj,initt" [dir="forward"];
48+
"testnet_8\nprod=initi,inits"->"testnet_9\nprod=initj,initt" [dir="forward"];
6749
}
68-

mesh.png

208 KB
Loading

plugins/net_plugin/net_plugin.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -2136,10 +2136,10 @@ namespace eosio {
21362136
void net_plugin::set_program_options( options_description& /*cli*/, options_description& cfg )
21372137
{
21382138
cfg.add_options()
2139-
( "listen-endpoint", bpo::value<string>()->default_value( "0.0.0.0:9876" ), "The local IP address and port to listen for incoming connections.")
2140-
( "remote-endpoint", bpo::value< vector<string> >()->composing(), "The IP address and port of a remote peer to sync with.")
2141-
( "public-endpoint", bpo::value<string>(), "Overrides the advertised listen endpointlisten ip address.")
2142-
( "agent-name", bpo::value<string>()->default_value("EOS Test Agent"), "The name supplied to identify this node amongst the peers.")
2139+
( "listen-endpoint", bpo::value<string>()->default_value( "0.0.0.0:9876" ), "The actual host:port used to listen for incoming p2p connections.")
2140+
( "public-endpoint", bpo::value<string>(), "An externally accessible host:port for identifying this node. Defaults to listen-endpoint.")
2141+
( "remote-endpoint", bpo::value< vector<string> >()->composing(), "The public endpoint of a peer node to connect to. Use multiple remote-endpoint options as needed to compose a network.")
2142+
( "agent-name", bpo::value<string>()->default_value("\"EOS Test Agent\""), "The name supplied to identify this node amongst the peers.")
21432143
( "send-whole-blocks", bpo::value<bool>()->default_value(def_send_whole_blocks), "True to always send full blocks, false to send block summaries" )
21442144
( "allowed-connection", bpo::value<vector<string>>()->multitoken()->default_value({"none"}, "none"), "Can be 'any' or 'producers' or 'specified' or 'none'. If 'specified', peer-key must be specified at least once. If only 'producers', peer-key is not required. 'producers' and 'specified' may be combined.")
21452145
( "peer-key", bpo::value<vector<string>>()->composing()->multitoken(), "Optional public key of peer allowed to connect. May be used multiple times.")

plugins/producer_plugin/producer_plugin.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ void producer_plugin::set_program_options(
8484
fc::json::to_string(private_key_default)),
8585
"Tuple of [public key, WIF private key] (may specify multiple times)")
8686
;
87-
88-
command_line_options.add(producer_options);
8987
config_file_options.add(producer_options);
9088
}
9189

@@ -257,11 +255,6 @@ block_production_condition::block_production_condition_enum producer_plugin_impl
257255
// If the next block production opportunity is in the present or future, we're synced.
258256
if( !_production_enabled )
259257
{
260-
#if 0
261-
if( app().get_plugin<net_plugin>().num_peers() == 0 ) {
262-
_production_enabled = true;
263-
}
264-
#endif
265258
if( chain.get_slot_time(1) >= now )
266259
_production_enabled = true;
267260
else

programs/launcher/main.cpp

+8-16
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,10 @@ struct launcher_def {
311311
int start_delay;
312312
bool nogen;
313313
string launch_name;
314+
bool random_start;
314315

315316
void assign_name (eosd_def &node);
316-
317+
317318
void set_options (bpo::options_description &cli);
318319
void initialize (const variables_map &vmap);
319320
bool generate ();
@@ -347,6 +348,7 @@ launcher_def::set_options (bpo::options_description &cli) {
347348
("delay,d",bpo::value<int>(&start_delay)->default_value(0),"seconds delay before starting each node after the first")
348349
("nogen",bpo::bool_switch(&nogen)->default_value(false),"launch nodes without writing new config files")
349350
("host-map",bpo::value<bf::path>(&host_map_file)->default_value(""),"a file containing mapping specific nodes to hosts. Used to enhance the custom shape argument")
351+
("random", bpo::bool_switch(&random_start)->default_value(false),"start the nodes in a random order")
350352
;
351353
}
352354

@@ -612,30 +614,19 @@ launcher_def::write_config_file (tn_node_def &node) {
612614
cfg << "remote-endpoint = " << network.nodes.find(p)->second.instance->p2p_endpoint << "\n";
613615
}
614616
if (node.producers.size()) {
615-
cfg << "enable-stale-production = false\n"
616-
<< "required-participation = true\n";
617+
cfg << "required-participation = true\n";
617618
for (const auto &kp : node.keys ) {
618619
cfg << "private-key = [\"" << kp.public_key
619620
<< "\",\"" << kp.wif_private_key << "\"]\n";
620621
}
621-
cfg << "plugin = eosio::producer_plugin\n"
622-
<< "plugin = eosio::chain_api_plugin\n"
623-
<< "plugin = eosio::wallet_api_plugin\n"
624-
<< "plugin = eosio::db_plugin\n"
625-
<< "plugin = eosio::account_history_plugin\n"
626-
<< "plugin = eosio::account_history_api_plugin\n";
627622
for (auto &p : node.producers) {
628623
cfg << "producer-name = " << p << "\n";
629624
}
630-
}
631-
if( instance.has_db ) {
632-
if( !node.producers.size() ) {
633-
cfg << "plugin = eosio::producer_plugin\n";
634-
}
635-
cfg << "plugin = eosio::db_plugin\n";
625+
cfg << "plugin = eosio::producer_plugin\n";
636626
}
637627
cfg << "plugin = eosio::chain_api_plugin\n"
638628
<< "plugin = eosio::wallet_api_plugin\n"
629+
<< "plugin = eosio::db_plugin\n"
639630
<< "plugin = eosio::account_history_plugin\n"
640631
<< "plugin = eosio::account_history_api_plugin\n";
641632
cfg.close();
@@ -843,6 +834,7 @@ launcher_def::launch (eosd_def &node, string &gts) {
843834
eosdcmd += "--skip-transaction-signatures ";
844835
}
845836
eosdcmd += eosd_extra_args + " ";
837+
eosdcmd += "--enable-stale-production true ";
846838
eosdcmd += "--data-dir " + node.data_dir;
847839
if (gts.length()) {
848840
eosdcmd += " --genesis-timestamp " + gts;
@@ -929,7 +921,7 @@ launcher_def::start_all (string &gts, launch_modes mode) {
929921
case LM_REMOTE:
930922
case LM_LOCAL: {
931923
for (auto &h : host_map.bindings ) {
932-
if (mode == LM_ALL ||
924+
if (!random_start && mode == LM_ALL ||
933925
(h.second.is_local() ? mode == LM_LOCAL : mode == LM_REMOTE)) {
934926
for (auto &inst : h.second.instances) {
935927
try {

star.dot

+32-42
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,34 @@
11
digraph G
2-
{
3-
inita->initb [dir="both"]
4-
inita->initd [dir="both"]
5-
inita->initf [dir="both"]
6-
inita->inith [dir="both"]
7-
inita->initj [dir="both"]
8-
9-
initb->initc [dir="both"]
10-
initb->inite [dir="both"]
11-
initb->initg [dir="both"]
12-
initb->initi [dir="both"]
13-
initb->initk [dir="both"]
14-
15-
initc->initd [dir="both"]
16-
initc->initf [dir="both"]
17-
initc->inith [dir="both"]
18-
initc->initj [dir="both"]
19-
20-
initd->inite [dir="both"]
21-
initd->initg [dir="both"]
22-
initd->initi [dir="both"]
23-
initd->initk [dir="both"]
24-
25-
inite->initf [dir="both"]
26-
inite->inith [dir="both"]
27-
inite->initj [dir="both"]
28-
29-
initf->initg [dir="both"]
30-
initf->initi [dir="both"]
31-
initf->initk [dir="both"]
32-
33-
initg->inith [dir="both"]
34-
initg->initj [dir="both"]
35-
36-
inith->initi [dir="both"]
37-
inith->initk [dir="both"]
38-
39-
initi->initj [dir="both"]
40-
initi->initk [dir="both"]
41-
42-
initj->initk [dir="both"]
2+
{
3+
layout="circo";
4+
"testnet_0\nprod=inita,initk,initu"->"testnet_3\nprod=initd,initn" [dir="forward"];
5+
"testnet_0\nprod=inita,initk,initu"->"testnet_6\nprod=initg,initq" [dir="forward"];
6+
"testnet_0\nprod=inita,initk,initu"->"testnet_9\nprod=initj,initt" [dir="forward"];
7+
"testnet_1\nprod=initb,initl"->"testnet_4\nprod=inite,inito" [dir="forward"];
8+
"testnet_1\nprod=initb,initl"->"testnet_7\nprod=inith,initr" [dir="forward"];
9+
"testnet_1\nprod=initb,initl"->"testnet_0\nprod=inita,initk,initu" [dir="forward"];
10+
"testnet_2\nprod=initc,initm"->"testnet_5\nprod=initf,initp" [dir="forward"];
11+
"testnet_2\nprod=initc,initm"->"testnet_8\nprod=initi,inits" [dir="forward"];
12+
"testnet_2\nprod=initc,initm"->"testnet_1\nprod=initb,initl" [dir="forward"];
13+
"testnet_3\nprod=initd,initn"->"testnet_6\nprod=initg,initq" [dir="forward"];
14+
"testnet_3\nprod=initd,initn"->"testnet_9\nprod=initj,initt" [dir="forward"];
15+
"testnet_3\nprod=initd,initn"->"testnet_2\nprod=initc,initm" [dir="forward"];
16+
"testnet_4\nprod=inite,inito"->"testnet_7\nprod=inith,initr" [dir="forward"];
17+
"testnet_4\nprod=inite,inito"->"testnet_0\nprod=inita,initk,initu" [dir="forward"];
18+
"testnet_4\nprod=inite,inito"->"testnet_3\nprod=initd,initn" [dir="forward"];
19+
"testnet_5\nprod=initf,initp"->"testnet_8\nprod=initi,inits" [dir="forward"];
20+
"testnet_5\nprod=initf,initp"->"testnet_1\nprod=initb,initl" [dir="forward"];
21+
"testnet_5\nprod=initf,initp"->"testnet_4\nprod=inite,inito" [dir="forward"];
22+
"testnet_6\nprod=initg,initq"->"testnet_9\nprod=initj,initt" [dir="forward"];
23+
"testnet_6\nprod=initg,initq"->"testnet_2\nprod=initc,initm" [dir="forward"];
24+
"testnet_6\nprod=initg,initq"->"testnet_5\nprod=initf,initp" [dir="forward"];
25+
"testnet_7\nprod=inith,initr"->"testnet_0\nprod=inita,initk,initu" [dir="forward"];
26+
"testnet_7\nprod=inith,initr"->"testnet_3\nprod=initd,initn" [dir="forward"];
27+
"testnet_7\nprod=inith,initr"->"testnet_6\nprod=initg,initq" [dir="forward"];
28+
"testnet_8\nprod=initi,inits"->"testnet_1\nprod=initb,initl" [dir="forward"];
29+
"testnet_8\nprod=initi,inits"->"testnet_4\nprod=inite,inito" [dir="forward"];
30+
"testnet_8\nprod=initi,inits"->"testnet_7\nprod=inith,initr" [dir="forward"];
31+
"testnet_9\nprod=initj,initt"->"testnet_2\nprod=initc,initm" [dir="forward"];
32+
"testnet_9\nprod=initj,initt"->"testnet_5\nprod=initf,initp" [dir="forward"];
33+
"testnet_9\nprod=initj,initt"->"testnet_8\nprod=initi,inits" [dir="forward"];
4334
}
44-

star.png

108 KB
Loading

0 commit comments

Comments
 (0)