Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
5bff35cc
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5bff35cc
编写于
9月 13, 2017
作者:
D
Daniel Larimer
提交者:
GitHub
9月 13, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #420 from EOSIO/p2p-launcher-updates-396
P2p launcher updates 396
上级
73a41588
9c05d051
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
5 deletion
+31
-5
programs/launcher/main.cpp
programs/launcher/main.cpp
+31
-5
未找到文件。
programs/launcher/main.cpp
浏览文件 @
5bff35cc
...
...
@@ -205,6 +205,7 @@ struct launcher_def {
bf
::
path
genesis
;
bf
::
path
output
;
bool
skip_transaction_signatures
=
false
;
string
eosd_extra_args
;
testnet_def
network
;
string
data_dir_base
;
string
alias_base
;
...
...
@@ -236,7 +237,9 @@ launcher_def::set_options (bpo::options_description &cli) {
(
"shape,s"
,
bpo
::
value
<
string
>
()
->
default_value
(
"ring"
),
"network topology, use
\"
ring
\"
\"
star
\"
\"
mesh
\"
or give a filename for custom"
)
(
"genesis,g"
,
bpo
::
value
<
bf
::
path
>
()
->
default_value
(
"./genesis.json"
),
"set the path to genesis.json"
)
(
"output,o"
,
bpo
::
value
<
bf
::
path
>
(),
"save a copy of the generated topology in this file"
)
(
"skip-signature"
,
bpo
::
bool_switch
()
->
default_value
(
false
),
"EOSD does not require transaction signatures."
);
(
"skip-signature"
,
bpo
::
bool_switch
()
->
default_value
(
false
),
"EOSD does not require transaction signatures."
)
(
"eosd"
,
bpo
::
value
<
string
>
(),
"forward eosd command line argument(s) to each instance of eosd, enclose arg in quotes"
)
;
}
void
...
...
@@ -253,6 +256,8 @@ launcher_def::initialize (const variables_map &vmap) {
output
=
vmap
[
"output"
].
as
<
bf
::
path
>
();
if
(
vmap
.
count
(
"skip-signature"
))
skip_transaction_signatures
=
vmap
[
"skip-signature"
].
as
<
bool
>
();
if
(
vmap
.
count
(
"eosd"
))
eosd_extra_args
=
vmap
[
"eosd"
].
as
<
string
>
();
producers
=
21
;
data_dir_base
=
"tn_data_"
;
...
...
@@ -380,6 +385,7 @@ launcher_def::write_config_file (eosd_def &node) {
}
cfg
<<
"plugin = eos::producer_plugin
\n
"
<<
"plugin = eos::chain_api_plugin
\n
"
<<
"plugin = eos::wallet_api_plugin
\n
"
<<
"plugin = eos::account_history_plugin
\n
"
<<
"plugin = eos::account_history_api_plugin
\n
"
;
for
(
auto
&
p
:
node
.
producers
)
{
...
...
@@ -445,8 +451,12 @@ launcher_def::make_star () {
}
size_t
gap
=
total_nodes
>
6
?
4
:
total_nodes
-
links
;
// use to prevent duplicates since all connections are bidirectional
std
::
map
<
string
,
std
::
set
<
string
>>
peers_to_from
;
for
(
size_t
i
=
0
;
i
<
total_nodes
;
i
++
)
{
auto
&
current
=
network
.
nodes
.
find
(
aliases
[
i
])
->
second
;
const
auto
&
iter
=
network
.
nodes
.
find
(
aliases
[
i
]);
auto
&
current
=
iter
->
second
;
const
auto
&
current_name
=
iter
->
first
;
for
(
size_t
l
=
1
;
l
<=
links
;
l
++
)
{
size_t
ndx
=
(
i
+
l
*
gap
)
%
total_nodes
;
if
(
i
==
ndx
)
{
...
...
@@ -463,7 +473,12 @@ launcher_def::make_star () {
}
}
}
current
.
peers
.
push_back
(
peer
);
// if already established, don't add to list
if
(
peers_to_from
[
peer
].
count
(
current_name
)
==
0
)
{
current
.
peers
.
push_back
(
peer
);
// current_name -> peer
// keep track of bidirectional relationships to prevent duplicates
peers_to_from
[
current_name
].
insert
(
peer
);
}
}
}
}
...
...
@@ -471,11 +486,21 @@ launcher_def::make_star () {
void
launcher_def
::
make_mesh
()
{
define_nodes
();
// use to prevent duplicates since all connections are bidirectional
std
::
map
<
string
,
std
::
set
<
string
>>
peers_to_from
;
for
(
size_t
i
=
0
;
i
<
total_nodes
;
i
++
)
{
auto
&
current
=
network
.
nodes
.
find
(
aliases
[
i
])
->
second
;
const
auto
&
iter
=
network
.
nodes
.
find
(
aliases
[
i
]);
auto
&
current
=
iter
->
second
;
const
auto
&
current_name
=
iter
->
first
;
for
(
size_t
j
=
1
;
j
<
total_nodes
;
j
++
)
{
size_t
ndx
=
(
i
+
j
)
%
total_nodes
;
current
.
peers
.
push_back
(
aliases
[
ndx
]);
const
auto
&
peer
=
aliases
[
ndx
];
// if already established, don't add to list
if
(
peers_to_from
[
peer
].
count
(
current_name
)
==
0
)
{
current
.
peers
.
push_back
(
peer
);
// keep track of bidirectional relationships to prevent duplicates
peers_to_from
[
current_name
].
insert
(
peer
);
}
}
}
}
...
...
@@ -554,6 +579,7 @@ launcher_def::launch (eosd_def &node, string >s) {
if
(
skip_transaction_signatures
)
{
eosdcmd
+=
"--skip-transaction-signatures "
;
}
eosdcmd
+=
eosd_extra_args
+
" "
;
eosdcmd
+=
"--data-dir "
+
node
.
data_dir
;
if
(
gts
.
length
())
{
eosdcmd
+=
" --genesis-timestamp "
+
gts
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录