Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
92cbff7e
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,发现更多精彩内容 >>
提交
92cbff7e
编写于
11月 20, 2017
作者:
B
Brian Johnson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Moved objects out of native_contracts and into chain lib.
上级
9e09b882
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
63 addition
and
72 deletion
+63
-72
libraries/chain/CMakeLists.txt
libraries/chain/CMakeLists.txt
+3
-1
libraries/chain/include/eos/chain/balance_object.hpp
libraries/chain/include/eos/chain/balance_object.hpp
+4
-5
libraries/chain/include/eos/chain/producer_objects.hpp
libraries/chain/include/eos/chain/producer_objects.hpp
+12
-14
libraries/chain/include/eos/chain/staked_balance_objects.hpp
libraries/chain/include/eos/chain/staked_balance_objects.hpp
+4
-6
libraries/chain/producer_objects.cpp
libraries/chain/producer_objects.cpp
+4
-5
libraries/chain/staked_balance_objects.cpp
libraries/chain/staked_balance_objects.cpp
+4
-5
libraries/native_contract/CMakeLists.txt
libraries/native_contract/CMakeLists.txt
+0
-2
libraries/native_contract/eos_contract.cpp
libraries/native_contract/eos_contract.cpp
+3
-3
libraries/native_contract/include/eos/native_contract/objects.hpp
...s/native_contract/include/eos/native_contract/objects.hpp
+3
-3
libraries/native_contract/native_contract_chain_administrator.cpp
...s/native_contract/native_contract_chain_administrator.cpp
+2
-2
libraries/native_contract/native_contract_chain_initializer.cpp
...ies/native_contract/native_contract_chain_initializer.cpp
+8
-8
plugins/chain_plugin/chain_plugin.cpp
plugins/chain_plugin/chain_plugin.cpp
+3
-3
tests/common/database_fixture.cpp
tests/common/database_fixture.cpp
+3
-5
tests/tests/chain_tests.cpp
tests/tests/chain_tests.cpp
+1
-1
tests/tests/native_contract_tests.cpp
tests/tests/native_contract_tests.cpp
+8
-8
tests/tests/special_accounts_tests.cpp
tests/tests/special_accounts_tests.cpp
+1
-1
未找到文件。
libraries/chain/CMakeLists.txt
浏览文件 @
92cbff7e
...
...
@@ -15,11 +15,13 @@ add_library( eos_chain
get_config.cpp
block_log.cpp
blockchain_configuration.cpp
blockchain_configuration.cpp
types.cpp
chain_administration_interface.cpp
message_handling_contexts.cpp
producer_objects.cpp
staked_balance_objects.cpp
${
HEADERS
}
)
...
...
libraries/
native_contract/include/eos/native_contract
/balance_object.hpp
→
libraries/
chain/include/eos/chain
/balance_object.hpp
浏览文件 @
92cbff7e
...
...
@@ -11,16 +11,15 @@
#include <chainbase/chainbase.hpp>
namespace
native
{
namespace
eosio
{
namespace
chain
=
::
eosio
::
chain
;
namespace
chain
{
namespace
types
=
::
eosio
::
types
;
namespace
config
=
::
eosio
::
config
;
/**
* @brief The balance_object class tracks the EOS balance for accounts
*/
class
balance_object
:
public
chainbase
::
object
<
chain
::
balance_object_type
,
balance_object
>
{
class
balance_object
:
public
chainbase
::
object
<
balance_object_type
,
balance_object
>
{
OBJECT_CTOR
(
balance_object
)
id_type
id
;
...
...
@@ -42,6 +41,6 @@ using balance_multi_index = chainbase::shared_multi_index_container<
>
>
;
}
}
// namespace
native::eosio
}
}
// namespace
eosio::chain
CHAINBASE_SET_INDEX_TYPE
(
native
::
eosio
::
balance_object
,
native
::
eosio
::
balance_multi_index
)
CHAINBASE_SET_INDEX_TYPE
(
eosio
::
chain
::
balance_object
,
eosio
::
chain
::
balance_multi_index
)
libraries/
native_contract/include/eos/native_contract
/producer_objects.hpp
→
libraries/
chain/include/eos/chain
/producer_objects.hpp
浏览文件 @
92cbff7e
...
...
@@ -15,12 +15,10 @@
#include <boost/multi_index/mem_fun.hpp>
namespace
native
{
namespace
eosio
{
namespace
chain
{
using
namespace
::
eosio
::
chain
;
namespace
config
=
::
eosio
::
config
;
namespace
chain
=
::
eosio
::
chain
;
namespace
types
=
::
eosio
::
types
;
FC_DECLARE_EXCEPTION
(
producer_race_overflow_exception
,
10000000
,
"Producer Virtual Race time has overflowed"
);
...
...
@@ -33,7 +31,7 @@ FC_DECLARE_EXCEPTION(producer_race_overflow_exception, 10000000, "Producer Virtu
*
* This class also tracks the votes cast by block producers on various chain configuration options and key documents.
*/
class
producer_votes_object
:
public
chainbase
::
object
<
chain
::
producer_votes_object_type
,
producer_votes_object
>
{
class
producer_votes_object
:
public
chainbase
::
object
<
producer_votes_object_type
,
producer_votes_object
>
{
OBJECT_CTOR
(
producer_votes_object
)
id_type
id
;
...
...
@@ -129,22 +127,22 @@ class producer_votes_object : public chainbase::object<chain::producer_votes_obj
* An account A may only proxy to one account at a time, and if A has proxied its votes to some other account, A may
* not cast any other votes until it unproxies its voting power.
*/
class
proxy_vote_object
:
public
chainbase
::
object
<
chain
::
proxy_vote_object_type
,
proxy_vote_object
>
{
class
proxy_vote_object
:
public
chainbase
::
object
<
proxy_vote_object_type
,
proxy_vote_object
>
{
OBJECT_CTOR
(
proxy_vote_object
,
(
proxy_sources
))
id_type
id
;
/// The account receiving the proxied voting power
types
::
account_name
proxy_target
;
/// The list of accounts proxying their voting power to @ref proxy_target
chain
::
shared_set
<
types
::
account_name
>
proxy_sources
;
shared_set
<
types
::
account_name
>
proxy_sources
;
/// The total stake proxied to @ref proxy_target. At all times, this should be equal to the sum of stake over all
/// accounts in @ref proxy_sources
types
::
share_type
proxied_stake
=
0
;
void
add_proxy_source
(
const
types
::
account_name
&
source
,
chain
::
share_type
source_stake
,
chainbase
::
database
&
db
)
const
;
void
removeProxySource
(
const
types
::
account_name
&
source
,
chain
::
share_type
source_stake
,
void
add_proxy_source
(
const
types
::
account_name
&
source
,
share_type
source_stake
,
chainbase
::
database
&
db
)
const
;
void
removeProxySource
(
const
types
::
account_name
&
source
,
share_type
source_stake
,
chainbase
::
database
&
db
)
const
;
void
update_proxied_stake
(
chain
::
share_type
stake_delta
,
chainbase
::
database
&
db
)
const
;
void
update_proxied_stake
(
share_type
stake_delta
,
chainbase
::
database
&
db
)
const
;
/// Cancel proxying votes to @ref proxyTarget for all @ref proxySources
void
cancel_proxies
(
chainbase
::
database
&
db
)
const
;
...
...
@@ -158,7 +156,7 @@ class proxy_vote_object : public chainbase::object<chain::proxy_vote_object_type
*
* This is a singleton object within the database; there will only be one stored.
*/
class
producer_schedule_object
:
public
chainbase
::
object
<
chain
::
producer_schedule_object_type
,
producer_schedule_object
>
{
class
producer_schedule_object
:
public
chainbase
::
object
<
producer_schedule_object_type
,
producer_schedule_object
>
{
OBJECT_CTOR
(
producer_schedule_object
)
id_type
id
;
...
...
@@ -176,7 +174,7 @@ class producer_schedule_object : public chainbase::object<chain::producer_schedu
* producers. Although it is a const method, it will use its non-const db parameter to update its own records, as
* well as the race records stored in the @ref ProducerVotesObjects
*/
chain
::
producer_round
calculate_next_round
(
chainbase
::
database
&
db
)
const
;
producer_round
calculate_next_round
(
chainbase
::
database
&
db
)
const
;
/**
* @brief Reset all producers in the virtual race to the starting line, and reset virtual time to zero
...
...
@@ -243,6 +241,6 @@ using producer_schedule_multi_index = chainbase::shared_multi_index_container<
}
}
// namespace native::eos
CHAINBASE_SET_INDEX_TYPE
(
native
::
eosio
::
producer_votes_object
,
native
::
eosio
::
producer_votes_multi_index
)
CHAINBASE_SET_INDEX_TYPE
(
native
::
eosio
::
proxy_vote_object
,
native
::
eosio
::
proxy_vote_multi_index
)
CHAINBASE_SET_INDEX_TYPE
(
native
::
eosio
::
producer_schedule_object
,
native
::
eosio
::
producer_schedule_multi_index
)
CHAINBASE_SET_INDEX_TYPE
(
eosio
::
chain
::
producer_votes_object
,
eosio
::
chain
::
producer_votes_multi_index
)
CHAINBASE_SET_INDEX_TYPE
(
eosio
::
chain
::
proxy_vote_object
,
eosio
::
chain
::
proxy_vote_multi_index
)
CHAINBASE_SET_INDEX_TYPE
(
eosio
::
chain
::
producer_schedule_object
,
eosio
::
chain
::
producer_schedule_multi_index
)
libraries/
native_contract/include/eos/native_contract
/staked_balance_objects.hpp
→
libraries/
chain/include/eos/chain
/staked_balance_objects.hpp
浏览文件 @
92cbff7e
...
...
@@ -13,12 +13,10 @@
#include <fc/static_variant.hpp>
namespace
native
{
namespace
eosio
{
namespace
chain
{
using
namespace
::
eosio
::
chain
;
namespace
config
=
::
eosio
::
config
;
namespace
chain
=
::
eosio
::
chain
;
namespace
types
=
::
eosio
::
types
;
/**
...
...
@@ -47,7 +45,7 @@ struct producer_slate {
/**
* @brief The staked_balance_object class tracks the staked balance (voting balance) for accounts
*/
class
staked_balance_object
:
public
chainbase
::
object
<
chain
::
staked_balance_object_type
,
staked_balance_object
>
{
class
staked_balance_object
:
public
chainbase
::
object
<
staked_balance_object_type
,
staked_balance_object
>
{
OBJECT_CTOR
(
staked_balance_object
)
id_type
id
;
...
...
@@ -115,6 +113,6 @@ using staked_balance_multi_index = chainbase::shared_multi_index_container<
>
>
;
}
}
// namespace
native::eos
}
}
// namespace
eosio::chain
CHAINBASE_SET_INDEX_TYPE
(
native
::
eosio
::
staked_balance_object
,
native
::
eosio
::
staked_balance_multi_index
)
CHAINBASE_SET_INDEX_TYPE
(
eosio
::
chain
::
staked_balance_object
,
eosio
::
chain
::
staked_balance_multi_index
)
libraries/
native_contract
/producer_objects.cpp
→
libraries/
chain
/producer_objects.cpp
浏览文件 @
92cbff7e
...
...
@@ -2,8 +2,8 @@
* @file
* @copyright defined in eos/LICENSE.txt
*/
#include <eos/
native_contract
/producer_objects.hpp>
#include <eos/
native_contract
/staked_balance_objects.hpp>
#include <eos/
chain
/producer_objects.hpp>
#include <eos/
chain
/staked_balance_objects.hpp>
#include <eos/chain/producer_object.hpp>
...
...
@@ -11,9 +11,8 @@
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
namespace
native
{
namespace
eosio
{
using
namespace
chain
;
namespace
chain
{
using
namespace
types
;
void
producer_votes_object
::
update_votes
(
share_type
deltaVotes
,
uint128
current_race_time
)
{
...
...
@@ -146,4 +145,4 @@ void producer_schedule_object::reset_producer_race(chainbase::database& db) cons
});
}
}
}
// namespace
native::eosio
}
}
// namespace
eosio::chain
libraries/
native_contract
/staked_balance_objects.cpp
→
libraries/
chain
/staked_balance_objects.cpp
浏览文件 @
92cbff7e
...
...
@@ -2,16 +2,15 @@
* @file
* @copyright defined in eos/LICENSE.txt
*/
#include <eos/
native_contract
/staked_balance_objects.hpp>
#include <eos/
native_contract
/producer_objects.hpp>
#include <eos/
chain
/staked_balance_objects.hpp>
#include <eos/
chain
/producer_objects.hpp>
#include <eos/chain/global_property_object.hpp>
#include <boost/range/algorithm/for_each.hpp>
namespace
native
{
namespace
eosio
{
using
namespace
eosio
::
chain
;
namespace
chain
{
using
namespace
eosio
::
types
;
void
staked_balance_object
::
stake_tokens
(
share_type
new_stake
,
chainbase
::
database
&
db
)
const
{
...
...
@@ -57,4 +56,4 @@ void staked_balance_object::propagate_votes(share_type stake_delta, chainbase::d
}
}
}
}
// namespace
native::eos
}
}
// namespace
eosio::chain
libraries/native_contract/CMakeLists.txt
浏览文件 @
92cbff7e
...
...
@@ -3,8 +3,6 @@ file(GLOB HEADERS "include/eos/native_contract/*.hpp")
## SORT .cpp by most likely to change / break compile
add_library
(
eos_native_contract
eos_contract.cpp
producer_objects.cpp
staked_balance_objects.cpp
native_contract_chain_initializer.cpp
native_contract_chain_administrator.cpp
genesis_state.cpp
...
...
libraries/native_contract/eos_contract.cpp
浏览文件 @
92cbff7e
...
...
@@ -10,12 +10,12 @@
#include <eos/chain/exceptions.hpp>
#include <eos/chain/account_object.hpp>
#include <eos/
native_contract
/balance_object.hpp>
#include <eos/
chain
/balance_object.hpp>
#include <eos/chain/permission_object.hpp>
#include <eos/chain/permission_link_object.hpp>
#include <eos/chain/global_property_object.hpp>
#include <eos/
native_contract
/staked_balance_objects.hpp>
#include <eos/
native_contract
/producer_objects.hpp>
#include <eos/
chain
/staked_balance_objects.hpp>
#include <eos/
chain
/producer_objects.hpp>
#include <eos/chain/producer_object.hpp>
#include <eos/chain/wasm_interface.hpp>
...
...
libraries/native_contract/include/eos/native_contract/objects.hpp
浏览文件 @
92cbff7e
...
...
@@ -6,6 +6,6 @@
/// @file This file #include's all database objects/indices used by the C++ native contract implementation
#include <eos/
native_contract
/staked_balance_objects.hpp>
#include <eos/
native_contract
/balance_object.hpp>
#include <eos/
native_contract
/producer_objects.hpp>
#include <eos/
chain
/staked_balance_objects.hpp>
#include <eos/
chain
/balance_object.hpp>
#include <eos/
chain
/producer_objects.hpp>
libraries/native_contract/native_contract_chain_administrator.cpp
浏览文件 @
92cbff7e
...
...
@@ -3,7 +3,7 @@
* @copyright defined in eos/LICENSE.txt
*/
#include <eos/native_contract/native_contract_chain_administrator.hpp>
#include <eos/
native_contract
/producer_objects.hpp>
#include <eos/
chain
/producer_objects.hpp>
#include <eos/chain/global_property_object.hpp>
#include <eos/chain/producer_object.hpp>
...
...
@@ -16,7 +16,7 @@ namespace eosio { namespace native_contract {
using
administrator
=
native_contract_chain_administrator
;
producer_round
administrator
::
get_next_round
(
chainbase
::
database
&
db
)
{
return
native
::
eosio
::
producer_schedule_object
::
get
(
db
).
calculate_next_round
(
db
);
return
eosio
::
chain
::
producer_schedule_object
::
get
(
db
).
calculate_next_round
(
db
);
}
chain
::
blockchain_configuration
administrator
::
get_blockchain_configuration
(
const
chainbase
::
database
&
db
,
...
...
libraries/native_contract/native_contract_chain_initializer.cpp
浏览文件 @
92cbff7e
...
...
@@ -32,12 +32,12 @@ std::array<types::account_name, config::blocks_per_round> native_contract_chain_
void
native_contract_chain_initializer
::
register_types
(
chain_controller
&
chain
,
chainbase
::
database
&
db
)
{
// Install the native contract's indexes; we can't do anything until our objects are recognized
db
.
add_index
<
native
::
eosio
::
staked_balance_multi_index
>
();
db
.
add_index
<
native
::
eosio
::
producer_votes_multi_index
>
();
db
.
add_index
<
native
::
eosio
::
proxy_vote_multi_index
>
();
db
.
add_index
<
native
::
eosio
::
producer_schedule_multi_index
>
();
db
.
add_index
<
eosio
::
chain
::
staked_balance_multi_index
>
();
db
.
add_index
<
eosio
::
chain
::
producer_votes_multi_index
>
();
db
.
add_index
<
eosio
::
chain
::
proxy_vote_multi_index
>
();
db
.
add_index
<
eosio
::
chain
::
producer_schedule_multi_index
>
();
db
.
add_index
<
native
::
eosio
::
balance_multi_index
>
();
db
.
add_index
<
eosio
::
chain
::
balance_multi_index
>
();
#define SET_APP_HANDLER( contract, scope, action, nspace ) \
chain.set_apply_handler( #contract, #scope, #action, &BOOST_PP_CAT(native::nspace::apply_, BOOST_PP_CAT(contract, BOOST_PP_CAT(_,action) ) ) )
...
...
@@ -98,7 +98,7 @@ std::vector<message> native_contract_chain_initializer::prepare_database(chain_c
std
::
vector
<
message
>
messages_to_process
;
// Create the singleton object, producer_schedule_object
db
.
create
<
native
::
eosio
::
producer_schedule_object
>
([](
const
auto
&
){});
db
.
create
<
eosio
::
chain
::
producer_schedule_object
>
([](
const
auto
&
){});
/// Create the native contract accounts manually; sadly, we can't run their contracts to make them create themselves
auto
CreateNativeAccount
=
[
this
,
&
db
](
name
name
,
auto
liquidBalance
)
{
...
...
@@ -121,11 +121,11 @@ std::vector<message> native_contract_chain_initializer::prepare_database(chain_c
p
.
name
=
"active"
;
p
.
auth
.
threshold
=
1
;
});
db
.
create
<
native
::
eosio
::
balance_object
>
([
&
name
,
liquidBalance
](
auto
&
b
)
{
db
.
create
<
eosio
::
chain
::
balance_object
>
([
&
name
,
liquidBalance
](
auto
&
b
)
{
b
.
owner_name
=
name
;
b
.
balance
=
liquidBalance
;
});
db
.
create
<
native
::
eosio
::
staked_balance_object
>
([
&
name
](
auto
&
sb
)
{
sb
.
ownerName
=
name
;
});
db
.
create
<
eosio
::
chain
::
staked_balance_object
>
([
&
name
](
auto
&
sb
)
{
sb
.
ownerName
=
name
;
});
};
CreateNativeAccount
(
config
::
eos_contract_name
,
config
::
initial_token_supply
);
...
...
plugins/chain_plugin/chain_plugin.cpp
浏览文件 @
92cbff7e
...
...
@@ -15,8 +15,8 @@
#include <eos/native_contract/native_contract_chain_initializer.hpp>
#include <eos/native_contract/native_contract_chain_administrator.hpp>
#include <eos/
native_contract
/staked_balance_objects.hpp>
#include <eos/
native_contract
/balance_object.hpp>
#include <eos/
chain
/staked_balance_objects.hpp>
#include <eos/
chain
/balance_object.hpp>
#include <eos/native_contract/genesis_state.hpp>
#include <eos/utilities/key_conversion.hpp>
...
...
@@ -424,7 +424,7 @@ read_only::get_code_results read_only::get_code( const get_code_params& params )
}
read_only
::
get_account_results
read_only
::
get_account
(
const
get_account_params
&
params
)
const
{
using
namespace
native
::
eosio
;
using
namespace
eosio
::
chain
;
get_account_results
result
;
result
.
account_name
=
params
.
account_name
;
...
...
tests/common/database_fixture.cpp
浏览文件 @
92cbff7e
...
...
@@ -38,8 +38,6 @@
uint32_t
EOS_TESTING_GENESIS_TIMESTAMP
=
1431700005
;
namespace
eosio
{
namespace
chain
{
using
namespace
native
::
eosio
;
using
namespace
native
;
testing_fixture
::
testing_fixture
()
{
default_genesis_state
.
initial_timestamp
=
fc
::
time_point_sec
(
EOS_TESTING_GENESIS_TIMESTAMP
);
...
...
@@ -152,15 +150,15 @@ void testing_blockchain::sync_with(testing_blockchain& other) {
}
types
::
asset
testing_blockchain
::
get_liquid_balance
(
const
types
::
account_name
&
account
)
{
return
get_database
().
get
<
balance_object
,
native
::
eosio
::
by_owner_name
>
(
account
).
balance
;
return
get_database
().
get
<
balance_object
,
eosio
::
chain
::
by_owner_name
>
(
account
).
balance
;
}
types
::
asset
testing_blockchain
::
get_staked_balance
(
const
types
::
account_name
&
account
)
{
return
get_database
().
get
<
staked_balance_object
,
native
::
eosio
::
by_owner_name
>
(
account
).
staked_balance
;
return
get_database
().
get
<
staked_balance_object
,
eosio
::
chain
::
by_owner_name
>
(
account
).
staked_balance
;
}
types
::
asset
testing_blockchain
::
get_unstaking_balance
(
const
types
::
account_name
&
account
)
{
return
get_database
().
get
<
staked_balance_object
,
native
::
eosio
::
by_owner_name
>
(
account
).
unstaking_balance
;
return
get_database
().
get
<
staked_balance_object
,
eosio
::
chain
::
by_owner_name
>
(
account
).
unstaking_balance
;
}
std
::
set
<
types
::
account_name
>
testing_blockchain
::
get_approved_producers
(
const
types
::
account_name
&
account
)
{
...
...
tests/tests/chain_tests.cpp
浏览文件 @
92cbff7e
...
...
@@ -8,7 +8,7 @@
#include <eos/chain/permission_link_object.hpp>
#include <eos/chain/authority_checker.hpp>
#include <eos/
native_contract
/producer_objects.hpp>
#include <eos/
chain
/producer_objects.hpp>
#include <fc/crypto/digest.hpp>
...
...
tests/tests/native_contract_tests.cpp
浏览文件 @
92cbff7e
...
...
@@ -12,7 +12,7 @@
#include <eos/chain/authority_checker.hpp>
#include <eos/chain_plugin/chain_plugin.hpp>
#include <eos/
native_contract
/producer_objects.hpp>
#include <eos/
chain
/producer_objects.hpp>
#include <eos/utilities/tempdir.hpp>
...
...
@@ -259,7 +259,7 @@ BOOST_FIXTURE_TEST_CASE(producer_voting_1, testing_fixture) {
{
BOOST_CHECK_EQUAL
(
chain
.
get_approved_producers
(
"bob"
).
count
(
"joe"
),
1
);
BOOST_CHECK_EQUAL
(
chain
.
get_staked_balance
(
"bob"
),
asset
(
100
));
const
auto
&
joeVotes
=
chain_db
.
get
<
native
::
eosio
::
producer_votes_object
,
native
::
eosio
::
by_owner_name
>
(
"joe"
);
const
auto
&
joeVotes
=
chain_db
.
get
<
eosio
::
chain
::
producer_votes_object
,
eosio
::
chain
::
by_owner_name
>
(
"joe"
);
BOOST_CHECK_EQUAL
(
joeVotes
.
get_votes
(),
chain
.
get_staked_balance
(
"bob"
));
}
...
...
@@ -274,7 +274,7 @@ BOOST_FIXTURE_TEST_CASE(producer_voting_1, testing_fixture) {
{
BOOST_CHECK_EQUAL
(
chain
.
get_approved_producers
(
"bob"
).
count
(
"joe"
),
0
);
const
auto
&
joeVotes
=
chain_db
.
get
<
native
::
eosio
::
producer_votes_object
,
native
::
eosio
::
by_owner_name
>
(
"joe"
);
const
auto
&
joeVotes
=
chain_db
.
get
<
eosio
::
chain
::
producer_votes_object
,
eosio
::
chain
::
by_owner_name
>
(
"joe"
);
BOOST_CHECK_EQUAL
(
joeVotes
.
get_votes
(),
0
);
}
}
FC_LOG_AND_RETHROW
()
...
...
@@ -295,7 +295,7 @@ BOOST_FIXTURE_TEST_CASE(producer_voting_2, testing_fixture) {
{
BOOST_CHECK_EQUAL
(
chain
.
get_approved_producers
(
"bob"
).
count
(
"joe"
),
1
);
BOOST_CHECK_EQUAL
(
chain
.
get_staked_balance
(
"bob"
),
asset
(
100
));
const
auto
&
joeVotes
=
chain_db
.
get
<
native
::
eosio
::
producer_votes_object
,
native
::
eosio
::
by_owner_name
>
(
"joe"
);
const
auto
&
joeVotes
=
chain_db
.
get
<
eosio
::
chain
::
producer_votes_object
,
eosio
::
chain
::
by_owner_name
>
(
"joe"
);
BOOST_CHECK_EQUAL
(
joeVotes
.
get_votes
(),
chain
.
get_staked_balance
(
"bob"
));
}
...
...
@@ -305,7 +305,7 @@ BOOST_FIXTURE_TEST_CASE(producer_voting_2, testing_fixture) {
{
BOOST_CHECK_EQUAL
(
chain
.
get_approved_producers
(
"bob"
).
count
(
"joe"
),
1
);
BOOST_CHECK_EQUAL
(
chain
.
get_staked_balance
(
"bob"
),
asset
(
100
));
const
auto
&
joeVotes
=
chain_db
.
get
<
native
::
eosio
::
producer_votes_object
,
native
::
eosio
::
by_owner_name
>
(
"joe"
);
const
auto
&
joeVotes
=
chain_db
.
get
<
eosio
::
chain
::
producer_votes_object
,
eosio
::
chain
::
by_owner_name
>
(
"joe"
);
BOOST_CHECK_EQUAL
(
joeVotes
.
get_votes
(),
chain
.
get_staked_balance
(
"bob"
));
}
...
...
@@ -320,7 +320,7 @@ BOOST_FIXTURE_TEST_CASE(producer_voting_2, testing_fixture) {
{
BOOST_CHECK_EQUAL
(
chain
.
get_approved_producers
(
"bob"
).
count
(
"joe"
),
0
);
const
auto
&
joeVotes
=
chain_db
.
get
<
native
::
eosio
::
producer_votes_object
,
native
::
eosio
::
by_owner_name
>
(
"joe"
);
const
auto
&
joeVotes
=
chain_db
.
get
<
eosio
::
chain
::
producer_votes_object
,
eosio
::
chain
::
by_owner_name
>
(
"joe"
);
BOOST_CHECK_EQUAL
(
joeVotes
.
get_votes
(),
0
);
}
}
FC_LOG_AND_RETHROW
()
...
...
@@ -358,7 +358,7 @@ BOOST_FIXTURE_TEST_CASE(producer_proxy_voting, testing_fixture) {
{
BOOST_CHECK_EQUAL
(
chain
.
get_approved_producers
(
"proxy"
).
count
(
"producer"
),
1
);
BOOST_CHECK_EQUAL
(
chain
.
get_staked_balance
(
"stakeholder"
),
asset
(
100
));
const
auto
&
producerVotes
=
chain_db
.
get
<
native
::
eosio
::
producer_votes_object
,
native
::
eosio
::
by_owner_name
>
(
"producer"
);
const
auto
&
producerVotes
=
chain_db
.
get
<
eosio
::
chain
::
producer_votes_object
,
eosio
::
chain
::
by_owner_name
>
(
"producer"
);
BOOST_CHECK_EQUAL
(
producerVotes
.
get_votes
(),
chain
.
get_staked_balance
(
"stakeholder"
));
}
...
...
@@ -373,7 +373,7 @@ BOOST_FIXTURE_TEST_CASE(producer_proxy_voting, testing_fixture) {
{
BOOST_CHECK_EQUAL
(
chain
.
get_approved_producers
(
"proxy"
).
count
(
"producer"
),
0
);
const
auto
&
producerVotes
=
chain_db
.
get
<
native
::
eosio
::
producer_votes_object
,
native
::
eosio
::
by_owner_name
>
(
"producer"
);
const
auto
&
producerVotes
=
chain_db
.
get
<
eosio
::
chain
::
producer_votes_object
,
eosio
::
chain
::
by_owner_name
>
(
"producer"
);
BOOST_CHECK_EQUAL
(
producerVotes
.
get_votes
(),
0
);
}
};
...
...
tests/tests/special_accounts_tests.cpp
浏览文件 @
92cbff7e
...
...
@@ -12,7 +12,7 @@
#include <eos/chain/permission_object.hpp>
#include <eos/chain/key_value_object.hpp>
#include <eos/
native_contract
/producer_objects.hpp>
#include <eos/
chain
/producer_objects.hpp>
#include <eos/utilities/tempdir.hpp>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录