Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
f71d490b
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,发现更多精彩内容 >>
提交
f71d490b
编写于
12月 12, 2018
作者:
K
Kevin Heifner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Start transaction signature earily in thread pool
上级
4a4a80a1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
6 deletion
+25
-6
libraries/chain/include/eosio/chain/transaction_metadata.hpp
libraries/chain/include/eosio/chain/transaction_metadata.hpp
+1
-1
libraries/chain/transaction.cpp
libraries/chain/transaction.cpp
+3
-2
libraries/chain/transaction_metadata.cpp
libraries/chain/transaction_metadata.cpp
+7
-1
plugins/producer_plugin/producer_plugin.cpp
plugins/producer_plugin/producer_plugin.cpp
+14
-2
未找到文件。
libraries/chain/include/eosio/chain/transaction_metadata.hpp
浏览文件 @
f71d490b
...
...
@@ -51,7 +51,7 @@ class transaction_metadata {
const
flat_set
<
public_key_type
>&
recover_keys
(
const
chain_id_type
&
chain_id
);
static
void
create_signing_keys_future
(
transaction_metadata_ptr
&
mtrx
,
static
void
create_signing_keys_future
(
const
transaction_metadata_ptr
&
mtrx
,
boost
::
asio
::
thread_pool
&
thread_pool
,
const
chain_id_type
&
chain_id
);
uint32_t
total_actions
()
const
{
return
trx
.
context_free_actions
.
size
()
+
trx
.
actions
.
size
();
}
...
...
libraries/chain/transaction.cpp
浏览文件 @
f71d490b
...
...
@@ -95,9 +95,10 @@ flat_set<public_key_type> transaction::get_signature_keys( const vector<signatur
public_key_type
recov
;
if
(
use_cache
)
{
recovery_cache_type
::
index
<
by_sig
>::
type
::
iterator
it
=
recovery_cache
.
get
<
by_sig
>
().
find
(
sig
);
if
(
it
==
recovery_cache
.
get
<
by_sig
>
().
end
()
||
it
->
trx_id
!=
id
())
{
const
auto
&
tid
=
id
();
if
(
it
==
recovery_cache
.
get
<
by_sig
>
().
end
()
||
it
->
trx_id
!=
tid
)
{
recov
=
public_key_type
(
sig
,
digest
);
recovery_cache
.
emplace_back
(
cached_pub_key
{
id
()
,
recov
,
sig
}
);
//could fail on dup signatures; not a problem
recovery_cache
.
emplace_back
(
cached_pub_key
{
tid
,
recov
,
sig
}
);
//could fail on dup signatures; not a problem
}
else
{
recov
=
it
->
pub_key
;
}
...
...
libraries/chain/transaction_metadata.cpp
浏览文件 @
f71d490b
...
...
@@ -19,8 +19,14 @@ const flat_set<public_key_type>& transaction_metadata::recover_keys( const chain
return
signing_keys
->
second
;
}
void
transaction_metadata
::
create_signing_keys_future
(
transaction_metadata_ptr
&
mtrx
,
void
transaction_metadata
::
create_signing_keys_future
(
const
transaction_metadata_ptr
&
mtrx
,
boost
::
asio
::
thread_pool
&
thread_pool
,
const
chain_id_type
&
chain_id
)
{
if
(
mtrx
->
signing_keys
&&
mtrx
->
signing_keys
->
first
==
chain_id
)
return
;
if
(
mtrx
->
signing_keys
.
valid
()
)
// already created
return
;
std
::
weak_ptr
<
transaction_metadata
>
mtrx_wp
=
mtrx
;
mtrx
->
signing_keys_future
=
async_thread_pool
(
thread_pool
,
[
chain_id
,
mtrx_wp
]()
{
auto
mtrx
=
mtrx_wp
.
lock
();
...
...
plugins/producer_plugin/producer_plugin.cpp
浏览文件 @
f71d490b
...
...
@@ -346,6 +346,18 @@ class producer_plugin_impl : public std::enable_shared_from_this<producer_plugin
std
::
deque
<
std
::
tuple
<
transaction_metadata_ptr
,
bool
,
next_function
<
transaction_trace_ptr
>>>
_pending_incoming_transactions
;
void
on_incoming_transaction_async
(
const
transaction_metadata_ptr
&
trx
,
bool
persist_until_expired
,
next_function
<
transaction_trace_ptr
>
next
)
{
chain
::
controller
&
chain
=
chain_plug
->
chain
();
transaction_metadata
::
create_signing_keys_future
(
trx
,
chain
.
get_thread_pool
(),
chain
.
get_chain_id
()
);
boost
::
asio
::
post
(
chain
.
get_thread_pool
(),
[
self
=
this
,
trx
,
persist_until_expired
,
next
]()
{
if
(
trx
->
signing_keys_future
.
valid
()
)
trx
->
signing_keys_future
.
wait
();
app
().
get_io_service
().
post
(
[
self
,
trx
,
persist_until_expired
,
next
]()
{
self
->
process_incoming_transaction_async
(
trx
,
persist_until_expired
,
next
);
});
});
}
void
process_incoming_transaction_async
(
const
transaction_metadata_ptr
&
trx
,
bool
persist_until_expired
,
next_function
<
transaction_trace_ptr
>
next
)
{
chain
::
controller
&
chain
=
chain_plug
->
chain
();
if
(
!
chain
.
pending_block_state
())
{
_pending_incoming_transactions
.
emplace_back
(
trx
,
persist_until_expired
,
next
);
...
...
@@ -1245,7 +1257,7 @@ producer_plugin_impl::start_block_result producer_plugin_impl::start_block(bool
_pending_incoming_transactions
.
pop_front
();
--
orig_pending_txn_size
;
_incoming_trx_weight
-=
1.0
;
on
_incoming_transaction_async
(
std
::
get
<
0
>
(
e
),
std
::
get
<
1
>
(
e
),
std
::
get
<
2
>
(
e
));
process
_incoming_transaction_async
(
std
::
get
<
0
>
(
e
),
std
::
get
<
1
>
(
e
),
std
::
get
<
2
>
(
e
));
}
if
(
block_time
<=
fc
::
time_point
::
now
())
{
...
...
@@ -1308,7 +1320,7 @@ producer_plugin_impl::start_block_result producer_plugin_impl::start_block(bool
auto
e
=
_pending_incoming_transactions
.
front
();
_pending_incoming_transactions
.
pop_front
();
--
orig_pending_txn_size
;
on
_incoming_transaction_async
(
std
::
get
<
0
>
(
e
),
std
::
get
<
1
>
(
e
),
std
::
get
<
2
>
(
e
));
process
_incoming_transaction_async
(
std
::
get
<
0
>
(
e
),
std
::
get
<
1
>
(
e
),
std
::
get
<
2
>
(
e
));
if
(
block_time
<=
fc
::
time_point
::
now
())
return
start_block_result
::
exhausted
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录