Skip to content

Commit

Permalink
Remove lazy vote delete, remove clear-votes-before-block
Browse files Browse the repository at this point in the history
  • Loading branch information
On1x committed Nov 1, 2018
1 parent c123af5 commit e2df31d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 25 deletions.
7 changes: 1 addition & 6 deletions libraries/chain/chain_evaluator.cpp
Expand Up @@ -874,13 +874,8 @@ namespace graphene { namespace chain {
abs_rshares=0;
}

// Lazily delete vote
if (itr != content_vote_idx.end() && itr->num_changes == -1) {
if (_db.is_producing())
FC_ASSERT(false, "Cannot vote again on a content after payout.");

_db.remove(*itr);
itr = content_vote_idx.end();
FC_ASSERT(false, "Cannot vote again on a content after payout.");
}

if (itr == content_vote_idx.end()) {
Expand Down
12 changes: 0 additions & 12 deletions libraries/chain/database.cpp
Expand Up @@ -359,14 +359,6 @@ namespace graphene { namespace chain {
_block_num_check_free_memory = value;
}

void database::set_clear_votes(uint32_t clear_votes_block) {
_clear_votes_block = clear_votes_block;
}

bool database::clear_votes() {
return _clear_votes_block > head_block_num();
}

void database::set_skip_virtual_ops() {
_skip_virtual_ops = true;
}
Expand Down Expand Up @@ -2156,10 +2148,6 @@ namespace graphene { namespace chain {
modify(cur_vote, [&](content_vote_object &cvo) {
cvo.num_changes = -1;
});
} else {
if(clear_votes()) {
remove(cur_vote);
}
}
}
} FC_CAPTURE_AND_RETHROW()
Expand Down
3 changes: 0 additions & 3 deletions libraries/chain/include/graphene/chain/database.hpp
Expand Up @@ -95,9 +95,7 @@ namespace graphene { namespace chain {
void set_block_num_check_free_size(uint32_t);
void check_free_memory(bool skip_print, uint32_t current_block_num);

void set_clear_votes(uint32_t clear_votes_block);
void set_skip_virtual_ops();
bool clear_votes();

/**
* @brief wipe Delete database from disk, and potentially the raw chain as well.
Expand Down Expand Up @@ -529,7 +527,6 @@ namespace graphene { namespace chain {

uint32_t _block_num_check_free_memory = 1000;

uint32_t _clear_votes_block = 0;
bool _skip_virtual_ops = false;
bool _enable_plugins_on_push_transaction = true;

Expand Down
4 changes: 0 additions & 4 deletions plugins/chain/plugin.cpp
Expand Up @@ -44,7 +44,6 @@ namespace chain {
size_t inc_shared_memory_size;
size_t min_free_shared_memory_size;

uint32_t clear_votes_before_block = 0;
bool enable_plugins_on_push_transaction;

uint32_t block_num_check_free_size = 0;
Expand Down Expand Up @@ -286,7 +285,6 @@ namespace chain {
my->shared_memory_size = fc::parse_size(options.at("shared-file-size").as<std::string>());
my->inc_shared_memory_size = fc::parse_size(options.at("inc-shared-file-size").as<std::string>());
my->min_free_shared_memory_size = fc::parse_size(options.at("min-free-shared-file-size").as<std::string>());
my->clear_votes_before_block = options.at("clear-votes-before-block").as<uint32_t>();
my->skip_virtual_ops = options.at("skip-virtual-ops").as<bool>();

if (options.count("block-num-check-free-size")) {
Expand Down Expand Up @@ -337,8 +335,6 @@ namespace chain {
my->db.set_inc_shared_memory_size(my->inc_shared_memory_size);
my->db.set_min_free_shared_memory_size(my->min_free_shared_memory_size);

my->db.set_clear_votes(my->clear_votes_before_block);

if(my->skip_virtual_ops) {
my->db.set_skip_virtual_ops();
}
Expand Down

0 comments on commit e2df31d

Please sign in to comment.