Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
97f664e6
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,发现更多精彩内容 >>
提交
97f664e6
编写于
5月 10, 2018
作者:
A
arhag
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bill 5 ms by default for all transactions pushed via tester
上级
7beeb828
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
26 addition
and
17 deletion
+26
-17
libraries/chain/controller.cpp
libraries/chain/controller.cpp
+5
-5
libraries/chain/include/eosio/chain/apply_context.hpp
libraries/chain/include/eosio/chain/apply_context.hpp
+0
-3
libraries/chain/include/eosio/chain/controller.hpp
libraries/chain/include/eosio/chain/controller.hpp
+2
-2
libraries/chain/include/eosio/chain/transaction.hpp
libraries/chain/include/eosio/chain/transaction.hpp
+1
-1
libraries/testing/include/eosio/testing/tester.hpp
libraries/testing/include/eosio/testing/tester.hpp
+4
-2
libraries/testing/tester.cpp
libraries/testing/tester.cpp
+14
-4
未找到文件。
libraries/chain/controller.cpp
浏览文件 @
97f664e6
...
...
@@ -405,7 +405,7 @@ struct controller_impl {
trx_context
.
finalize
();
// Automatically rounds up network and CPU usage in trace and bills payers if successful
auto
restore
=
make_block_restore_point
();
trace
->
receipt
=
push_receipt
(
gto
.
trx_id
,
transaction_receipt
::
soft_fail
,
trace
->
receipt
=
push_receipt
(
gto
.
trx_id
,
transaction_receipt
::
soft_fail
,
trx_context
.
billed_cpu_time_us
,
trace
->
net_usage
);
fc
::
move_append
(
pending
->
_actions
,
move
(
trx_context
.
executed
)
);
...
...
@@ -1062,12 +1062,12 @@ void controller::push_confirmation( const header_confirmation& c ) {
my
->
push_confirmation
(
c
);
}
transaction_trace_ptr
controller
::
push_transaction
(
const
transaction_metadata_ptr
&
trx
,
fc
::
time_point
deadline
)
{
return
my
->
push_transaction
(
trx
,
deadline
,
false
,
0
);
transaction_trace_ptr
controller
::
push_transaction
(
const
transaction_metadata_ptr
&
trx
,
fc
::
time_point
deadline
,
uint32_t
billed_cpu_time_us
)
{
return
my
->
push_transaction
(
trx
,
deadline
,
false
,
billed_cpu_time_us
);
}
transaction_trace_ptr
controller
::
push_scheduled_transaction
(
const
transaction_id_type
&
trxid
,
fc
::
time_point
deadline
)
{
return
my
->
push_scheduled_transaction
(
trxid
,
deadline
,
0
);
transaction_trace_ptr
controller
::
push_scheduled_transaction
(
const
transaction_id_type
&
trxid
,
fc
::
time_point
deadline
,
uint32_t
billed_cpu_time_us
)
{
return
my
->
push_scheduled_transaction
(
trxid
,
deadline
,
billed_cpu_time_us
);
}
uint32_t
controller
::
head_block_num
()
const
{
...
...
libraries/chain/include/eosio/chain/apply_context.hpp
浏览文件 @
97f664e6
...
...
@@ -602,9 +602,6 @@ class apply_context {
action_trace
trace
;
uint64_t
cpu_usage
=
0
;
uint64_t
cpu_usage_limit
=
0
;
private:
iterator_cache
<
key_value_object
>
keyval_cache
;
...
...
libraries/chain/include/eosio/chain/controller.hpp
浏览文件 @
97f664e6
...
...
@@ -85,13 +85,13 @@ namespace eosio { namespace chain {
/**
*
*/
transaction_trace_ptr
push_transaction
(
const
transaction_metadata_ptr
&
trx
,
fc
::
time_point
deadline
);
transaction_trace_ptr
push_transaction
(
const
transaction_metadata_ptr
&
trx
,
fc
::
time_point
deadline
,
uint32_t
billed_cpu_time_us
=
0
);
/**
* Attempt to execute a specific transaction in our deferred trx database
*
*/
transaction_trace_ptr
push_scheduled_transaction
(
const
transaction_id_type
&
scheduled
,
fc
::
time_point
deadline
);
transaction_trace_ptr
push_scheduled_transaction
(
const
transaction_id_type
&
scheduled
,
fc
::
time_point
deadline
,
uint32_t
billed_cpu_time_us
=
0
);
void
finalize_block
();
void
sign_block
(
const
std
::
function
<
signature_type
(
const
digest_type
&
)
>&
signer_callback
);
...
...
libraries/chain/include/eosio/chain/transaction.hpp
浏览文件 @
97f664e6
...
...
@@ -32,7 +32,7 @@ namespace eosio { namespace chain {
uint16_t
ref_block_num
=
0U
;
///< specifies a block num in the last 2^16 blocks.
uint32_t
ref_block_prefix
=
0UL
;
///< specifies the lower 32 bits of the blockid at get_ref_blocknum
fc
::
unsigned_int
max_net_usage_words
=
0UL
;
/// upper limit on total network bandwidth (in 8 byte words) billed for this transaction
uint8_t
max_cpu_usage_ms
=
0
UL
;
/// upper limit on the total number of kilo CPU usage units
billed for this transaction
uint8_t
max_cpu_usage_ms
=
0
;
/// upper limit on the total CPU time
billed for this transaction
fc
::
unsigned_int
delay_sec
=
0UL
;
/// number of seconds to delay this transaction for during which it may be canceled.
/**
...
...
libraries/testing/include/eosio/testing/tester.hpp
浏览文件 @
97f664e6
...
...
@@ -72,6 +72,8 @@ namespace eosio { namespace testing {
static
const
uint32_t
DEFAULT_EXPIRATION_DELTA
=
6
;
static
const
uint32_t
DEFAULT_BILLED_CPU_TIME_US
=
5000
;
void
init
(
bool
push_genesis
=
true
);
void
init
(
controller
::
config
config
);
...
...
@@ -85,8 +87,8 @@ namespace eosio { namespace testing {
void
produce_blocks_until_end_of_round
();
signed_block_ptr
push_block
(
signed_block_ptr
b
);
transaction_trace_ptr
push_transaction
(
packed_transaction
&
trx
,
uint32_t
skip_flag
=
0
/*skip_nothing */
,
fc
::
time_point
deadline
=
fc
::
time_point
::
maximum
()
);
transaction_trace_ptr
push_transaction
(
signed_transaction
&
trx
,
uint32_t
skip_flag
=
0
/*skip_nothing*/
,
fc
::
time_point
deadline
=
fc
::
time_point
::
maximum
()
);
transaction_trace_ptr
push_transaction
(
packed_transaction
&
trx
,
uint32_t
skip_flag
=
0
/*skip_nothing */
,
fc
::
time_point
deadline
=
fc
::
time_point
::
maximum
()
,
uint32_t
billed_cpu_time_us
=
DEFAULT_BILLED_CPU_TIME_US
);
transaction_trace_ptr
push_transaction
(
signed_transaction
&
trx
,
uint32_t
skip_flag
=
0
/*skip_nothing*/
,
fc
::
time_point
deadline
=
fc
::
time_point
::
maximum
()
,
uint32_t
billed_cpu_time_us
=
DEFAULT_BILLED_CPU_TIME_US
);
action_result
push_action
(
action
&&
cert_act
,
uint64_t
authorizer
);
// TODO/QUESTION: Is this needed?
transaction_trace_ptr
push_action
(
const
account_name
&
code
,
...
...
libraries/testing/tester.cpp
浏览文件 @
97f664e6
...
...
@@ -242,16 +242,26 @@ namespace eosio { namespace testing {
return
push_transaction
(
trx
);
}
transaction_trace_ptr
base_tester
::
push_transaction
(
packed_transaction
&
trx
,
uint32_t
skip_flag
,
fc
::
time_point
deadline
)
{
try
{
transaction_trace_ptr
base_tester
::
push_transaction
(
packed_transaction
&
trx
,
uint32_t
skip_flag
,
fc
::
time_point
deadline
,
uint32_t
billed_cpu_time_us
)
{
try
{
if
(
!
control
->
pending_block_state
()
)
_start_block
(
control
->
head_block_time
()
+
fc
::
microseconds
(
config
::
block_interval_us
));
auto
r
=
control
->
push_transaction
(
std
::
make_shared
<
transaction_metadata
>
(
trx
),
deadline
);
auto
r
=
control
->
push_transaction
(
std
::
make_shared
<
transaction_metadata
>
(
trx
),
deadline
,
billed_cpu_time_us
);
if
(
r
->
except_ptr
)
std
::
rethrow_exception
(
r
->
except_ptr
);
if
(
r
->
except
)
throw
*
r
->
except
;
return
r
;
}
FC_CAPTURE_AND_RETHROW
(
(
transaction_header
(
trx
.
get_transaction
()))
)
}
transaction_trace_ptr
base_tester
::
push_transaction
(
signed_transaction
&
trx
,
uint32_t
skip_flag
,
fc
::
time_point
deadline
)
{
try
{
transaction_trace_ptr
base_tester
::
push_transaction
(
signed_transaction
&
trx
,
uint32_t
skip_flag
,
fc
::
time_point
deadline
,
uint32_t
billed_cpu_time_us
)
{
try
{
if
(
!
control
->
pending_block_state
()
)
_start_block
(
control
->
head_block_time
()
+
fc
::
microseconds
(
config
::
block_interval_us
));
auto
c
=
packed_transaction
::
none
;
...
...
@@ -262,7 +272,7 @@ namespace eosio { namespace testing {
c
=
packed_transaction
::
zlib
;
}
auto
r
=
control
->
push_transaction
(
std
::
make_shared
<
transaction_metadata
>
(
trx
,
c
),
deadline
);
auto
r
=
control
->
push_transaction
(
std
::
make_shared
<
transaction_metadata
>
(
trx
,
c
),
deadline
,
billed_cpu_time_us
);
if
(
r
->
except_ptr
)
std
::
rethrow_exception
(
r
->
except_ptr
);
if
(
r
->
except
)
throw
*
r
->
except
;
return
r
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录