Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
8905bd34
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,发现更多精彩内容 >>
未验证
提交
8905bd34
编写于
5月 31, 2018
作者:
A
Anton Perkov
提交者:
GitHub
5月 31, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into cleos-newaccount-usability
上级
9393d4e1
68adf905
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
39 deletion
+47
-39
libraries/chain/block_header_state.cpp
libraries/chain/block_header_state.cpp
+1
-1
libraries/fc/src/filesystem.cpp
libraries/fc/src/filesystem.cpp
+38
-33
plugins/chain_plugin/chain_plugin.cpp
plugins/chain_plugin/chain_plugin.cpp
+6
-3
plugins/producer_plugin/producer_plugin.cpp
plugins/producer_plugin/producer_plugin.cpp
+2
-2
未找到文件。
libraries/chain/block_header_state.cpp
浏览文件 @
8905bd34
...
...
@@ -155,7 +155,7 @@ namespace eosio { namespace chain {
auto
itr
=
producer_to_last_produced
.
find
(
h
.
producer
);
if
(
itr
!=
producer_to_last_produced
.
end
()
)
{
FC_ASSERT
(
itr
->
second
<
result
.
block_num
-
h
.
confirmed
,
"producer
double-confirming known range"
);
FC_ASSERT
(
itr
->
second
<
result
.
block_num
-
h
.
confirmed
,
"producer
${prod} double-confirming known range"
,
(
"prod"
,
h
.
producer
)
);
}
// FC_ASSERT( result.header.block_mroot == h.block_mroot, "mismatch block merkle root" );
...
...
libraries/fc/src/filesystem.cpp
浏览文件 @
8905bd34
...
...
@@ -18,7 +18,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
# ifdef FC_HAS_SIMPLE_FILE_LOCK
# ifdef FC_HAS_SIMPLE_FILE_LOCK
#include <sys/file.h>
#include <fcntl.h>
# endif
...
...
@@ -26,7 +26,7 @@
namespace
fc
{
// when converting to and from a variant, store utf-8 in the variant
void
to_variant
(
const
fc
::
path
&
path_to_convert
,
variant
&
variant_output
)
void
to_variant
(
const
fc
::
path
&
path_to_convert
,
variant
&
variant_output
)
{
std
::
wstring
wide_string
=
path_to_convert
.
generic_wstring
();
std
::
string
utf8_string
;
...
...
@@ -38,7 +38,7 @@ namespace fc {
//v = path;
}
void
from_variant
(
const
fc
::
variant
&
variant_to_convert
,
fc
::
path
&
path_output
)
void
from_variant
(
const
fc
::
variant
&
variant_to_convert
,
fc
::
path
&
path_output
)
{
std
::
wstring
wide_string
;
fc
::
decodeUtf8
(
variant_to_convert
.
as_string
(),
&
wide_string
);
...
...
@@ -128,7 +128,7 @@ namespace fc {
const
size_t
maxPath
=
32
*
1024
;
std
::
vector
<
wchar_t
>
short_path
;
short_path
.
resize
(
maxPath
+
1
);
wchar_t
*
buffer
=
short_path
.
data
();
DWORD
res
=
GetShortPathNameW
(
path
.
c_str
(),
buffer
,
maxPath
);
if
(
res
!=
0
)
...
...
@@ -140,7 +140,7 @@ namespace fc {
}
/**
* @todo use iterators instead of indexes for
* @todo use iterators instead of indexes for
* faster performance
*/
fc
::
string
path
::
windows_string
()
const
{
...
...
@@ -209,11 +209,11 @@ namespace fc {
return
*
r
.
_p
!=
*
l
.
_p
;
}
bool
exists
(
const
path
&
p
)
{
return
boost
::
filesystem
::
exists
(
p
);
}
void
create_directories
(
const
path
&
p
)
{
void
create_directories
(
const
path
&
p
)
{
try
{
boost
::
filesystem
::
create_directories
(
p
);
boost
::
filesystem
::
create_directories
(
p
);
}
catch
(
...
)
{
FC_THROW
(
"Unable to create directories ${path}"
,
(
"path"
,
p
)(
"inner"
,
fc
::
except_str
()
)
);
}
...
...
@@ -242,9 +242,10 @@ namespace fc {
}
void
remove_all
(
const
path
&
p
)
{
boost
::
filesystem
::
remove_all
(
p
);
}
void
copy
(
const
path
&
f
,
const
path
&
t
)
{
void
copy
(
const
path
&
f
,
const
path
&
t
)
{
boost
::
system
::
error_code
ec
;
try
{
boost
::
filesystem
::
copy
(
boost
::
filesystem
::
path
(
f
),
boost
::
filesystem
::
path
(
t
)
);
boost
::
filesystem
::
copy
(
boost
::
filesystem
::
path
(
f
),
boost
::
filesystem
::
path
(
t
),
ec
);
}
catch
(
boost
::
system
::
system_error
&
e
)
{
FC_THROW
(
"Copy from ${srcfile} to ${dstfile} failed because ${reason}"
,
(
"srcfile"
,
f
)(
"dstfile"
,
t
)(
"reason"
,
e
.
what
()
)
);
...
...
@@ -252,18 +253,22 @@ namespace fc {
FC_THROW
(
"Copy from ${srcfile} to ${dstfile} failed"
,
(
"srcfile"
,
f
)(
"dstfile"
,
t
)(
"inner"
,
fc
::
except_str
()
)
);
}
if
(
ec
)
{
FC_THROW
(
"Copy from ${srcfile} to ${dstfile} failed because ${reason}"
,
(
"srcfile"
,
f
)(
"dstfile"
,
t
)(
"reason"
,
ec
.
category
().
name
()
)
);
}
}
void
resize_file
(
const
path
&
f
,
size_t
t
)
{
void
resize_file
(
const
path
&
f
,
size_t
t
)
{
try
{
boost
::
filesystem
::
resize_file
(
f
,
t
);
}
}
catch
(
boost
::
system
::
system_error
&
e
)
{
FC_THROW
(
"Resize file '${f}' to size ${s} failed: ${reason}"
,
(
"f"
,
f
)(
"s"
,
t
)(
"reason"
,
e
.
what
()
)
);
}
catch
(
...
)
}
catch
(
...
)
{
FC_THROW
(
"Resize file '${f}' to size ${s} failed: ${reason}"
,
(
"f"
,
f
)(
"s"
,
t
)(
"reason"
,
fc
::
except_str
()
)
);
...
...
@@ -276,15 +281,15 @@ namespace fc {
void
chmod
(
const
path
&
p
,
int
perm
)
{
#ifndef WIN32
mode_t
actual_perm
=
mode_t
actual_perm
=
((
perm
&
0400
)
?
S_IRUSR
:
0
)
|
((
perm
&
0200
)
?
S_IWUSR
:
0
)
|
((
perm
&
0100
)
?
S_IXUSR
:
0
)
|
((
perm
&
0040
)
?
S_IRGRP
:
0
)
|
((
perm
&
0020
)
?
S_IWGRP
:
0
)
|
((
perm
&
0010
)
?
S_IXGRP
:
0
)
|
((
perm
&
0004
)
?
S_IROTH
:
0
)
|
((
perm
&
0002
)
?
S_IWOTH
:
0
)
|
((
perm
&
0001
)
?
S_IXOTH
:
0
)
...
...
@@ -297,13 +302,13 @@ namespace fc {
return
;
}
void
rename
(
const
path
&
f
,
const
path
&
t
)
{
void
rename
(
const
path
&
f
,
const
path
&
t
)
{
try
{
boost
::
filesystem
::
rename
(
boost
::
filesystem
::
path
(
f
),
boost
::
filesystem
::
path
(
t
)
);
boost
::
filesystem
::
rename
(
boost
::
filesystem
::
path
(
f
),
boost
::
filesystem
::
path
(
t
)
);
}
catch
(
boost
::
system
::
system_error
&
)
{
try
{
boost
::
filesystem
::
copy
(
boost
::
filesystem
::
path
(
f
),
boost
::
filesystem
::
path
(
t
)
);
boost
::
filesystem
::
remove
(
boost
::
filesystem
::
path
(
f
));
boost
::
filesystem
::
copy
(
boost
::
filesystem
::
path
(
f
),
boost
::
filesystem
::
path
(
t
)
);
boost
::
filesystem
::
remove
(
boost
::
filesystem
::
path
(
f
));
}
catch
(
boost
::
system
::
system_error
&
e
)
{
FC_THROW
(
"Rename from ${srcfile} to ${dstfile} failed because ${reason}"
,
(
"srcfile"
,
f
)(
"dstfile"
,
t
)(
"reason"
,
e
.
what
()
)
);
...
...
@@ -313,24 +318,24 @@ namespace fc {
(
"srcfile"
,
f
)(
"dstfile"
,
t
)(
"inner"
,
fc
::
except_str
()
)
);
}
}
void
create_hard_link
(
const
path
&
f
,
const
path
&
t
)
{
void
create_hard_link
(
const
path
&
f
,
const
path
&
t
)
{
try
{
boost
::
filesystem
::
create_hard_link
(
f
,
t
);
boost
::
filesystem
::
create_hard_link
(
f
,
t
);
}
catch
(
...
)
{
FC_THROW
(
"Unable to create hard link from '${from}' to '${to}'"
,
FC_THROW
(
"Unable to create hard link from '${from}' to '${to}'"
,
(
"from"
,
f
)(
"to"
,
t
)(
"exception"
,
fc
::
except_str
()
)
);
}
}
bool
remove
(
const
path
&
f
)
{
bool
remove
(
const
path
&
f
)
{
try
{
return
boost
::
filesystem
::
remove
(
f
);
return
boost
::
filesystem
::
remove
(
f
);
}
catch
(
...
)
{
FC_THROW
(
"Unable to remove '${path}'"
,
(
"path"
,
f
)(
"exception"
,
fc
::
except_str
()
)
);
}
}
fc
::
path
canonical
(
const
fc
::
path
&
p
)
{
fc
::
path
canonical
(
const
fc
::
path
&
p
)
{
try
{
return
boost
::
filesystem
::
canonical
(
p
);
return
boost
::
filesystem
::
canonical
(
p
);
}
catch
(
...
)
{
FC_THROW
(
"Unable to resolve path '${path}'"
,
(
"path"
,
p
)(
"exception"
,
fc
::
except_str
()
)
);
}
...
...
@@ -477,7 +482,7 @@ namespace fc {
const
fc
::
path
&
app_path
()
{
#ifdef __APPLE__
static
fc
::
path
appdir
=
[](){
return
home_path
()
/
"Library"
/
"Application Support"
;
}();
static
fc
::
path
appdir
=
[](){
return
home_path
()
/
"Library"
/
"Application Support"
;
}();
#elif defined( WIN32 )
static
fc
::
path
appdir
=
[](){
wchar_t
app_data_dir
[
MAX_PATH
];
...
...
@@ -499,7 +504,7 @@ namespace fc {
}
#ifdef FC_HAS_SIMPLE_FILE_LOCK
#ifdef FC_HAS_SIMPLE_FILE_LOCK
class
simple_lock_file
::
impl
{
public:
...
...
@@ -517,7 +522,7 @@ namespace fc {
bool
try_lock
();
void
unlock
();
};
simple_lock_file
::
impl
::
impl
(
const
path
&
lock_file_path
)
:
#ifdef _WIN32
file_handle
(
INVALID_HANDLE_VALUE
),
...
...
@@ -527,7 +532,7 @@ namespace fc {
is_locked
(
false
),
lock_file_path
(
lock_file_path
)
{}
simple_lock_file
::
impl
::~
impl
()
{
unlock
();
...
...
plugins/chain_plugin/chain_plugin.cpp
浏览文件 @
8905bd34
...
...
@@ -294,9 +294,12 @@ void chain_plugin::plugin_initialize(const variables_map& options) {
my
->
chain_config
->
reversible_cache_size
,
my
->
chain_config
->
blocks_dir
/
config
::
reversible_blocks_dir_name
)
)
{
ilog
(
"Reversible blocks database was not corrupted. Copying from backup to blocks directory."
);
fc
::
copy
(
backup_dir
/
config
::
reversible_blocks_dir_name
,
my
->
chain_config
->
blocks_dir
/
config
::
reversible_blocks_dir_name
);
fc
::
copy
(
backup_dir
/
"reversible/shared_memory.bin"
,
my
->
chain_config
->
blocks_dir
/
"reversible/shared_memory.bin"
);
fc
::
copy
(
backup_dir
/
"reversible/shared_memory.meta"
,
my
->
chain_config
->
blocks_dir
/
"reversible/shared_memory.meta"
);
fc
::
copy
(
backup_dir
/
config
::
reversible_blocks_dir_name
,
my
->
chain_config
->
blocks_dir
/
config
::
reversible_blocks_dir_name
);
fc
::
copy
(
backup_dir
/
config
::
reversible_blocks_dir_name
/
"shared_memory.bin"
,
my
->
chain_config
->
blocks_dir
/
config
::
reversible_blocks_dir_name
/
"shared_memory.bin"
);
fc
::
copy
(
backup_dir
/
config
::
reversible_blocks_dir_name
/
"shared_memory.meta"
,
my
->
chain_config
->
blocks_dir
/
config
::
reversible_blocks_dir_name
/
"shared_memory.meta"
);
}
}
}
else
if
(
options
.
at
(
"replay-blockchain"
).
as
<
bool
>
()
)
{
...
...
plugins/producer_plugin/producer_plugin.cpp
浏览文件 @
8905bd34
...
...
@@ -1013,12 +1013,12 @@ bool producer_plugin_impl::maybe_produce_block() {
static
auto
make_debug_time_logger
()
{
auto
start
=
fc
::
time_point
::
now
();
return
fc
::
make_scoped_exit
([
=
](){
dlog
(
"Signing took ${ms}us"
,
(
"ms"
,
fc
::
time_point
::
now
()
-
start
)
);
fc_dlog
(
_log
,
"Signing took ${ms}us"
,
(
"ms"
,
fc
::
time_point
::
now
()
-
start
)
);
});
}
static
auto
maybe_make_debug_time_logger
()
->
fc
::
optional
<
decltype
(
make_debug_time_logger
())
>
{
if
(
(
fc
::
logger
::
get
(
DEFAULT_LOGGER
))
.
is_enabled
(
fc
::
log_level
::
debug
)
){
if
(
_log
.
is_enabled
(
fc
::
log_level
::
debug
)
){
return
make_debug_time_logger
();
}
else
{
return
{};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录