Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
09d16d94
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,发现更多精彩内容 >>
提交
09d16d94
编写于
5月 17, 2018
作者:
A
Andrianto Lie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add additional unit test for bootseq_tests
上级
e4980b1e
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
228 addition
and
209 deletion
+228
-209
libraries/testing/include/eosio/testing/tester.hpp
libraries/testing/include/eosio/testing/tester.hpp
+3
-0
libraries/testing/tester.cpp
libraries/testing/tester.cpp
+26
-1
unittests/bootseq_tests.cpp
unittests/bootseq_tests.cpp
+199
-208
未找到文件。
libraries/testing/include/eosio/testing/tester.hpp
浏览文件 @
09d16d94
...
...
@@ -85,6 +85,9 @@ namespace eosio { namespace testing {
virtual
signed_block_ptr
produce_empty_block
(
fc
::
microseconds
skip_time
=
fc
::
milliseconds
(
config
::
block_interval_ms
),
uint32_t
skip_flag
=
0
/*skip_missed_block_penalty*/
)
=
0
;
void
produce_blocks
(
uint32_t
n
=
1
,
bool
empty
=
false
);
void
produce_blocks_until_end_of_round
();
void
produce_blocks_for_n_rounds
(
const
uint32_t
num_of_rounds
=
1
);
// Produce minimal number of blocks as possible to spend the given time without having any producer become inactive
void
produce_min_num_of_blocks_to_spend_time_wo_inactive_prod
(
const
fc
::
microseconds
target_elapsed_time
=
fc
::
microseconds
());
signed_block_ptr
push_block
(
signed_block_ptr
b
);
transaction_trace_ptr
push_transaction
(
packed_transaction
&
trx
,
fc
::
time_point
deadline
=
fc
::
time_point
::
maximum
(),
uint32_t
billed_cpu_time_us
=
DEFAULT_BILLED_CPU_TIME_US
);
...
...
libraries/testing/tester.cpp
浏览文件 @
09d16d94
...
...
@@ -180,11 +180,36 @@ namespace eosio { namespace testing {
void
base_tester
::
produce_blocks_until_end_of_round
()
{
while
(
control
->
pending_block_state
()
->
has_pending_producers
()
)
{
uint64_t
blocks_per_round
;
while
(
true
)
{
blocks_per_round
=
control
->
active_producers
().
producers
.
size
()
*
config
::
producer_repetitions
;
produce_block
();
if
(
control
->
head_block_num
()
%
blocks_per_round
==
(
blocks_per_round
-
1
))
break
;
}
}
void
base_tester
::
produce_blocks_for_n_rounds
(
const
uint32_t
num_of_rounds
)
{
for
(
uint32_t
i
=
0
;
i
<
num_of_rounds
;
i
++
)
{
produce_blocks_until_end_of_round
();
}
}
void
base_tester
::
produce_min_num_of_blocks_to_spend_time_wo_inactive_prod
(
const
fc
::
microseconds
target_elapsed_time
)
{
fc
::
microseconds
elapsed_time
;
while
(
elapsed_time
<
target_elapsed_time
)
{
for
(
uint32_t
i
=
0
;
i
<
control
->
head_block_state
()
->
active_schedule
.
producers
.
size
();
i
++
)
{
const
auto
time_to_skip
=
fc
::
milliseconds
(
config
::
producer_repetitions
*
config
::
block_interval_ms
);
produce_block
(
time_to_skip
);
elapsed_time
+=
time_to_skip
;
}
// if it is more than 24 hours, producer will be marked as inactive
const
auto
time_to_skip
=
fc
::
seconds
(
23
*
60
*
60
);
produce_block
(
time_to_skip
);
elapsed_time
+=
time_to_skip
;
}
}
void
base_tester
::
set_transaction_headers
(
signed_transaction
&
trx
,
uint32_t
expiration
,
uint32_t
delay_sec
)
const
{
trx
.
expiration
=
control
->
head_block_time
()
+
fc
::
seconds
(
expiration
);
...
...
unittests/bootseq_tests.cpp
浏览文件 @
09d16d94
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录