Fix #549 testnet sync

This commit is contained in:
Vlad Dobromyslov 2023-06-05 09:24:04 +00:00
parent 97eaf4575a
commit fee7bc99fa
2 changed files with 24 additions and 8 deletions

View file

@ -30,7 +30,7 @@ build-mainnet:
- build/programs/
- build/tests/
rules:
- if: $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "beatrice" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "beatrice" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
- if: $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "beatrice" || $CI_COMMIT_BRANCH == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "beatrice" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"
tags:
- builder
@ -82,7 +82,7 @@ build-testnet:
- build/programs/
- build/tests/
rules:
- if: $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "beatrice" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "beatrice" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
- if: $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "beatrice" || $CI_COMMIT_BRANCH == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "beatrice" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"
when: manual
tags:
- builder

View file

@ -97,10 +97,18 @@ void_result update_son_wallet_evaluator::do_evaluate(const son_wallet_update_ope
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
FC_ASSERT( op.payer == db().get_global_properties().parameters.son_account(), "SON paying account must be set as payer." );
const auto& idx = db().get_index_type<son_wallet_index>().indices().get<by_id>();
const son_wallet_id_type son_wallet_id = [&]{
if(db().head_block_time() >= HARDFORK_SON_FOR_ETHEREUM_TIME)
{
const auto ast = active_sidechain_types(db().head_block_time());
const auto id = (op.son_wallet_id.instance.value - std::distance(ast.begin(), ast.find(op.sidechain))) / ast.size();
const son_wallet_id_type son_wallet_id{ id };
return son_wallet_id_type{ id };
}
return op.son_wallet_id;
}();
const auto& idx = db().get_index_type<son_wallet_index>().indices().get<by_id>();
FC_ASSERT( idx.find(son_wallet_id) != idx.end() );
//auto itr = idx.find(op.son_wallet_id);
//FC_ASSERT( itr->addresses.find(op.sidechain) == itr->addresses.end() ||
@ -110,10 +118,18 @@ void_result update_son_wallet_evaluator::do_evaluate(const son_wallet_update_ope
object_id_type update_son_wallet_evaluator::do_apply(const son_wallet_update_operation& op)
{ try {
const auto& idx = db().get_index_type<son_wallet_index>().indices().get<by_id>();
const son_wallet_id_type son_wallet_id = [&]{
if(db().head_block_time() >= HARDFORK_SON_FOR_ETHEREUM_TIME)
{
const auto ast = active_sidechain_types(db().head_block_time());
const auto id = (op.son_wallet_id.instance.value - std::distance(ast.begin(), ast.find(op.sidechain))) / ast.size();
const son_wallet_id_type son_wallet_id{ id };
return son_wallet_id_type{ id };
}
return op.son_wallet_id;
}();
const auto& idx = db().get_index_type<son_wallet_index>().indices().get<by_id>();
auto itr = idx.find(son_wallet_id);
if (itr != idx.end())
{