Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
d07fab8c
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,发现更多精彩内容 >>
提交
d07fab8c
编写于
5月 24, 2018
作者:
A
arhag
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename set_active_producers to set_proposed_producers
上级
8160042f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
24 addition
and
15 deletion
+24
-15
contracts/eosio.bios/eosio.bios.hpp
contracts/eosio.bios/eosio.bios.hpp
+1
-1
contracts/eosio.system/voting.cpp
contracts/eosio.system/voting.cpp
+5
-5
contracts/eosiolib/privileged.h
contracts/eosiolib/privileged.h
+8
-1
libraries/chain/controller.cpp
libraries/chain/controller.cpp
+7
-5
libraries/chain/include/eosio/chain/controller.hpp
libraries/chain/include/eosio/chain/controller.hpp
+1
-1
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+2
-2
未找到文件。
contracts/eosio.bios/eosio.bios.hpp
浏览文件 @
d07fab8c
...
@@ -28,7 +28,7 @@ namespace eosio {
...
@@ -28,7 +28,7 @@ namespace eosio {
require_auth
(
_self
);
require_auth
(
_self
);
char
buffer
[
action_data_size
()];
char
buffer
[
action_data_size
()];
read_action_data
(
buffer
,
sizeof
(
buffer
)
);
// should be the same data as eosio::pack(schedule)
read_action_data
(
buffer
,
sizeof
(
buffer
)
);
// should be the same data as eosio::pack(schedule)
set_
active
_producers
(
buffer
,
sizeof
(
buffer
));
set_
proposed
_producers
(
buffer
,
sizeof
(
buffer
));
}
}
void
reqauth
(
action_name
from
)
{
void
reqauth
(
action_name
from
)
{
...
...
contracts/eosio.system/voting.cpp
浏览文件 @
d07fab8c
...
@@ -34,7 +34,7 @@ namespace eosiosystem {
...
@@ -34,7 +34,7 @@ namespace eosiosystem {
* @pre authority of producer to register
* @pre authority of producer to register
*
*
*/
*/
void
system_contract
::
regproducer
(
const
account_name
producer
,
const
eosio
::
public_key
&
producer_key
,
const
std
::
string
&
url
,
uint16_t
location
)
{
void
system_contract
::
regproducer
(
const
account_name
producer
,
const
eosio
::
public_key
&
producer_key
,
const
std
::
string
&
url
,
uint16_t
location
)
{
eosio_assert
(
url
.
size
()
<
512
,
"url too long"
);
eosio_assert
(
url
.
size
()
<
512
,
"url too long"
);
require_auth
(
producer
);
require_auth
(
producer
);
...
@@ -96,7 +96,7 @@ namespace eosiosystem {
...
@@ -96,7 +96,7 @@ namespace eosiosystem {
top_producers
.
emplace_back
(
std
::
pair
<
eosio
::
producer_key
,
uint16_t
>
({{
it
->
owner
,
it
->
producer_key
},
it
->
location
}));
top_producers
.
emplace_back
(
std
::
pair
<
eosio
::
producer_key
,
uint16_t
>
({{
it
->
owner
,
it
->
producer_key
},
it
->
location
}));
}
}
/// sort by producer name
/// sort by producer name
...
@@ -114,7 +114,7 @@ namespace eosiosystem {
...
@@ -114,7 +114,7 @@ namespace eosiosystem {
if
(
new_id
!=
_gstate
.
last_producer_schedule_id
)
{
if
(
new_id
!=
_gstate
.
last_producer_schedule_id
)
{
_gstate
.
last_producer_schedule_id
=
new_id
;
_gstate
.
last_producer_schedule_id
=
new_id
;
set_
active
_producers
(
packed_schedule
.
data
(),
packed_schedule
.
size
()
);
set_
proposed
_producers
(
packed_schedule
.
data
(),
packed_schedule
.
size
()
);
}
}
_gstate
.
last_producer_schedule_update
=
block_time
;
_gstate
.
last_producer_schedule_update
=
block_time
;
}
}
...
@@ -133,7 +133,7 @@ namespace eosiosystem {
...
@@ -133,7 +133,7 @@ namespace eosiosystem {
* @pre voter must have previously staked some EOS for voting
* @pre voter must have previously staked some EOS for voting
* @pre voter->staked must be up to date
* @pre voter->staked must be up to date
*
*
* @post every producer previously voted for will have vote reduced by previous vote weight
* @post every producer previously voted for will have vote reduced by previous vote weight
* @post every producer newly voted for will have vote increased by new vote amount
* @post every producer newly voted for will have vote increased by new vote amount
* @post prior proxy will proxied_vote_weight decremented by previous vote weight
* @post prior proxy will proxied_vote_weight decremented by previous vote weight
* @post new proxy will proxied_vote_weight incremented by new vote weight
* @post new proxy will proxied_vote_weight incremented by new vote weight
...
@@ -245,7 +245,7 @@ namespace eosiosystem {
...
@@ -245,7 +245,7 @@ namespace eosiosystem {
/**
/**
* An account marked as a proxy can vote with the weight of other accounts which
* An account marked as a proxy can vote with the weight of other accounts which
* have selected it as a proxy. Other accounts must refresh their voteproducer to
* have selected it as a proxy. Other accounts must refresh their voteproducer to
* update the proxy's weight.
* update the proxy's weight.
*
*
* @param isproxy - true if proxy wishes to vote on behalf of others, false otherwise
* @param isproxy - true if proxy wishes to vote on behalf of others, false otherwise
* @pre proxy must have something staked (existing row in voters table)
* @pre proxy must have something staked (existing row in voters table)
...
...
contracts/eosiolib/privileged.h
浏览文件 @
d07fab8c
...
@@ -20,7 +20,14 @@ extern "C" {
...
@@ -20,7 +20,14 @@ extern "C" {
void
set_resource_limits
(
account_name
account
,
int64_t
ram_bytes
,
int64_t
net_weight
,
int64_t
cpu_weight
);
void
set_resource_limits
(
account_name
account
,
int64_t
ram_bytes
,
int64_t
net_weight
,
int64_t
cpu_weight
);
bool
set_active_producers
(
char
*
producer_data
,
uint32_t
producer_data_size
);
/**
* Propose the new active producer schedule
* @param producer_data - packed data of produce_keys in the appropriate producer schedule order
* @param producer_data_size - size of the data buffer
*
* @return -1 if setting proposing a new producer schedule was unsuccessful, other returns the version of the new proposed schedule
*/
int64_t
set_proposed_producers
(
char
*
producer_data
,
uint32_t
producer_data_size
);
bool
is_privileged
(
account_name
account
);
bool
is_privileged
(
account_name
account
);
...
...
libraries/chain/controller.cpp
浏览文件 @
d07fab8c
...
@@ -1218,17 +1218,17 @@ void controller::pop_block() {
...
@@ -1218,17 +1218,17 @@ void controller::pop_block() {
my
->
pop_block
();
my
->
pop_block
();
}
}
bool
controller
::
set_proposed_producers
(
vector
<
producer_key
>
producers
)
{
int64_t
controller
::
set_proposed_producers
(
vector
<
producer_key
>
producers
)
{
const
auto
&
gpo
=
get_global_properties
();
const
auto
&
gpo
=
get_global_properties
();
auto
cur_block_num
=
head_block_num
()
+
1
;
auto
cur_block_num
=
head_block_num
()
+
1
;
if
(
gpo
.
proposed_schedule_block_num
.
valid
()
)
{
if
(
gpo
.
proposed_schedule_block_num
.
valid
()
)
{
if
(
*
gpo
.
proposed_schedule_block_num
!=
cur_block_num
)
if
(
*
gpo
.
proposed_schedule_block_num
!=
cur_block_num
)
return
false
;
// there is already a proposed schedule set in a previous block, wait for it to become pending
return
-
1
;
// there is already a proposed schedule set in a previous block, wait for it to become pending
if
(
std
::
equal
(
producers
.
begin
(),
producers
.
end
(),
if
(
std
::
equal
(
producers
.
begin
(),
producers
.
end
(),
gpo
.
proposed_schedule
.
producers
.
begin
(),
gpo
.
proposed_schedule
.
producers
.
end
()
)
)
gpo
.
proposed_schedule
.
producers
.
begin
(),
gpo
.
proposed_schedule
.
producers
.
end
()
)
)
return
false
;
// the proposed producer schedule does not change
return
-
1
;
// the proposed producer schedule does not change
}
}
producer_schedule_type
sch
;
producer_schedule_type
sch
;
...
@@ -1249,15 +1249,17 @@ bool controller::set_proposed_producers( vector<producer_key> producers ) {
...
@@ -1249,15 +1249,17 @@ bool controller::set_proposed_producers( vector<producer_key> producers ) {
}
}
if
(
std
::
equal
(
producers
.
begin
(),
producers
.
end
(),
begin
,
end
)
)
if
(
std
::
equal
(
producers
.
begin
(),
producers
.
end
(),
begin
,
end
)
)
return
false
;
// the producer schedule would not change
return
-
1
;
// the producer schedule would not change
sch
.
producers
=
std
::
move
(
producers
);
sch
.
producers
=
std
::
move
(
producers
);
int64_t
version
=
sch
.
version
;
my
->
db
.
modify
(
gpo
,
[
&
](
auto
&
gp
)
{
my
->
db
.
modify
(
gpo
,
[
&
](
auto
&
gp
)
{
gp
.
proposed_schedule_block_num
=
cur_block_num
;
gp
.
proposed_schedule_block_num
=
cur_block_num
;
gp
.
proposed_schedule
=
std
::
move
(
sch
);
gp
.
proposed_schedule
=
std
::
move
(
sch
);
});
});
return
true
;
return
version
;
}
}
const
producer_schedule_type
&
controller
::
active_producers
()
const
{
const
producer_schedule_type
&
controller
::
active_producers
()
const
{
...
...
libraries/chain/include/eosio/chain/controller.hpp
浏览文件 @
d07fab8c
...
@@ -148,7 +148,7 @@ namespace eosio { namespace chain {
...
@@ -148,7 +148,7 @@ namespace eosio { namespace chain {
void
validate_expiration
(
const
transaction
&
t
)
const
;
void
validate_expiration
(
const
transaction
&
t
)
const
;
void
validate_tapos
(
const
transaction
&
t
)
const
;
void
validate_tapos
(
const
transaction
&
t
)
const
;
bool
set_proposed_producers
(
vector
<
producer_key
>
producers
);
int64_t
set_proposed_producers
(
vector
<
producer_key
>
producers
);
bool
skip_auth_check
()
const
;
bool
skip_auth_check
()
const
;
...
...
libraries/chain/wasm_interface.cpp
浏览文件 @
d07fab8c
...
@@ -145,7 +145,7 @@ class privileged_api : public context_aware_api {
...
@@ -145,7 +145,7 @@ class privileged_api : public context_aware_api {
context
.
control
.
get_resource_limits_manager
().
get_account_limits
(
account
,
ram_bytes
,
net_weight
,
cpu_weight
);
context
.
control
.
get_resource_limits_manager
().
get_account_limits
(
account
,
ram_bytes
,
net_weight
,
cpu_weight
);
}
}
bool
set_active
_producers
(
array_ptr
<
char
>
packed_producer_schedule
,
size_t
datalen
)
{
int64_t
set_proposed
_producers
(
array_ptr
<
char
>
packed_producer_schedule
,
size_t
datalen
)
{
datastream
<
const
char
*>
ds
(
packed_producer_schedule
,
datalen
);
datastream
<
const
char
*>
ds
(
packed_producer_schedule
,
datalen
);
vector
<
producer_key
>
producers
;
vector
<
producer_key
>
producers
;
fc
::
raw
::
unpack
(
ds
,
producers
);
fc
::
raw
::
unpack
(
ds
,
producers
);
...
@@ -1684,7 +1684,7 @@ REGISTER_INTRINSICS(privileged_api,
...
@@ -1684,7 +1684,7 @@ REGISTER_INTRINSICS(privileged_api,
(
activate_feature
,
void
(
int64_t
)
)
(
activate_feature
,
void
(
int64_t
)
)
(
get_resource_limits
,
void
(
int64_t
,
int
,
int
,
int
)
)
(
get_resource_limits
,
void
(
int64_t
,
int
,
int
,
int
)
)
(
set_resource_limits
,
void
(
int64_t
,
int64_t
,
int64_t
,
int64_t
)
)
(
set_resource_limits
,
void
(
int64_t
,
int64_t
,
int64_t
,
int64_t
)
)
(
set_
active_producers
,
int
(
int
,
int
)
)
(
set_
proposed_producers
,
int64_t
(
int
,
int
)
)
(
get_blockchain_parameters_packed
,
int
(
int
,
int
)
)
(
get_blockchain_parameters_packed
,
int
(
int
,
int
)
)
(
set_blockchain_parameters_packed
,
void
(
int
,
int
)
)
(
set_blockchain_parameters_packed
,
void
(
int
,
int
)
)
(
is_privileged
,
int
(
int64_t
)
)
(
is_privileged
,
int
(
int64_t
)
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录