Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
fcf98b65
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,发现更多精彩内容 >>
提交
fcf98b65
编写于
4月 19, 2017
作者:
D
Daniel Larimer
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:EOSIO/eos
上级
4e59a500
bdd2c9a2
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
24 addition
and
13 deletion
+24
-13
libraries/appbase
libraries/appbase
+1
-1
libraries/net/node.cpp
libraries/net/node.cpp
+4
-4
plugins/p2p_plugin/include/eos/p2p_plugin/p2p_plugin.hpp
plugins/p2p_plugin/include/eos/p2p_plugin/p2p_plugin.hpp
+2
-0
plugins/p2p_plugin/p2p_plugin.cpp
plugins/p2p_plugin/p2p_plugin.cpp
+12
-3
plugins/producer_plugin/CMakeLists.txt
plugins/producer_plugin/CMakeLists.txt
+2
-1
plugins/producer_plugin/include/eos/producer_plugin/producer_plugin.hpp
...er_plugin/include/eos/producer_plugin/producer_plugin.hpp
+2
-1
plugins/producer_plugin/producer_plugin.cpp
plugins/producer_plugin/producer_plugin.cpp
+1
-3
未找到文件。
appbase
@
87e40d90
比较
028da3b1
...
87e40d90
Subproject commit
028da3b1e8ad612865676734c54db3f6197f338d
Subproject commit
87e40d90bb0228241a9356cfad58ad76cb358ab3
libraries/net/node.cpp
浏览文件 @
fcf98b65
...
...
@@ -86,10 +86,10 @@
//#define ENABLE_DEBUG_ULOGS
//
#ifdef DEFAULT_LOGGER
//
# undef DEFAULT_LOGGER
//
#endif
//
#define DEFAULT_LOGGER "p2p"
#ifdef DEFAULT_LOGGER
# undef DEFAULT_LOGGER
#endif
#define DEFAULT_LOGGER "p2p"
#define P2P_IN_DEDICATED_THREAD 1
...
...
plugins/p2p_plugin/include/eos/p2p_plugin/p2p_plugin.hpp
浏览文件 @
fcf98b65
...
...
@@ -44,6 +44,8 @@ public:
virtual
void
plugin_startup
();
virtual
void
plugin_shutdown
();
void
broadcast_block
(
const
chain
::
signed_block
&
block
);
private:
std
::
unique_ptr
<
class
p2p_plugin_impl
>
my
;
};
...
...
plugins/p2p_plugin/p2p_plugin.cpp
浏览文件 @
fcf98b65
...
...
@@ -53,7 +53,7 @@ public:
// node_delegate interface
virtual
bool
has_item
(
const
net
::
item_id
&
id
)
override
;
virtual
bool
handle_block
(
const
net
::
block_message
&
blk_msg
,
bool
sync_mode
,
std
::
vector
<
fc
::
uint160_t
>&
contained_transaction_message_ids
)
override
;
virtual
bool
handle_block
(
const
net
::
block_message
&
blk_msg
,
bool
sync_mode
,
std
::
vector
<
fc
::
uint160_t
>&
)
override
;
virtual
void
handle_transaction
(
const
net
::
trx_message
&
trx_msg
)
override
;
virtual
void
handle_message
(
const
net
::
message
&
message_to_process
)
override
;
virtual
std
::
vector
<
net
::
item_hash_t
>
get_block_ids
(
const
std
::
vector
<
net
::
item_hash_t
>&
blockchain_synopsis
,
uint32_t
&
remaining_item_count
,
uint32_t
limit
)
override
;
...
...
@@ -127,10 +127,16 @@ void p2p_plugin::plugin_startup() {
}
void
p2p_plugin
::
plugin_shutdown
()
{
ilog
(
"Shutting down P2P Plugin"
);
my
->
node
->
close
();
my
->
node
.
reset
();
}
void
p2p_plugin
::
broadcast_block
(
const
chain
::
signed_block
&
block
)
{
ilog
(
"Broadcasting block #${n}"
,
(
"n"
,
block
.
block_num
()));
my
->
node
->
broadcast
(
eos
::
net
::
block_message
(
block
));
}
////////////////////////////// Begin node_delegate Implementation //////////////////////////////
bool
p2p_plugin_impl
::
node_delegate
::
has_item
(
const
net
::
item_id
&
id
)
{
switch
(
id
.
item_type
)
{
...
...
@@ -146,8 +152,9 @@ bool p2p_plugin_impl::node_delegate::has_item(const net::item_id& id) {
}
bool
p2p_plugin_impl
::
node_delegate
::
handle_block
(
const
net
::
block_message
&
blk_msg
,
bool
sync_mode
,
std
::
vector
<
fc
::
uint160_t
>&
contained_transaction_message_ids
)
{
std
::
vector
<
fc
::
uint160_t
>&
)
{
try
{
if
(
!
sync_mode
)
ilog
(
"Received block ${num} from peer"
,
(
"num"
,
blk_msg
.
block
.
block_num
()));
return
chain
.
accept_block
(
blk_msg
.
block
,
sync_mode
);
}
catch
(
eos
::
chain
::
unlinkable_block_exception
&
e
)
{
FC_THROW_EXCEPTION
(
net
::
unlinkable_block_exception
,
"Unlinkable block: ${e}"
,
(
"e"
,
e
.
to_detail_string
()));
...
...
@@ -185,8 +192,10 @@ vector<net::item_hash_t> p2p_plugin_impl::node_delegate::get_block_ids(const std
vector
<
net
::
item_hash_t
>
ids
;
ids
.
reserve
(
last_block_num_to_return
-
last_known_block_num
);
for
(
unsigned
num
=
last_known_block_num
;
num
<=
last_block_num_to_return
;
++
num
)
ids
.
emplace_back
(
chain
.
db
().
get_block_id_for_num
(
num
));
if
(
BOOST_LIKELY
(
num
>
0
))
ids
.
emplace_back
(
chain
.
db
().
get_block_id_for_num
(
num
));
ilog
(
"Exiting ${f} with ${r}"
,
(
"f"
,
__FUNCTION__
)(
"r"
,
ids
));
return
ids
;
}
FC_CAPTURE_AND_RETHROW
((
blockchain_synopsis
))
}
...
...
plugins/producer_plugin/CMakeLists.txt
浏览文件 @
fcf98b65
...
...
@@ -2,9 +2,10 @@ file(GLOB HEADERS "include/eos/producer_plugin/*.hpp")
add_library
(
producer_plugin
producer_plugin.cpp
${
HEADERS
}
)
target_link_libraries
(
producer_plugin chain_plugin appbase eos_chain eos_utilities
)
target_link_libraries
(
producer_plugin
p2p_plugin
chain_plugin appbase eos_chain eos_utilities
)
target_include_directories
(
producer_plugin
PUBLIC
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include"
)
...
...
plugins/producer_plugin/include/eos/producer_plugin/producer_plugin.hpp
浏览文件 @
fcf98b65
...
...
@@ -24,6 +24,7 @@
#pragma once
#include <eos/chain_plugin/chain_plugin.hpp>
#include <eos/p2p_plugin/p2p_plugin.hpp>
#include <appbase/application.hpp>
...
...
@@ -46,7 +47,7 @@ namespace block_production_condition {
class
producer_plugin
:
public
appbase
::
plugin
<
producer_plugin
>
{
public:
APPBASE_PLUGIN_REQUIRES
((
chain_plugin
))
APPBASE_PLUGIN_REQUIRES
((
chain_plugin
)
(
p2p_plugin
)
)
producer_plugin
();
virtual
~
producer_plugin
();
...
...
plugins/producer_plugin/producer_plugin.cpp
浏览文件 @
fcf98b65
...
...
@@ -306,9 +306,7 @@ block_production_condition::block_production_condition_enum producer_plugin_impl
);
capture
(
"n"
,
block
.
block_num
())(
"t"
,
block
.
timestamp
)(
"c"
,
now
);
// fc::async( [this,block](){ p2p_node().broadcast(net::block_message(block)); } );
#warning TODO: broadcast the new block
app
().
get_plugin
<
p2p_plugin
>
().
broadcast_block
(
block
);
return
block_production_condition
::
produced
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录