Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
e5dfe2fc
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,发现更多精彩内容 >>
提交
e5dfe2fc
编写于
12月 07, 2017
作者:
P
Pravin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
STAT-205, STAT-198, STAT-197
上级
59cc5e08
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
3 deletion
+30
-3
programs/eosc/main.cpp
programs/eosc/main.cpp
+30
-3
未找到文件。
programs/eosc/main.cpp
浏览文件 @
e5dfe2fc
...
...
@@ -65,6 +65,7 @@ Options:
#include <string>
#include <vector>
#include <boost/asio.hpp>
#include <boost/format.hpp>
#include <iostream>
#include <fc/variant.hpp>
#include <fc/io/json.hpp>
...
...
@@ -717,7 +718,7 @@ int main( int argc, char** argv ) {
auto
producerSubcommand
=
setSubcommand
->
add_subcommand
(
"producer"
,
localized
(
"Approve/unapprove producer"
));
producerSubcommand
->
require_subcommand
();
auto
approveCommand
=
producerSubcommand
->
add_subcommand
(
"approve"
,
localized
(
"Approve producer"
));
auto
unapproveCommand
=
producerSubcommand
->
add_subcommand
(
"unapprove"
,
localized
(
"Unapprove producer"
));
producerSubcommand
->
add_subcommand
(
"unapprove"
,
localized
(
"Unapprove producer"
));
producerSubcommand
->
add_option
(
"user-name"
,
account_name
,
localized
(
"The name of the account approving"
))
->
required
();
producerSubcommand
->
add_option
(
"producer-name"
,
producer
,
localized
(
"The name of the producer to approve"
))
->
required
();
producerSubcommand
->
add_option
(
"-p,--permission"
,
permissions
,
...
...
@@ -959,15 +960,33 @@ int main( int argc, char** argv ) {
benchmark_setup
->
add_option
(
"owner"
,
owner_key
,
localized
(
"The owner key to use for account creation"
))
->
required
();
benchmark_setup
->
add_option
(
"active"
,
active_key
,
localized
(
"The active key to use for account creation"
))
->
required
();
add_standard_transaction_options
(
benchmark_setup
);
benchmark_setup
->
set_callback
([
&
]{
auto
controlling_account_arg
=
fc
::
mutable_variant_object
(
"controlling_account"
,
string
(
"inita"
));
auto
response_servants
=
call
(
get_controlled_accounts_func
,
controlling_account_arg
);
fc
::
variant_object
response_var
;
fc
::
from_variant
(
response_servants
,
response_var
);
std
::
vector
<
std
::
string
>
controlled_accounts_vec
;
fc
::
from_variant
(
response_var
[
"controlled_accounts"
],
controlled_accounts_vec
);
long
num_existing_accounts
=
std
::
count_if
(
controlled_accounts_vec
.
begin
(),
controlled_accounts_vec
.
end
(),
[](
auto
const
&
s
)
{
return
s
.
find
(
"benchmark"
)
!=
std
::
string
::
npos
;});
boost
::
format
fmter
(
"%1% accounts already exist"
);
fmter
%
num_existing_accounts
;
EOSC_ASSERT
(
number_of_accounts
>
num_existing_accounts
,
fmter
.
str
().
c_str
());
number_of_accounts
-=
num_existing_accounts
;
std
::
cerr
<<
localized
(
"Creating ${number_of_accounts} accounts with initial balances"
,
(
"number_of_accounts"
,
number_of_accounts
))
<<
std
::
endl
;
EOSC_ASSERT
(
number_of_accounts
>=
2
,
"must create at least 2 accounts"
);
if
(
num_existing_accounts
==
0
)
{
EOSC_ASSERT
(
number_of_accounts
>=
2
,
"must create at least 2 accounts"
);
}
auto
info
=
get_info
();
vector
<
signed_transaction
>
batch
;
batch
.
reserve
(
number_of_accounts
);
for
(
uint32_t
i
=
0
;
i
<
number_of_accounts
;
++
i
)
{
for
(
uint32_t
i
=
num_existing_accounts
;
i
<
num_existing_accounts
+
number_of_accounts
;
++
i
)
{
name
newaccount
(
name
(
"benchmark"
).
value
+
i
);
public_key_type
owner
(
owner_key
),
active
(
active_key
);
name
creator
(
"inita"
);
...
...
@@ -988,6 +1007,7 @@ int main( int argc, char** argv ) {
transaction_set_reference_block
(
trx
,
info
.
head_block_id
);
sign_transaction
(
trx
);
batch
.
emplace_back
(
trx
);
info
=
get_info
();
}
auto
result
=
call
(
push_txns_func
,
batch
);
std
::
cout
<<
fc
::
json
::
to_pretty_string
(
result
)
<<
std
::
endl
;
...
...
@@ -1068,6 +1088,13 @@ int main( int argc, char** argv ) {
info
=
get_info
();
}
}
if
(
batch
.
size
()
>
0
)
{
auto
result
=
call
(
push_txns_func
,
batch
);
std
::
cout
<<
fc
::
json
::
to_pretty_string
(
result
)
<<
std
::
endl
;
batch
.
resize
(
0
);
info
=
get_info
();
}
if
(
!
loop
)
break
;
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录