Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
62807d66
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,发现更多精彩内容 >>
提交
62807d66
编写于
2月 16, 2018
作者:
P
Phil Mesnier
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#1329, dawn 567, fix for initializing the signed_block for validation from the signed_block_summary
上级
b7979782
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
35 addition
and
18 deletion
+35
-18
libraries/chain/include/eosio/chain/block.hpp
libraries/chain/include/eosio/chain/block.hpp
+12
-5
plugins/net_plugin/net_plugin.cpp
plugins/net_plugin/net_plugin.cpp
+23
-13
未找到文件。
libraries/chain/include/eosio/chain/block.hpp
浏览文件 @
62807d66
...
...
@@ -81,22 +81,22 @@ namespace eosio { namespace chain {
*
* The primary purpose of a block is to define the order in which messages are processed.
*
* The secodnary purpose of a block is certify that the messages are valid according to
* The secodnary purpose of a block is certify that the messages are valid according to
* a group of 3rd party validators (producers).
*
* The next purpose of a block is to enable light-weight proofs that a transaction occured
* and was considered valid.
*
* The next purpose is to enable code to generate messages that are certified by the
* producers to be authorized.
* producers to be authorized.
*
* A block is therefore defined by the ordered set of executed and generated transactions,
* and the merkle proof is over set of messages delivered as a result of executing the
* transactions.
* transactions.
*
* A message is defined by { receiver, code, function, permission, data }, the merkle
* tree of a block should be generated over a set of message IDs rather than a set of
* transaction ids.
* transaction ids.
*/
struct
signed_block_summary
:
public
signed_block_header
{
vector
<
region_summary
>
regions
;
...
...
@@ -109,9 +109,16 @@ namespace eosio { namespace chain {
* what would be logged to disk to enable the regeneration of blockchain state.
*
* The transactions are grouped to mirror the cycles in block_summary, generated
* transactions are not included.
* transactions are not included.
*/
struct
signed_block
:
public
signed_block_summary
{
signed_block
()
=
default
;
signed_block
(
const
signed_block
&
)
=
default
;
signed_block
(
const
signed_block_summary
&&
base
)
:
signed_block_summary
(
base
),
input_transactions
()
{}
digest_type
calculate_transaction_merkle_root
()
const
;
vector
<
packed_transaction
>
input_transactions
;
/// this is loaded and indexed into map<id,trx> that is referenced by summary
};
...
...
plugins/net_plugin/net_plugin.cpp
浏览文件 @
62807d66
...
...
@@ -2170,7 +2170,6 @@ namespace eosio {
}
void
net_plugin_impl
::
handle_message
(
connection_ptr
c
,
const
signed_block_summary
&
msg
)
{
// should only be during synch or rolling upgrade
chain_controller
&
cc
=
chain_plug
->
chain
();
block_id_type
blk_id
=
msg
.
id
();
uint32_t
blk_num
=
msg
.
block_num
();
...
...
@@ -2188,25 +2187,36 @@ namespace eosio {
fc_dlog
(
logger
,
"got signed_block_summary #${n} from ${p} block age in secs = ${age}"
,
(
"n"
,
blk_num
)(
"p"
,
c
->
peer_name
())(
"age"
,
age
.
to_seconds
()));
signed_block
sb
;
sb
.
regions
=
std
::
move
(
msg
.
regions
);
signed_block
sb
(
std
::
move
(
msg
));
update_block_num
ubn
(
blk_num
);
for
(
const
auto
&
region
:
sb
.
regions
)
{
for
(
const
auto
&
cycle_sum
:
region
.
cycles_summary
)
{
for
(
const
auto
&
shard
:
cycle_sum
)
{
for
(
const
auto
&
recpt
:
shard
.
transactions
)
{
auto
ltx
=
local_txns
.
get
<
by_id
>
().
find
(
recpt
.
id
);
if
(
ltx
==
local_txns
.
end
()
)
{
fc_elog
(
logger
,
"summary references unknown transacion ${rid}"
,(
"rid"
,
recpt
.
id
));
close
(
c
);
// close without go away allows reconnect
return
;
}
sb
.
input_transactions
.
push_back
(
ltx
->
packed_txn
)
;
local_txns
.
modify
(
ltx
,
ubn
);
auto
ctx
=
c
->
trx_state
.
get
<
by_id
>
().
find
(
recpt
.
id
);
if
(
ctx
!=
c
->
trx_state
.
end
())
{
c
->
trx_state
.
modify
(
ctx
,
ubn
)
;
switch
(
recpt
.
status
)
{
case
transaction_receipt
::
executed
:
{
if
(
ltx
==
local_txns
.
end
())
{
fc_elog
(
logger
,
"summary references unknown transaction ${rid}"
,(
"rid"
,
recpt
.
id
))
;
close
(
c
);
// close without go away allows reconnect
return
;
}
sb
.
input_transactions
.
push_back
(
ltx
->
packed_txn
);
local_txns
.
modify
(
ltx
,
ubn
);
break
;
}
case
transaction_receipt
::
soft_fail
:
case
transaction_receipt
::
hard_fail
:
{
if
(
ltx
!=
local_txns
.
end
())
{
sb
.
input_transactions
.
push_back
(
ltx
->
packed_txn
);
local_txns
.
modify
(
ltx
,
ubn
);
auto
ctx
=
c
->
trx_state
.
get
<
by_id
>
().
find
(
recpt
.
id
);
if
(
ctx
!=
c
->
trx_state
.
end
())
{
c
->
trx_state
.
modify
(
ctx
,
ubn
);
}
}
break
;
}}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录