Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
afc1d048
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,发现更多精彩内容 >>
提交
afc1d048
编写于
5月 07, 2018
作者:
A
Anton Perkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cleos listproducers #2807
上级
85b2948e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
65 addition
and
6 deletion
+65
-6
contracts/eosio.system/eosio.system.abi
contracts/eosio.system/eosio.system.abi
+8
-5
contracts/eosio.system/eosio.system.hpp
contracts/eosio.system/eosio.system.hpp
+2
-1
contracts/eosio.system/voting.cpp
contracts/eosio.system/voting.cpp
+2
-0
programs/cleos/main.cpp
programs/cleos/main.cpp
+53
-0
未找到文件。
contracts/eosio.system/eosio.system.abi
浏览文件 @
afc1d048
...
...
@@ -132,10 +132,13 @@
"base": "",
"fields": [
{"name":"owner", "type":"account_name"},
{"name":"total_votes", "type":"uint128"},
{"name":"packed_key", "type":"public_key"},
{"name":"per_block_payments", "type":"uint64"},
{"name":"last_claim_time", "type":"time"}
{"name":"total_votes", "type":"float64"},
{"name":"producer_key", "type":"public_key"},
{"name":"url", "type":"string"},
{"name":"last_rewards_claim", "type":"uint32"},
{"name":"location", "type":"uint16"},
{"name":"time_became_active", "type":"uint32"},
{"name":"time_produced_block_time", "type":"uint32"}
]
},{
"name": "regproducer",
...
...
@@ -247,7 +250,7 @@
}
],
"tables": [{
"name": "producer
info
",
"name": "producer
s
",
"type": "producer_info",
"index_type": "i64",
"key_names" : ["owner"],
...
...
contracts/eosio.system/eosio.system.hpp
浏览文件 @
afc1d048
...
...
@@ -50,6 +50,7 @@ namespace eosiosystem {
account_name
owner
;
double
total_votes
=
0
;
eosio
::
public_key
producer_key
;
/// a packed public key object
std
::
string
url
;
uint32_t
produced_blocks
;
time
last_rewards_claim
=
0
;
uint16_t
location
=
0
;
...
...
@@ -61,7 +62,7 @@ namespace eosiosystem {
bool
active
()
const
{
return
producer_key
!=
public_key
();
}
// explicit serialization macro is not necessary, used here only to improve compilation time
EOSLIB_SERIALIZE
(
producer_info
,
(
owner
)(
total_votes
)(
producer_key
)
EOSLIB_SERIALIZE
(
producer_info
,
(
owner
)(
total_votes
)(
producer_key
)
(
url
)
(
produced_blocks
)(
last_rewards_claim
)
(
time_became_active
)(
last_produced_block_time
)
)
};
...
...
contracts/eosio.system/voting.cpp
浏览文件 @
afc1d048
...
...
@@ -45,6 +45,7 @@ namespace eosiosystem {
if
(
producer_key
!=
prod
->
producer_key
)
{
_producers
.
modify
(
prod
,
producer
,
[
&
](
producer_info
&
info
){
info
.
producer_key
=
producer_key
;
info
.
url
=
url
;
});
}
}
else
{
...
...
@@ -52,6 +53,7 @@ namespace eosiosystem {
info
.
owner
=
producer
;
info
.
total_votes
=
0
;
info
.
producer_key
=
producer_key
;
info
.
url
=
url
;
});
}
}
...
...
programs/cleos/main.cpp
浏览文件 @
afc1d048
...
...
@@ -823,6 +823,57 @@ struct vote_producers_subcommand {
}
};
struct
list_producers_subcommand
{
bool
print_json
;
bool
sort_names
;
bool
sort_votes
;
list_producers_subcommand
(
CLI
::
App
*
actionRoot
)
{
auto
list_producers
=
actionRoot
->
add_subcommand
(
"listproducers"
,
localized
(
"List producers"
));
list_producers
->
add_flag
(
"--json,-j"
,
print_json
,
localized
(
"Output in JSON format"
)
);
list_producers
->
add_flag
(
"--sort-account-names,-n"
,
sort_votes
,
localized
(
"Sort by account names (default order is by votes)"
)
);
list_producers
->
set_callback
([
this
]
{
auto
result
=
call
(
get_table_func
,
fc
::
mutable_variant_object
(
"json"
,
true
)
(
"code"
,
name
(
config
::
system_account_name
).
to_string
())
(
"scope"
,
name
(
config
::
system_account_name
).
to_string
())
(
"table"
,
"producers"
)
);
if
(
!
print_json
)
{
auto
res
=
result
.
as
<
eosio
::
chain_apis
::
read_only
::
get_table_rows_result
>
();
std
::
vector
<
std
::
tuple
<
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
>>
v
;
for
(
auto
&
row
:
res
.
rows
)
{
auto
&
r
=
row
.
get_object
();
v
.
push_back
({
r
[
"owner"
].
as_string
(),
r
[
"total_votes"
].
as_string
(),
r
[
"producer_key"
].
as_string
(),
r
[
"url"
].
as_string
()
});
}
if
(
!
v
.
empty
()
)
{
if
(
sort_names
)
{
std
::
sort
(
v
.
begin
(),
v
.
end
(),
[](
auto
a
,
auto
b
)
{
return
std
::
get
<
0
>
(
a
)
<
std
::
get
<
0
>
(
b
);
}
);
}
else
{
std
::
sort
(
v
.
begin
(),
v
.
end
(),
[](
auto
a
,
auto
b
)
{
return
std
::
get
<
1
>
(
a
)
<
std
::
get
<
1
>
(
b
)
||
(
std
::
get
<
1
>
(
a
)
==
std
::
get
<
1
>
(
b
)
&&
std
::
get
<
0
>
(
a
)
<
std
::
get
<
0
>
(
b
));
}
);
}
std
::
cout
<<
std
::
left
<<
std
::
setw
(
14
)
<<
"Producer"
<<
std
::
setw
(
55
)
<<
"Producer key"
<<
std
::
setw
(
50
)
<<
"Url"
<<
"Total votes"
<<
std
::
endl
;
for
(
auto
&
x
:
v
)
{
std
::
cout
<<
std
::
left
<<
std
::
setw
(
14
)
<<
std
::
get
<
0
>
(
x
)
<<
std
::
setw
(
55
)
<<
std
::
get
<
2
>
(
x
)
<<
std
::
setw
(
50
)
<<
std
::
get
<
3
>
(
x
)
<<
std
::
get
<
1
>
(
x
)
<<
std
::
endl
;
}
}
else
{
std
::
cout
<<
"No producers found"
<<
std
::
endl
;
}
}
else
{
std
::
cout
<<
fc
::
json
::
to_pretty_string
(
result
)
<<
std
::
endl
;
}
}
);
}
};
struct
delegate_bandwidth_subcommand
{
string
from_str
;
string
receiver_str
;
...
...
@@ -2117,6 +2168,8 @@ int main( int argc, char** argv ) {
auto
voteProxy
=
vote_producer_proxy_subcommand
(
voteProducer
);
auto
voteProducers
=
vote_producers_subcommand
(
voteProducer
);
auto
listProducers
=
list_producers_subcommand
(
system
);
auto
delegateBandWidth
=
delegate_bandwidth_subcommand
(
system
);
auto
undelegateBandWidth
=
undelegate_bandwidth_subcommand
(
system
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录