Fix witness/delegate count voting; fix unclean witness shutdown on mac
This commit is contained in:
parent
2f9e636618
commit
6436f0142f
2 changed files with 12 additions and 10 deletions
|
|
@ -112,6 +112,7 @@ void database::update_active_witnesses()
|
|||
share_type stake_target = _total_voting_stake / 2;
|
||||
share_type stake_tally = _witness_count_histogram_buffer[0];
|
||||
size_t witness_count = 0;
|
||||
if( stake_target > 0 )
|
||||
while( (witness_count < _witness_count_histogram_buffer.size() - 1)
|
||||
&& (stake_tally <= stake_target) )
|
||||
stake_tally += _witness_count_histogram_buffer[++witness_count];
|
||||
|
|
@ -177,6 +178,7 @@ void database::update_active_delegates()
|
|||
uint64_t stake_target = _total_voting_stake / 2;
|
||||
uint64_t stake_tally = _committee_count_histogram_buffer[0];
|
||||
size_t delegate_count = 0;
|
||||
if( stake_target > 0 )
|
||||
while( (delegate_count < _committee_count_histogram_buffer.size() - 1)
|
||||
&& (stake_tally <= stake_target) )
|
||||
stake_tally += _committee_count_histogram_buffer[++delegate_count];
|
||||
|
|
@ -381,7 +383,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
|||
uint32_t offset = id.instance();
|
||||
// if they somehow managed to specify an illegal offset, ignore it.
|
||||
if( offset < d._vote_tally_buffer.size() )
|
||||
d._vote_tally_buffer[ offset ] += voting_stake;
|
||||
d._vote_tally_buffer[offset] += voting_stake;
|
||||
}
|
||||
|
||||
if( opinion_account.options.num_witness <= props.parameters.maximum_witness_count )
|
||||
|
|
@ -394,7 +396,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
|||
// in particular, this takes care of the case where a
|
||||
// member was voting for a high number, then the
|
||||
// parameter was lowered.
|
||||
d._witness_count_histogram_buffer[ offset ] += voting_stake;
|
||||
d._witness_count_histogram_buffer[offset] += voting_stake;
|
||||
}
|
||||
if( opinion_account.options.num_committee <= props.parameters.maximum_committee_count )
|
||||
{
|
||||
|
|
@ -404,7 +406,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
|||
// are turned into votes for maximum_committee_count.
|
||||
//
|
||||
// same rationale as for witnesses
|
||||
d._committee_count_histogram_buffer[ offset ] += voting_stake;
|
||||
d._committee_count_histogram_buffer[offset] += voting_stake;
|
||||
}
|
||||
|
||||
d._total_voting_stake += voting_stake;
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ int main(int argc, char** argv) {
|
|||
node.startup_plugins();
|
||||
|
||||
fc::promise<int>::ptr exit_promise = new fc::promise<int>("UNIX Signal Handler");
|
||||
#ifdef __unix__
|
||||
#if defined __APPLE__ || defined __unix__
|
||||
fc::set_signal_handler([&exit_promise](int signal) {
|
||||
exit_promise->set_value(signal);
|
||||
}, SIGINT);
|
||||
|
|
|
|||
Loading…
Reference in a new issue