Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
9270660b
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,发现更多精彩内容 >>
提交
9270660b
编写于
5月 03, 2018
作者:
B
Bart Wyatt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clean up and organizational changes
上级
0aa56848
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
12 deletion
+16
-12
libraries/chain/block_header_state.cpp
libraries/chain/block_header_state.cpp
+7
-7
libraries/chain/include/eosio/chain/block_header_state.hpp
libraries/chain/include/eosio/chain/block_header_state.hpp
+3
-5
libraries/chain/include/eosio/chain/config.hpp
libraries/chain/include/eosio/chain/config.hpp
+5
-0
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+1
-0
未找到文件。
libraries/chain/block_header_state.cpp
浏览文件 @
9270660b
...
...
@@ -85,7 +85,6 @@ namespace eosio { namespace chain {
result
.
block_num
=
block_num
+
1
;
result
.
producer_to_last_produced
=
producer_to_last_produced
;
result
.
producer_to_last_produced
[
prokey
.
producer_name
]
=
result
.
block_num
;
// result.dpos_irreversible_blocknum = result.calc_dpos_last_irreversible();
result
.
blockroot_merkle
=
blockroot_merkle
;
result
.
blockroot_merkle
.
append
(
id
);
...
...
@@ -114,20 +113,21 @@ namespace eosio { namespace chain {
}
/// grow the confirmed count
uint8_t
required_confs
=
(
result
.
active_schedule
.
producers
.
size
()
*
2
/
3
)
+
1
;
if
(
confirm_count
.
size
()
<
1024
)
{
static_assert
(
std
::
numeric_limits
<
uint8_t
>::
max
()
>=
(
config
::
max_producers
*
2
/
3
)
+
1
,
"8bit confirmations may not be able to hold all of the needed confirmations"
);
auto
num_active_producers
=
result
.
active_schedule
.
producers
.
size
();
uint32_t
required_confs
=
(
uint32_t
)(
num_active_producers
*
2
/
3
)
+
1
;
if
(
confirm_count
.
size
()
<
config
::
maximum_tracked_dpos_confirmations
)
{
result
.
confirm_count
.
reserve
(
confirm_count
.
size
()
+
1
);
result
.
confirm_count
=
confirm_count
;
result
.
confirm_count
.
resize
(
confirm_count
.
size
()
+
1
);
result
.
confirm_count
.
back
()
=
required_confs
;
result
.
confirm_count
.
back
()
=
(
uint8_t
)
required_confs
;
}
else
{
result
.
confirm_count
.
resize
(
confirm_count
.
size
()
);
memcpy
(
&
result
.
confirm_count
[
0
],
&
confirm_count
[
1
],
confirm_count
.
size
()
-
1
);
result
.
confirm_count
.
back
()
=
required_confs
;
result
.
confirm_count
.
back
()
=
(
uint8_t
)
required_confs
;
}
return
result
;
}
/// generate_next
...
...
libraries/chain/include/eosio/chain/block_header_state.hpp
浏览文件 @
9270660b
...
...
@@ -22,16 +22,14 @@ struct block_header_state {
flat_map
<
account_name
,
uint32_t
>
producer_to_last_produced
;
public_key_type
block_signing_key
;
vector
<
uint8_t
>
confirm_count
;
vector
<
header_confirmation
>
confirmations
;
block_header_state
next
(
const
signed_block_header
&
h
)
const
;
block_header_state
generate_next
(
block_timestamp_type
when
)
const
;
void
set_new_producers
(
producer_schedule_type
next_pending
);
void
set_confirmed
(
uint16_t
num_prev_blocks
);
void
add_confirmation
(
const
header_confirmation
&
c
);
vector
<
header_confirmation
>
confirmations
;
bool
has_pending_producers
()
const
{
return
pending_schedule
.
producers
.
size
();
}
...
...
@@ -57,8 +55,8 @@ struct block_header_state {
}
}
/// namespace eosio::chain
FC_REFLECT
(
eosio
::
chain
::
block_header_state
,
(
id
)(
block_num
)(
header
)(
dpos_irreversible_blocknum
)
(
id
)(
block_num
)(
header
)(
dpos_irreversible_blocknum
)
(
bft_irreversible_blocknum
)
(
pending_schedule_lib_num
)(
pending_schedule_hash
)
(
pending_schedule
)(
active_schedule
)(
blockroot_merkle
)
(
producer_to_last_produced
)(
block_signing_key
)
(
bft_irreversible_blocknum
)(
confirmations
)
)
(
confirm_count
)(
confirmations
)
)
libraries/chain/include/eosio/chain/config.hpp
浏览文件 @
9270660b
...
...
@@ -98,6 +98,11 @@ const static eosio::chain::wasm_interface::vm_type default_wasm_runtime = eosio:
* The number of sequential blocks produced by a single producer
*/
const
static
int
producer_repetitions
=
12
;
const
static
int
max_producers
=
125
;
const
static
size_t
maximum_tracked_dpos_confirmations
=
1024
;
///<
static_assert
(
maximum_tracked_dpos_confirmations
>=
((
max_producers
*
2
/
3
)
+
1
)
*
producer_repetitions
,
"Settings never allow for DPOS irreversibility"
);
/**
* The number of blocks produced per round is based upon all producers having a chance
...
...
libraries/chain/wasm_interface.cpp
浏览文件 @
9270660b
...
...
@@ -145,6 +145,7 @@ class privileged_api : public context_aware_api {
datastream
<
const
char
*>
ds
(
packed_producer_schedule
,
datalen
);
vector
<
producer_key
>
producers
;
fc
::
raw
::
unpack
(
ds
,
producers
);
EOS_ASSERT
(
producers
.
size
()
<=
config
::
max_producers
,
wasm_execution_error
,
"Producer schedule exceeds the maximum producer count for this chain"
);
// check that producers are unique
std
::
set
<
account_name
>
unique_producers
;
for
(
const
auto
&
p
:
producers
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录