Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
34ec9c1c
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,发现更多精彩内容 >>
提交
34ec9c1c
编写于
12月 17, 2019
作者:
W
wangxxzhiyy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update contracts
上级
7f749ae1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
11 deletion
+13
-11
contracts/hdddeposit/hdddeposit.hpp
contracts/hdddeposit/hdddeposit.hpp
+4
-6
contracts/hddpool/hddpool.cpp
contracts/hddpool/hddpool.cpp
+9
-5
未找到文件。
contracts/hdddeposit/hdddeposit.hpp
浏览文件 @
34ec9c1c
...
...
@@ -105,15 +105,13 @@ bool hdddeposit::is_deposit_enough( asset deposit, uint64_t max_space ) const
rate
=
grate
.
get
().
rate
;
}
double
drate
=
((
double
)
rate
)
/
100
;
uint32_t
one_gb
=
1024
*
1024
*
1024
;
//1GB
uint32_t
data_slice_size
=
16
*
1024
;
// among 4k-32k,set it as 16k
int64_t
am
=
(
int64_t
)((((
double
)((
max_space
*
data_slice_size
)))
/
one_gb
)
*
drate
*
10000
);
uint32_t
one_gb
=
64
*
1024
;
//1GB, 以16k一个分片大小为单位
int64_t
am
=
(
int64_t
)((((
double
)
max_space
)
/
one_gb
)
*
drate
*
10000
);
if
(
deposit
.
amount
>=
am
)
return
true
;
//return false;
return
true
;
return
false
;
}
contracts/hddpool/hddpool.cpp
浏览文件 @
34ec9c1c
...
...
@@ -30,10 +30,10 @@ const uint32_t one_gb = 1024 * 1024 * 1024; //1GB
const
uint32_t
data_slice_size
=
16
*
1024
;
// among 4k-32k,set it as 16k
//以下空间量按照16k一个分片大小为单位
const
uint64_t
max_userspace
=
64
*
1024
*
1024
*
uint64_t
(
1024
*
500
);
//500P 最大用户存储空间量
const
uint64_t
max_minerspace
=
64
*
1024
*
uint64_t
(
1024
*
100
);
//100T 单个矿机最大的采购空间量
const
uint64_t
max_user
_
space
=
64
*
1024
*
1024
*
uint64_t
(
1024
*
500
);
//500P 最大用户存储空间量
const
uint64_t
max_miner
_
space
=
64
*
1024
*
uint64_t
(
1024
*
100
);
//100T 单个矿机最大的采购空间量
//const uint32_t per_profit_space = 64 * 1024; //1G //每次增加的采购空间容量
const
uint32_t
min_miner_space
=
100
*
(
1024
*
64
);
//100GB,以16k分片为单位
static
constexpr
eosio
::
name
active_permission
{
N
(
active
)};
static
constexpr
eosio
::
name
token_account
{
N
(
eosio
.
token
)};
...
...
@@ -364,7 +364,7 @@ void hddpool::addhspace(name user, uint64_t space, name caller)
_userhdd
.
modify
(
it
,
_self
,
[
&
](
auto
&
row
)
{
row
.
hdd_space_store
+=
space
;
eosio_assert
(
row
.
hdd_space_store
<=
max_userspace
,
"overflow max_userspace"
);
eosio_assert
(
row
.
hdd_space_store
<=
max_user
_
space
,
"overflow max_userspace"
);
});
}
...
...
@@ -656,7 +656,8 @@ void hddpool::addm2pool(uint64_t minerid, name pool_id, name minerowner, uint64_
require_auth
(
itminerinfo
->
admin
);
eosio_assert
(
itminerinfo
->
pool_id
.
value
==
0
,
"miner already join to a pool(@@err:alreadyinpool@@)
\n
"
);
eosio_assert
(
max_space
<=
max_minerspace
,
"miner max_space overflow
\n
"
);
eosio_assert
(
max_space
<=
max_miner_space
,
"miner max_space overflow
\n
"
);
eosio_assert
(
max_space
>=
min_miner_space
,
"miner max_space underflow
\n
"
);
eosio_assert
((
itstorepool
->
space_left
>
0
&&
itstorepool
->
space_left
>
max_space
),
"pool space not enough"
);
//--- check miner deposit and max_space
...
...
@@ -743,6 +744,9 @@ void hddpool::mchgspace(uint64_t minerid, uint64_t max_space)
minerinfo_table
_minerinfo
(
_self
,
_self
);
auto
itminerinfo
=
_minerinfo
.
find
(
minerid
);
eosio_assert
(
itminerinfo
!=
_minerinfo
.
end
(),
"miner not registered
\n
"
);
eosio_assert
(
max_space
<=
max_miner_space
,
"miner max_space overflow
\n
"
);
eosio_assert
(
max_space
>=
min_miner_space
,
"miner max_space underflow
\n
"
);
require_auth
(
itminerinfo
->
admin
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录