Fixes for 1.5.24-beta
This commit is contained in:
parent
9fe351300b
commit
f0654e5ffd
4 changed files with 20 additions and 6 deletions
|
|
@ -2283,7 +2283,7 @@ void database::perform_son_tasks()
|
||||||
// Add vote_ids for HIVE and ETHEREUM to all existing SONs
|
// Add vote_ids for HIVE and ETHEREUM to all existing SONs
|
||||||
const auto &all_sons = get_index_type<son_index>().indices().get<by_id>();
|
const auto &all_sons = get_index_type<son_index>().indices().get<by_id>();
|
||||||
for (const son_object &son : all_sons) {
|
for (const son_object &son : all_sons) {
|
||||||
vote_id_type existing_vote_id_bitcoin;
|
const auto existing_vote_id_bitcoin = son.get_bitcoin_vote_id();
|
||||||
vote_id_type new_vote_id_hive;
|
vote_id_type new_vote_id_hive;
|
||||||
vote_id_type new_vote_id_eth;
|
vote_id_type new_vote_id_eth;
|
||||||
|
|
||||||
|
|
@ -2300,7 +2300,7 @@ void database::perform_son_tasks()
|
||||||
// Duplicate all votes from bitcoin to hive
|
// Duplicate all votes from bitcoin to hive
|
||||||
const auto &all_accounts = get_index_type<account_index>().indices().get<by_id>();
|
const auto &all_accounts = get_index_type<account_index>().indices().get<by_id>();
|
||||||
for (const auto &account : all_accounts) {
|
for (const auto &account : all_accounts) {
|
||||||
if (account.options.votes.count(existing_vote_id_bitcoin) != 0) {
|
if (existing_vote_id_bitcoin.valid() && account.options.votes.count(*existing_vote_id_bitcoin) != 0) {
|
||||||
modify(account, [new_vote_id_hive](account_object &a) {
|
modify(account, [new_vote_id_hive](account_object &a) {
|
||||||
a.options.votes.insert(new_vote_id_hive);
|
a.options.votes.insert(new_vote_id_hive);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ private:
|
||||||
uint16_t retries_threshold = 150;
|
uint16_t retries_threshold = 150;
|
||||||
|
|
||||||
bool first_block_skipped;
|
bool first_block_skipped;
|
||||||
|
bool son_processing_enabled;
|
||||||
void on_applied_block(const signed_block &b);
|
void on_applied_block(const signed_block &b);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -135,7 +136,8 @@ peerplays_sidechain_plugin_impl::peerplays_sidechain_plugin_impl(peerplays_sidec
|
||||||
}
|
}
|
||||||
return net_handlers;
|
return net_handlers;
|
||||||
}()),
|
}()),
|
||||||
first_block_skipped(false) {
|
first_block_skipped(false),
|
||||||
|
son_processing_enabled(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
peerplays_sidechain_plugin_impl::~peerplays_sidechain_plugin_impl() {
|
peerplays_sidechain_plugin_impl::~peerplays_sidechain_plugin_impl() {
|
||||||
|
|
@ -871,7 +873,19 @@ void peerplays_sidechain_plugin_impl::settle_sidechain_transactions(sidechain_ty
|
||||||
|
|
||||||
void peerplays_sidechain_plugin_impl::on_applied_block(const signed_block &b) {
|
void peerplays_sidechain_plugin_impl::on_applied_block(const signed_block &b) {
|
||||||
if (first_block_skipped) {
|
if (first_block_skipped) {
|
||||||
schedule_son_processing();
|
if(son_processing_enabled) {
|
||||||
|
schedule_son_processing();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const fc::time_point now_fine = fc::time_point::now();
|
||||||
|
const fc::time_point_sec now = now_fine + fc::microseconds( 500000 );
|
||||||
|
if( plugin.database().get_slot_time(1) >= now )
|
||||||
|
{
|
||||||
|
son_processing_enabled = true;
|
||||||
|
schedule_son_processing();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
first_block_skipped = true;
|
first_block_skipped = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -680,7 +680,7 @@ void sidechain_net_handler::on_applied_block(const signed_block &b) {
|
||||||
const bool is_tracked_asset =
|
const bool is_tracked_asset =
|
||||||
((sidechain == sidechain_type::bitcoin) && (transfer_op.amount.asset_id == gpo.parameters.btc_asset())) ||
|
((sidechain == sidechain_type::bitcoin) && (transfer_op.amount.asset_id == gpo.parameters.btc_asset())) ||
|
||||||
((sidechain == sidechain_type::ethereum) && (transfer_op.amount.asset_id == gpo.parameters.eth_asset())) ||
|
((sidechain == sidechain_type::ethereum) && (transfer_op.amount.asset_id == gpo.parameters.eth_asset())) ||
|
||||||
((sidechain == sidechain_type::ethereum) && (transfer_op.amount.asset_id != gpo.parameters.btc_asset()) && (transfer_op.amount.asset_id != gpo.parameters.hbd_asset()) && (transfer_op.amount.asset_id != gpo.parameters.hive_asset())) ||
|
((sidechain == sidechain_type::ethereum) && (transfer_op.amount.asset_id != gpo.parameters.btc_asset()) && (transfer_op.amount.asset_id != gpo.parameters.hbd_asset()) && (transfer_op.amount.asset_id != gpo.parameters.hive_asset()) && (transfer_op.amount.asset_id != asset_id_type())) ||
|
||||||
((sidechain == sidechain_type::hive) && (transfer_op.amount.asset_id == gpo.parameters.hbd_asset())) ||
|
((sidechain == sidechain_type::hive) && (transfer_op.amount.asset_id == gpo.parameters.hbd_asset())) ||
|
||||||
((sidechain == sidechain_type::hive) && (transfer_op.amount.asset_id == gpo.parameters.hive_asset()));
|
((sidechain == sidechain_type::hive) && (transfer_op.amount.asset_id == gpo.parameters.hive_asset()));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public:
|
||||||
{
|
{
|
||||||
fixture_.init_nathan();
|
fixture_.init_nathan();
|
||||||
fixture_.generate_blocks(HARDFORK_SON_FOR_ETHEREUM_TIME);
|
fixture_.generate_blocks(HARDFORK_SON_FOR_ETHEREUM_TIME);
|
||||||
fixture_.generate_block();
|
fixture_.generate_maintenance_block();
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_son(const std::string& account_name, const std::string& son_url,
|
void create_son(const std::string& account_name, const std::string& son_url,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue