Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
85d6fe40
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,发现更多精彩内容 >>
未验证
提交
85d6fe40
编写于
4月 16, 2018
作者:
K
Kevin Heifner
提交者:
GitHub
4月 16, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2410 from EOSIO/p2p-optimize-retry-2408
P2p optimize retry 2408
上级
9a1f307b
f1d26a6d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
60 addition
and
19 deletion
+60
-19
libraries/chain/include/eosio/chain/transaction.hpp
libraries/chain/include/eosio/chain/transaction.hpp
+1
-0
libraries/chain/transaction.cpp
libraries/chain/transaction.cpp
+7
-0
plugins/net_plugin/net_plugin.cpp
plugins/net_plugin/net_plugin.cpp
+52
-19
未找到文件。
libraries/chain/include/eosio/chain/transaction.hpp
浏览文件 @
85d6fe40
...
...
@@ -208,6 +208,7 @@ namespace eosio { namespace chain {
bytes
packed_context_free_data
;
bytes
packed_trx
;
transaction_id_type
id
()
const
;
bytes
get_raw_transaction
()
const
;
vector
<
bytes
>
get_context_free_data
()
const
;
transaction
get_transaction
()
const
;
...
...
libraries/chain/transaction.cpp
浏览文件 @
85d6fe40
...
...
@@ -255,6 +255,13 @@ vector<bytes> packed_transaction::get_context_free_data()const
}
FC_CAPTURE_AND_RETHROW
((
compression
)(
packed_context_free_data
))
}
transaction_id_type
packed_transaction
::
id
()
const
{
try
{
return
get_transaction
().
id
();
}
FC_CAPTURE_AND_RETHROW
((
compression
)(
packed_trx
))
}
transaction
packed_transaction
::
get_transaction
()
const
{
try
{
...
...
plugins/net_plugin/net_plugin.cpp
浏览文件 @
85d6fe40
...
...
@@ -578,7 +578,11 @@ namespace eosio {
public:
uint32_t
just_send_it_max
;
connection_ptr
pending_txn_source
;
vector
<
block_id_type
>
req_blks
;
struct
block_request
{
block_id_type
id
;
bool
local_retry
;
};
vector
<
block_request
>
req_blks
;
vector
<
transaction_id_type
>
req_txn
;
void
bcast_block
(
const
signed_block_summary
&
msg
,
connection_ptr
skip
=
connection_ptr
());
...
...
@@ -588,7 +592,7 @@ namespace eosio {
void
rejected_transaction
(
const
packed_transaction
&
msg
);
void
recv_block
(
connection_ptr
conn
,
const
signed_block_summary
&
msg
);
void
recv_transaction
(
connection_ptr
c
);
void
recv_notice
(
connection_ptr
conn
,
const
notice_message
&
msg
);
void
recv_notice
(
connection_ptr
conn
,
const
notice_message
&
msg
,
bool
generated
);
void
retry_fetch
(
connection_ptr
conn
);
};
...
...
@@ -1572,9 +1576,16 @@ namespace eosio {
block_id_type
blk_id
=
msg
.
id
();
uint32_t
num
=
msg
.
block_num
();
for
(
auto
ref
=
req_blks
.
begin
();
ref
!=
req_blks
.
end
();
++
ref
)
{
if
(
*
ref
==
blk_id
)
{
req_blks
.
erase
(
ref
);
fc_dlog
(
logger
,
"received a requested block"
);
if
(
ref
->
id
!=
blk_id
)
continue
;
bool
is_retry
=
ref
->
local_retry
;
req_blks
.
erase
(
ref
);
fc_dlog
(
logger
,
"received a requested block"
);
if
(
is_retry
)
{
bcast_block
(
msg
);
}
else
{
notice_message
note
;
note
.
known_blocks
.
mode
=
normal
;
note
.
known_blocks
.
ids
.
push_back
(
blk_id
);
...
...
@@ -1641,8 +1652,10 @@ namespace eosio {
c
->
cancel_wait
();
}
void
big_msg_manager
::
recv_notice
(
connection_ptr
c
,
const
notice_message
&
msg
)
{
void
big_msg_manager
::
recv_notice
(
connection_ptr
c
,
const
notice_message
&
msg
,
bool
generated
)
{
request_message
req
;
req
.
req_trx
.
mode
=
none
;
req
.
req_blocks
.
mode
=
none
;
bool
send_req
=
false
;
chain_controller
&
cc
=
my_impl
->
chain_plug
->
chain
();
if
(
msg
.
known_trx
.
mode
==
normal
)
{
...
...
@@ -1686,7 +1699,7 @@ namespace eosio {
if
(
!
b
)
{
send_req
=
true
;
req
.
req_blocks
.
ids
.
push_back
(
blkid
);
req_blks
.
push_back
(
blkid
);
req_blks
.
push_back
(
{
blkid
,
generated
}
);
}
}
}
...
...
@@ -2085,6 +2098,9 @@ namespace eosio {
fc_dlog
(
logger
,
"got a notice_message from ${p}"
,
(
"p"
,
c
->
peer_name
()));
request_message
req
;
bool
send_req
=
false
;
if
(
msg
.
known_trx
.
mode
!=
none
)
{
fc_dlog
(
logger
,
"this is a ${m} notice with ${n} blocks"
,
(
"m"
,
modes_str
(
msg
.
known_trx
.
mode
))(
"n"
,
msg
.
known_trx
.
pending
));
}
switch
(
msg
.
known_trx
.
mode
)
{
case
none
:
break
;
...
...
@@ -2108,12 +2124,13 @@ namespace eosio {
break
;
}
case
normal
:
{
big_msg_master
->
recv_notice
(
c
,
msg
);
big_msg_master
->
recv_notice
(
c
,
msg
,
false
);
}
}
fc_dlog
(
logger
,
"this is a ${m} notice with ${n} blocks"
,
(
"m"
,
modes_str
(
msg
.
known_blocks
.
mode
))(
"n"
,
msg
.
known_blocks
.
pending
));
if
(
msg
.
known_blocks
.
mode
!=
none
)
{
fc_dlog
(
logger
,
"this is a ${m} notice with ${n} blocks"
,
(
"m"
,
modes_str
(
msg
.
known_blocks
.
mode
))(
"n"
,
msg
.
known_blocks
.
pending
));
}
switch
(
msg
.
known_blocks
.
mode
)
{
case
none
:
{
if
(
msg
.
known_trx
.
mode
!=
normal
)
{
...
...
@@ -2127,7 +2144,7 @@ namespace eosio {
break
;
}
case
normal
:
{
big_msg_master
->
recv_notice
(
c
,
msg
);
big_msg_master
->
recv_notice
(
c
,
msg
,
false
);
break
;
}
default:
{
...
...
@@ -2187,6 +2204,10 @@ namespace eosio {
return
;
}
c
->
cancel_wait
();
if
(
local_txns
.
get
<
by_id
>
().
find
(
msg
.
id
())
!=
local_txns
.
end
())
{
fc_dlog
(
logger
,
"got a duplicate transaction - dropping"
);
return
;
}
big_msg_master
->
recv_transaction
(
c
);
uint64_t
code
=
0
;
try
{
...
...
@@ -2239,7 +2260,18 @@ namespace eosio {
for
(
const
auto
&
recpt
:
shard
.
transactions
)
{
auto
ltx
=
local_txns
.
get
<
by_id
>
().
find
(
recpt
.
id
);
switch
(
recpt
.
status
)
{
case
transaction_receipt
::
delayed
:
case
transaction_receipt
::
delayed
:
{
if
(
ltx
==
local_txns
.
end
())
{
fc_dlog
(
logger
,
"got a delayed transaction, treat it like a notify"
);
notice_message
pending_notify
;
pending_notify
.
known_blocks
.
mode
=
normal
;
pending_notify
.
known_blocks
.
ids
.
push_back
(
blk_id
);
pending_notify
.
known_trx
.
mode
=
none
;
big_msg_master
->
recv_notice
(
c
,
pending_notify
,
true
);
return
;
}
// else fall through to executed.
}
case
transaction_receipt
::
executed
:
{
if
(
ltx
!=
local_txns
.
end
())
{
sb
.
input_transactions
.
push_back
(
ltx
->
packed_txn
);
...
...
@@ -2265,26 +2297,27 @@ namespace eosio {
}
}
go_away_reason
reason
=
fatal_other
;
try
{
chain_plug
->
accept_block
(
sb
,
sync_master
->
is_active
(
c
));
reason
=
no_reason
;
big_msg_master
->
recv_block
(
c
,
msg
);
sync_master
->
recv_block
(
c
,
blk_id
,
blk_num
,
true
);
return
;
}
catch
(
const
unlinkable_block_exception
&
ex
)
{
elog
(
"unlinkable_block_exception accept block #${n} syncing from ${p}"
,(
"n"
,
blk_num
)(
"p"
,
c
->
peer_name
()));
reason
=
unlinkable
;
}
catch
(
const
block_validate_exception
&
ex
)
{
elog
(
"block_validate_exception accept block #${n} syncing from ${p}"
,(
"n"
,
blk_num
)(
"p"
,
c
->
peer_name
()));
reason
=
validation
;
}
catch
(
const
assert_exception
&
ex
)
{
elog
(
"unable to accept block on assert exception ${n} from ${p}"
,(
"n"
,
ex
.
to_string
())(
"p"
,
c
->
peer_name
()));
}
catch
(
const
fc
::
exception
&
ex
)
{
elog
(
"accept_block threw a non-assert exception ${x} from ${p}"
,(
"x"
,
ex
.
to_string
())(
"p"
,
c
->
peer_name
()));
reason
=
no_reason
;
}
catch
(
...)
{
elog
(
"handle sync block caught something else from ${p}"
,(
"num"
,
blk_num
)(
"p"
,
c
->
peer_name
()));
}
big_msg_master
->
recv_block
(
c
,
msg
);
sync_master
->
recv_block
(
c
,
blk_id
,
blk_num
,
reason
==
no_reason
);
notice_message
pending_notify
;
pending_notify
.
known_blocks
.
mode
=
normal
;
pending_notify
.
known_blocks
.
ids
.
push_back
(
blk_id
);
pending_notify
.
known_trx
.
mode
=
none
;
big_msg_master
->
recv_notice
(
c
,
pending_notify
,
true
);
}
void
net_plugin_impl
::
handle_message
(
connection_ptr
c
,
const
signed_block
&
msg
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录